Skip to content

Commit

Permalink
feat: core v4
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Jun 4, 2024
1 parent 04a6d75 commit 8c100e7
Show file tree
Hide file tree
Showing 4 changed files with 2,596 additions and 3,130 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"extends": [
"oclif",
"oclif-typescript"
]
],
"rules": {
"perfectionist/sort-objects": "off"
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"/oclif.manifest.json"
],
"dependencies": {
"@oclif/core": "^3.26.6",
"@oclif/core": "^4",
"@oclif/plugin-help": "^6",
"@oclif/plugin-plugins": "^5"
},
Expand All @@ -27,11 +27,11 @@
"@types/mocha": "^10",
"@types/node": "^16.18.97",
"chai": "^4",
"eslint": "^7",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1.0.3",
"eslint": "^8.57.0",
"eslint-config-oclif": "^5.2.0",
"eslint-config-oclif-typescript": "^3.1.7",
"mocha": "^10",
"oclif": "^3.17.2",
"oclif": "^4",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
Expand Down
26 changes: 14 additions & 12 deletions src/commands/cjs1.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
import {Args, Command, Flags, Interfaces} from '@oclif/core'
import {
Args, Command, Flags, Interfaces,
} from '@oclif/core'

type Result = {
args: Interfaces.InferredArgs<typeof CJS1.args>
flags: Interfaces.InferredFlags<typeof CJS1.flags>
}

export default class CJS1 extends Command {
static flags = {
optionalString: Flags.string(),
defaultString: Flags.string({
default: 'simple string default',
}),
defaultFnString: Flags.string({
default: async () => Promise.resolve('async fn default'),
}),
}

static args = {
optionalArg: Args.string(),
defaultArg: Args.string({
default: 'simple string default',
}),
defaultFnArg: Args.string({
default: async () => Promise.resolve('async fn default'),
default: async () => 'async fn default',
}),
}

static enableJsonFlag = true

static flags = {
optionalString: Flags.string(),
defaultString: Flags.string({
default: 'simple string default',
}),
defaultFnString: Flags.string({
default: async () => 'async fn default',
}),
}

async run(): Promise<Result> {
const {args, flags} = await this.parse(CJS1)
this.log(`hello I am a CJS plugin from ${this.config.root}!`)
Expand Down
Loading

0 comments on commit 8c100e7

Please sign in to comment.