diff --git a/.gitignore b/.gitignore index 70654af..68b8718 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ cmd/*.js dist test/fixtures/example-declarations/typings/ !test/fixtures/example-declarations/node_modules +.package-lock.json diff --git a/package.json b/package.json index 8d3d338..216b008 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "jest-changed-files": "^29.4.2", "mocha": "^10.2.0", "mochawesome-with-mocha": "^7.1.3", - "runscript": "^1.5.3", + "runscript": "^2.0.0", "ts-node": "^10.9.2", "tsconfig-paths": "^4.1.2" }, diff --git a/scripts/postinstall.js b/scripts/postinstall.js index a653139..3ea1f3b 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -1,9 +1,9 @@ const debug = require('node:util').debuglog('egg-bin:postinstall'); const path = require('node:path'); const fs = require('node:fs'); -const runscript = require('runscript'); +const { runScript } = require('runscript'); -// node posintall.js +// node postintall.js const etsBinFile = process.argv[2] || require.resolve('egg-ts-helper/dist/bin'); const frameworkPackageName = process.argv[3] || 'egg'; @@ -41,6 +41,6 @@ if (npmRunRoot) { // https://github.com/eggjs/egg-ts-helper/pull/104 process.env.ETS_SCRIPT_FRAMEWORK = frameworkPackageName; console.log('[egg-bin:postinstall] run %s on %s', etsBinFile, npmRunRoot); - runscript(`node ${etsBinFile}`); + runScript(`node ${etsBinFile}`); } } diff --git a/src/middleware/global_options.ts b/src/middleware/global_options.ts index be71cea..fff9ded 100644 --- a/src/middleware/global_options.ts +++ b/src/middleware/global_options.ts @@ -5,7 +5,7 @@ import { Inject, ApplicationLifecycle, LifecycleHook, LifecycleHookUnit, Program, CommandContext, } from '@artus-cli/artus-cli'; -import runscript from 'runscript'; +import { runScript } from 'runscript'; import { addNodeOptionsToEnv, readPackageJSON, hasTsConfig } from '../utils'; const debug = debuglog('egg-bin:midddleware:global_options'); @@ -133,7 +133,7 @@ export default class GlobalOptions implements ApplicationLifecycle { if (ctx.args.declarations) { const etsBin = require.resolve('egg-ts-helper/dist/bin'); debug('run ets first: %o', etsBin); - await runscript(`node ${etsBin}`); + await runScript(`node ${etsBin}`); } if (ctx.args.pkgEgg.revert) { diff --git a/test/ts.test.ts b/test/ts.test.ts index a9db280..fc48f7b 100644 --- a/test/ts.test.ts +++ b/test/ts.test.ts @@ -2,7 +2,7 @@ import assert from 'node:assert'; import path from 'node:path'; import fs from 'node:fs/promises'; import _cpy from 'cpy'; -import runscript from 'runscript'; +import { runScript } from 'runscript'; import coffee from './coffee'; const version = Number(process.version.substring(1, 3)); @@ -228,10 +228,10 @@ describe('test/ts.test.ts', () => { // install custom ts-node await fs.rm(path.join(cwd, 'node_modules'), { force: true, recursive: true }); if (process.env.CI) { - // dont use npmmirror.com on CI - await runscript('npx npminstall', { cwd }); + // don't use npmmirror.com on CI + await runScript('npx npminstall', { cwd }); } else { - await runscript('npx npminstall -c', { cwd }); + await runScript('npx npminstall -c', { cwd }); } // copy egg to node_modules @@ -260,9 +260,9 @@ describe('test/ts.test.ts', () => { await fs.rm(path.join(cwd, 'node_modules'), { force: true, recursive: true }); if (process.env.CI) { // dont use npmmirror.com on CI - await runscript('npx npminstall ts-node@10.9.2 --no-save', { cwd }); + await runScript('npx npminstall ts-node@10.9.2 --no-save', { cwd }); } else { - await runscript('npx npminstall -c ts-node@10.9.2 --no-save', { cwd }); + await runScript('npx npminstall -c ts-node@10.9.2 --no-save', { cwd }); } // copy egg to node_modules @@ -291,10 +291,10 @@ describe('test/ts.test.ts', () => { // install custom ts-node await fs.rm(path.join(cwd, 'node_modules'), { force: true, recursive: true }); if (process.env.CI) { - // dont use npmmirror.com on CI - await runscript('npx npminstall ts-node@10.9.2 --no-save', { cwd }); + // don't use npmmirror.com on CI + await runScript('npx npminstall ts-node@10.9.2 --no-save', { cwd }); } else { - await runscript('npx npminstall -c ts-node@10.9.2 --no-save', { cwd }); + await runScript('npx npminstall -c ts-node@10.9.2 --no-save', { cwd }); } // copy egg to node_modules @@ -389,9 +389,9 @@ describe('test/ts.test.ts', () => { await fs.rm(path.join(cwd, 'node_modules'), { force: true, recursive: true }); if (process.env.CI) { // dont use npmmirror.com on CI - await runscript('npx npminstall', { cwd }); + await runScript('npx npminstall', { cwd }); } else { - await runscript('npx npminstall -c', { cwd }); + await runScript('npx npminstall -c', { cwd }); } // copy egg to node_modules