Skip to content

v2 HackMD CLI #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7859126
feat: add v1 getHistory cmd
Feb 22, 2022
c3482e1
feat: migrate oclif used in getHistory to v2
Feb 22, 2022
d2cd612
feat: add v1-api whomai cmd
Feb 22, 2022
305cab5
feat: add v1-api's notes and team-notes commands
Feb 23, 2022
f56db22
feat: add v1-api's teams command
Feb 24, 2022
009422e
feat: add notes CRUD sub commands
Feb 24, 2022
32d040f
Delete deprecated commands
Feb 24, 2022
94e3933
feat: update v1-api client config
Feb 24, 2022
b0f580b
feat: update bin/dev and bin/run cmd for v2 oclif usage
Feb 25, 2022
f7cdaab
feat: update config test and run linter
Mar 1, 2022
8dd1c50
Bump @hackmd/api version to ^2.0.0-pre.0
Mar 1, 2022
bf4bd48
feat: add config-test github action
Mar 1, 2022
e2958e8
refactor: typing for create note options
Mar 2, 2022
a16afdc
refactor: read pipe when creating note
Mar 2, 2022
e90830b
fix: remove unused code
Mar 2, 2022
e7f1425
fix: run linter
Mar 2, 2022
5576e1f
Bump hackmd api and cli version to v2.0.0
Mar 2, 2022
7263476
fix: fix config test case of default hackmdAPIEndpointURL value
Mar 2, 2022
dfffcbf
update .env.example
Mar 4, 2022
d78b43c
feat: add hackmd-api flag descriptions
Mar 7, 2022
49bdaf1
Update v2.0.0 README.md
Mar 7, 2022
c2c5950
fix: fix accessToken variable name
Mar 7, 2022
4cb7048
Add hackmd-cli v2 notice README
Mar 7, 2022
2a54032
feat: add login with accessToken command
Mar 7, 2022
4aa819e
feat: add login, logout with access token and HackMDCommand
Mar 8, 2022
f516a92
refactor: add function setAccessTokenConfig
Mar 8, 2022
720e0bf
Update README with accessToken-based login and logout commands
Mar 8, 2022
5c98029
Add change log
Mar 8, 2022
58b7a4a
docs: add v1 migration guide
Yukaii Mar 9, 2022
361167c
docs: format changelog
Yukaii Mar 9, 2022
eb11aca
docs: edits to README
Yukaii Mar 9, 2022
39befdd
fix: set access token prompt type to hide
Yukaii Mar 9, 2022
b5e969a
feat: throw access token check error explictly
Yukaii Mar 9, 2022
d535818
fix: `hackmd should be `HackMD`
Yukaii Mar 9, 2022
0feb1e3
fix: type errors
Yukaii Mar 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SERVER_URL=
HMD_API_ENDPOINT_URL=
HMD_API_ACCESS_TOKEN=
24 changes: 24 additions & 0 deletions .github/workflows/config-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Config Test"

on: push

jobs:
test:
name: test config files
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['12', '14', '16']

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- run: npm run test

20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

All notable changes to HackMD-CLI will be documented in this file.

## 2.0.0

### Added

- Rewrite old and add new commands supported by [v2 @hackmd/api](https://www.npmjs.com/package/@hackmd/api)
- Github Action CI for config testing

### Changed

- Migrate [oclif](https://www.npmjs.com/package/oclif) to v2.5.0
- Change to use hackmd api end point URL and and access token for authentication

### Removed

- Remove commands based on deprecated v1 @hackmd/api, including `import`, `export`
- CodiMD has not been supported
383 changes: 272 additions & 111 deletions README.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node

const oclif = require('@oclif/core')

const path = require('path')
const project = path.join(__dirname, '..', 'tsconfig.json')

// In dev mode -> use ts-node and dev plugins
process.env.NODE_ENV = 'development'

require('ts-node').register({project})

// In dev mode, always show stack traces
oclif.settings.debug = true;

// Start the CLI
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\dev" %*
17 changes: 2 additions & 15 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/usr/bin/env node

const fs = require('fs')
const path = require('path')
const project = path.join(__dirname, '../tsconfig.json')
const dev = fs.existsSync(project)
const oclif = require('@oclif/core')

if (process.env.NODE_ENV === 'development') {
require('dotenv').config()
}

if (dev) {
require('ts-node').register({project})
}

require(`../${dev ? 'src' : 'lib'}`).run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'))
oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))
Empty file modified bin/run.cmd
100644 → 100755
Empty file.
Loading