Skip to content

Commit

Permalink
feat: use oclif/core (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo authored Sep 24, 2021
1 parent 5136120 commit 33111f8
Show file tree
Hide file tree
Showing 7 changed files with 2,081 additions and 46 deletions.
18 changes: 18 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/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
// Waiting for https://github.com/oclif/core/pull/147
// 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" %*
5 changes: 3 additions & 2 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

require('@oclif/command').run()
.catch(require('@oclif/errors/handle'))
const oclif = require('@oclif/core')

oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"author": "Jeff Dickey @jdxcode",
"bugs": "https://github.com/oclif/plugin-warn-if-update-available/issues",
"dependencies": {
"@oclif/command": "^1.6.0",
"@oclif/config": "^1.12.8",
"@oclif/errors": "^1.2.2",
"@oclif/core": "^0.5.39",
"chalk": "^4.1.0",
"debug": "^4.1.0",
"fs-extra": "^9.0.1",
Expand All @@ -16,7 +14,6 @@
"semver": "^7.3.2"
},
"devDependencies": {
"@oclif/dev-cli": "^1.19.1",
"@oclif/test": "^1.2.4",
"@types/chai": "^4.1.6",
"@types/fs-extra": "^9.0.1",
Expand All @@ -30,6 +27,7 @@
"eslint-config-oclif-typescript": "^0.2.0",
"globby": "^11.0.1",
"mocha": "^8.0.1",
"oclif": "^2.0.0-main.5",
"ts-node": "^9.1.1",
"tslib": "^2.0.0",
"typescript": "4.4.3"
Expand Down Expand Up @@ -62,9 +60,9 @@
"pretest": "yarn build --noEmit && tsc -p test --noEmit",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"posttest": "yarn lint",
"prepublishOnly": "yarn run build && oclif-dev manifest && oclif-dev readme",
"prepublishOnly": "yarn run build && oclif manifest && oclif readme",
"postpublish": "yarn run clean",
"preversion": "yarn run clean",
"version": "oclif-dev readme && git add README.md"
"version": "oclif readme && git add README.md"
}
}
2 changes: 1 addition & 1 deletion src/get-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ async function run(name: string, file: string, version: string, registry: string
}

run(process.argv[2], process.argv[3], process.argv[4], process.argv[5], process.argv[6])
.catch(require('@oclif/errors/handle'))
.catch(require('@oclif/core/handle'))
2 changes: 1 addition & 1 deletion src/hooks/init/check-update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Hook} from '@oclif/config'
import {Hook} from '@oclif/core'
import * as Chalk from 'chalk'
import {spawn} from 'child_process'
import * as fs from 'fs-extra'
Expand Down
Loading

0 comments on commit 33111f8

Please sign in to comment.