diff --git a/bin/run b/bin/run new file mode 100755 index 00000000..f092e00c --- /dev/null +++ b/bin/run @@ -0,0 +1,13 @@ +#!/usr/bin/env node + +/* eslint-disable no-unpublished-require */ + +const undefault = m => m.__esModule === true ? m.default : m + +const fs = require('fs') +const path = require('path') +const dev = fs.existsSync(path.join(__dirname, '../tsconfig.json')) + +if (dev) require('ts-node/register') + +undefault(require('@dxcli/engine'))() diff --git a/package.json b/package.json index 55f014b4..32264327 100644 --- a/package.json +++ b/package.json @@ -36,10 +36,7 @@ "typescript": "^2.6.2" }, "dxcli": { - "commands": "./lib/commands", - "hooks": { - "init": "./lib/hooks/init" - } + "commands": "./lib/commands" }, "engines": { "node": ">=8.0.0" diff --git a/src/hooks/init.ts b/src/hooks/init.ts deleted file mode 100644 index c42b8aa4..00000000 --- a/src/hooks/init.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {Hooks, IHook} from '@dxcli/config' -import cli from 'cli-ux' - -const hook: IHook = async opts => { - cli.info(`example hook running ${opts.id}\nDisable by deleting ./src/hooks/init.ts`) -} - -export default hook diff --git a/test/hooks/init.test.ts b/test/hooks/init.test.ts deleted file mode 100644 index 0d49ac4c..00000000 --- a/test/hooks/init.test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import {expect, test} from '@dxcli/dev-test' - -describe('hooks', () => { - test - .stdout() - .hook('init', {id: 'mycommand'}) - .do(output => expect(output.stdout).to.contain('example hook running mycommand')) - .it('shows a message') -})