From fbbb29f46df61110954d14190358802890a2701f Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Sat, 9 Oct 2021 15:15:50 -0700 Subject: [PATCH] fix(bin): allow global usage --- src/bin.ts | 3 ++- test/config/index.ts | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bin.ts b/src/bin.ts index df252d8..a30777d 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -27,6 +27,7 @@ if (argv.includes('-v') || argv.includes('--version')) { process.exit(0); } -require('child_process').spawn('node', ['--loader', 'tsm', ...argv], { +let file = require('path').join(__dirname, 'loader.mjs'); +require('child_process').spawn('node', ['--loader', file, ...argv], { stdio: 'inherit' }).on('exit', process.exit); diff --git a/test/config/index.ts b/test/config/index.ts index 25696b7..0e058d7 100644 --- a/test/config/index.ts +++ b/test/config/index.ts @@ -35,9 +35,7 @@ assert.equal(cjs.dashify('FooBar'), 'foo-bar', 'CJS :: value :: dashify'); // Checking ".js" with ESM content (type: module) assert.equal(typeof esm, 'object', 'ESM.js :: typeof'); -// @ts-ignore assert.equal(typeof esm.hello, 'function', 'ESM.js :: typeof :: hello'); -// @ts-ignore assert.equal(esm.hello('you'), 'hello, you', 'ESM.js :: value :: hello'); console.log('DONE~!');