Skip to content

Commit 8016c1c

Browse files
authored
feat: upgrade oclif deps (#75)
* feat: upgrade oclif deps * fix: lint
1 parent b9dcece commit 8016c1c

16 files changed

+2008
-775
lines changed

package-lock.json

+1,953-720
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"bugs": "https://github.com/hackmdio/hackmd-cli/issues",
99
"dependencies": {
1010
"@hackmd/api": "^2.0.0",
11-
"@oclif/core": "^1.3.6",
12-
"@oclif/plugin-help": "^2.2.3",
13-
"@oclif/plugin-version": "^1.0.4",
11+
"@oclif/core": "2.8.2",
12+
"@oclif/plugin-help": "5.2.9",
13+
"@oclif/plugin-version": "1.3.3",
1414
"cli-ux": "^5.4.4",
1515
"fs-extra": "^8.1.0",
1616
"lodash.defaults": "^4.2.0",
17-
"oclif": "^2.5.0",
17+
"oclif": "3.8.1",
1818
"tslib": "^1.10.0"
1919
},
2020
"devDependencies": {

src/command.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import API from '@hackmd/api'
2-
import {CliUx, Command} from '@oclif/core'
2+
import {Command, ux} from '@oclif/core'
33

44
import config from './config'
55
import {setAccessTokenConfig} from './utils'
66

77
export default abstract class HackMDCommand extends Command {
88
async getAPIClient() {
9-
const token = config.accessToken || await CliUx.ux.prompt('Enter your access token', {
9+
const token = config.accessToken || await ux.prompt('Enter your access token', {
1010
type: 'hide'
1111
})
1212
const APIClient = new API(token, config.hackmdAPIEndpointURL)

src/commands/export.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class Export extends HackMDCommand {
1414

1515
static flags = {
1616
help: Flags.help({char: 'h'}),
17-
noteId: noteId()
17+
noteId
1818
}
1919

2020
async run() {

src/commands/history.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {CliUx, Flags} from '@oclif/core'
1+
import {Flags, ux} from '@oclif/core'
22

33
import HackMDCommand from '../command'
44

@@ -15,7 +15,7 @@ BnC6gN0_TfStV2KKmPPXeg Welcome to your team's workspace null C
1515

1616
static flags = {
1717
help: Flags.help({char: 'h'}),
18-
...CliUx.ux.table.flags(),
18+
...ux.table.flags(),
1919
}
2020

2121
async run() {
@@ -25,7 +25,7 @@ BnC6gN0_TfStV2KKmPPXeg Welcome to your team's workspace null C
2525
const APIClient = await this.getAPIClient()
2626
const history = await APIClient.getHistory()
2727

28-
CliUx.ux.table(history, {
28+
ux.table(history, {
2929
id: {
3030
header: 'ID',
3131
},

src/commands/notes/create.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
CreateNoteOptions,
44
NotePermissionRole,
55
} from '@hackmd/api/dist/type'
6-
import {CliUx, Flags} from '@oclif/core'
6+
import {Flags, ux} from '@oclif/core'
77
import * as fs from 'fs'
88

99
import HackMDCommand from '../../command'
@@ -33,13 +33,13 @@ raUuSTetT5uQbqQfLnz9lA A new note gvfz2UB5THiKABQJQnLs6Q
3333

3434
static flags = {
3535
help: Flags.help({char: 'h'}),
36-
title: noteTitle(),
37-
content: noteContent(),
38-
readPermission: notePermission(),
39-
writePermission: notePermission(),
40-
commentPermission: commentPermission(),
36+
title: noteTitle,
37+
content: noteContent,
38+
readPermission: notePermission,
39+
writePermission: notePermission,
40+
commentPermission,
4141
editor,
42-
...CliUx.ux.table.flags(),
42+
...ux.table.flags(),
4343
}
4444

4545
async run() {
@@ -69,7 +69,7 @@ raUuSTetT5uQbqQfLnz9lA A new note gvfz2UB5THiKABQJQnLs6Q
6969
const APIClient = await this.getAPIClient()
7070
const note = await APIClient.createNote(options)
7171

72-
CliUx.ux.table(
72+
ux.table(
7373
[note],
7474
{
7575
id: {

src/commands/notes/delete.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class Delete extends HackMDCommand {
1212

1313
static flags = {
1414
help: Flags.help({char: 'h'}),
15-
noteId: noteId(),
15+
noteId,
1616
}
1717

1818
async run() {

src/commands/notes/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {CliUx, Flags} from '@oclif/core'
1+
import {Flags, ux} from '@oclif/core'
22

33
import HackMDCommand from '../../command'
44
import {noteId} from '../../flags'
@@ -15,8 +15,8 @@ raUuSTetT5uQbqQfLnz9lA CLI test note gvfz2UB5THiKABQJQnLs6Q n
1515

1616
static flags = {
1717
help: Flags.help({char: 'h'}),
18-
noteId: noteId(),
19-
...CliUx.ux.table.flags(),
18+
noteId,
19+
...ux.table.flags(),
2020
}
2121

2222
async run() {
@@ -26,7 +26,7 @@ raUuSTetT5uQbqQfLnz9lA CLI test note gvfz2UB5THiKABQJQnLs6Q n
2626
const APIClient = await this.getAPIClient()
2727
const notes = flags.noteId ? [await APIClient.getNote(flags.noteId)] : await APIClient.getNoteList()
2828

29-
CliUx.ux.table(notes, {
29+
ux.table(notes, {
3030
id: {
3131
header: 'ID',
3232
},

src/commands/notes/update.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export default class Update extends HackMDCommand {
1212

1313
static flags = {
1414
help: Flags.help({char: 'h'}),
15-
noteId: noteId(),
16-
content: noteContent()
15+
noteId,
16+
content: noteContent
1717
}
1818

1919
async run() {

src/commands/team-notes/create.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {CommentPermissionType, CreateNoteOptions, NotePermissionRole} from '@hackmd/api/dist/type'
2-
import {CliUx, Flags} from '@oclif/core'
2+
import {Flags, ux} from '@oclif/core'
33
import fs from 'fs'
44

55
import HackMDCommand from '../../command'
@@ -22,14 +22,14 @@ raUuSTetT5uQbqQfLnz9lA A new note gvfz2UB5THiKABQJQnLs6Q n
2222

2323
static flags = {
2424
help: Flags.help({char: 'h'}),
25-
teamPath: teamPath(),
26-
title: noteTitle(),
27-
content: noteContent(),
28-
readPermission: notePermission(),
29-
writePermission: notePermission(),
30-
commentPermission: commentPermission(),
25+
teamPath,
26+
title: noteTitle,
27+
content: noteContent,
28+
readPermission: notePermission,
29+
writePermission: notePermission,
30+
commentPermission,
3131
editor,
32-
...CliUx.ux.table.flags(),
32+
...ux.table.flags(),
3333
}
3434

3535
async run() {
@@ -64,7 +64,7 @@ raUuSTetT5uQbqQfLnz9lA A new note gvfz2UB5THiKABQJQnLs6Q n
6464
const APIClient = await this.getAPIClient()
6565
const note = await APIClient.createTeamNote(teamPath, options)
6666

67-
CliUx.ux.table([note], {
67+
ux.table([note], {
6868
id: {
6969
header: 'ID',
7070
},

src/commands/team-notes/delete.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export default class Delete extends HackMDCommand {
1212

1313
static flags = {
1414
help: Flags.help({char: 'h'}),
15-
teamPath: teamPath(),
16-
noteId: noteId(),
15+
teamPath,
16+
noteId,
1717
}
1818

1919
async run() {

src/commands/team-notes/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {CliUx, Flags} from '@oclif/core'
1+
import {Flags, ux} from '@oclif/core'
22

33
import HackMDCommand from '../../command'
44
import {teamPath} from '../../flags'
@@ -16,8 +16,8 @@ BnC6gN0_TfStV2KKmPPXeg Welcome to your team's workspace null CLI-test`,
1616

1717
static flags = {
1818
help: Flags.help({char: 'h'}),
19-
teamPath: teamPath(),
20-
...CliUx.ux.table.flags(),
19+
teamPath,
20+
...ux.table.flags(),
2121
}
2222

2323
async run() {
@@ -31,7 +31,7 @@ BnC6gN0_TfStV2KKmPPXeg Welcome to your team's workspace null CLI-test`,
3131
const APIClient = await this.getAPIClient()
3232
const notes = await APIClient.getTeamNotes(flags.teamPath)
3333

34-
CliUx.ux.table(notes, {
34+
ux.table(notes, {
3535
id: {
3636
header: 'ID',
3737
},

src/commands/team-notes/update.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export default class Update extends HackMDCommand {
1212

1313
static flags = {
1414
help: Flags.help({char: 'h'}),
15-
teamPath: teamPath(),
16-
noteId: noteId(),
17-
content: noteContent()
15+
teamPath,
16+
noteId,
17+
content: noteContent,
1818
}
1919

2020
async run() {

src/commands/teams.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {CliUx, Flags} from '@oclif/core'
1+
import {Flags, ux} from '@oclif/core'
22

33
import HackMDCommand from '../command'
44

@@ -14,7 +14,7 @@ f76308a6-d77a-41f6-86d0-8ada426a6fb4 CLI test team CLI-test 82f7f3d9-4079-4c78-8
1414

1515
static flags = {
1616
help: Flags.help({char: 'h'}),
17-
...CliUx.ux.table.flags(),
17+
...ux.table.flags(),
1818
}
1919

2020
async run() {
@@ -24,7 +24,7 @@ f76308a6-d77a-41f6-86d0-8ada426a6fb4 CLI test team CLI-test 82f7f3d9-4079-4c78-8
2424
const APIClient = await this.getAPIClient()
2525
const notes = await APIClient.getTeams()
2626

27-
CliUx.ux.table(notes, {
27+
ux.table(notes, {
2828
id: {
2929
header: 'ID',
3030
},

src/commands/whoami.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {CliUx, Flags} from '@oclif/core'
1+
import {Flags, ux} from '@oclif/core'
22

33
import HackMDCommand from '../command'
44

@@ -14,7 +14,7 @@ ID Name Email User path
1414

1515
static flags = {
1616
help: Flags.help({char: 'h'}),
17-
...CliUx.ux.table.flags(),
17+
...ux.table.flags(),
1818
}
1919

2020
async run() {
@@ -24,7 +24,7 @@ ID Name Email User path
2424
const APIClient = await this.getAPIClient()
2525
const user = await APIClient.getMe()
2626

27-
CliUx.ux.table([user], {
27+
ux.table([user], {
2828
id: {
2929
header: 'ID',
3030
},

src/flags.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import {Flags} from '@oclif/core'
2-
export const noteId = Flags.build({
2+
export const noteId = Flags.string({
33
description: 'HackMD note id'
44
})
55

6-
export const teamPath = Flags.build({
6+
export const teamPath = Flags.string({
77
description: 'HackMD team path'
88
})
99

10-
export const noteContent = Flags.build({
10+
export const noteContent = Flags.string({
1111
description: 'new note content'
1212
})
1313

14-
export const noteTitle = Flags.build({
14+
export const noteTitle = Flags.string({
1515
description: 'new note title'
1616
})
1717

18-
export const notePermission = Flags.build({
18+
export const notePermission = Flags.string({
1919
description: 'set note permission: owner, signed_in, guest'
2020
})
2121

22-
export const commentPermission = Flags.build({
22+
export const commentPermission = Flags.string({
2323
description: 'set comment permission: disabled, forbidden, owners, signed_in_users, everyone'
2424
})
2525

0 commit comments

Comments
 (0)