Skip to content

Commit

Permalink
fix: EINVALID napi
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Dec 29, 2024
1 parent 8379f2b commit 8bbca48
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/typst.node/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@ const napiArgs = [
'--platform',
'--release',
'--dts-header',
"/* auto-generated by NAPI-RS */ /* eslint-disable */ import type * as types from './index.js';",
"\"/* auto-generated by NAPI-RS */ /* eslint-disable */ import type * as types from './index.js';\"",
'--dts',
'index-napi.d.ts',
'--js',
'index-napi.js',
'--pipe',
'prettier -w',
'\"prettier -w\"',
...args,
];

const YARN = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';

const napi = spawnSync(YARN, napiArgs, { stdio: 'inherit' });
// https://github.com/nodejs/node/issues/52554
const opts = { stdio: 'inherit', shell: true };

const napi = spawnSync(YARN, napiArgs, opts);
if (napi.error || napi.status !== 0) {
console.log('napi', napi.status, napi.error);
process.exit(napi.status);
}

const tsc = spawnSync(YARN, ['tsc'], { stdio: 'inherit' });
const tsc = spawnSync(YARN, ['tsc'], opts);
if (tsc.error || tsc.status !== 0) {
console.log('tsc', tsc.status, tsc.error);
process.exit(tsc.status);
Expand Down

0 comments on commit 8bbca48

Please sign in to comment.