build-node: TypeScript's own script runs under Bun (node_modules/.bin/tsc is a .exe / .cmd shim on Windows: the Windows acceptance cell packed nothing on dc387f6)
This commit is contained in:
parent
dc387f6ffb
commit
1c35a625e1
1 changed files with 4 additions and 2 deletions
|
|
@ -41,8 +41,10 @@ export function buildNode(out = NODE_BUNDLE): { path: string; bytes: number } {
|
|||
export function buildEntry(dir = join(ROOT, 'dist')): void {
|
||||
const types = join(dir, 'types');
|
||||
rmSync(types, { recursive: true, force: true });
|
||||
if (!statSync(join(ROOT, 'node_modules', '.bin', 'tsc'), { throwIfNoEntry: false })) throw new Error('no TypeScript in node_modules: run `bun install` first (npm pack builds the declarations with it)');
|
||||
const tsc = Bun.spawnSync([join(ROOT, 'node_modules', '.bin', 'tsc'), '-p', 'tsconfig.types.json', '--outDir', types], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' });
|
||||
// TypeScript's own script, run by Bun: node_modules/.bin/tsc is a .exe / .cmd shim on Windows
|
||||
const tscJs = join(ROOT, 'node_modules', 'typescript', 'bin', 'tsc');
|
||||
if (!statSync(tscJs, { throwIfNoEntry: false })) throw new Error('no TypeScript in node_modules: run `bun install` first (npm pack builds the declarations with it)');
|
||||
const tsc = Bun.spawnSync([process.execPath, tscJs, '-p', 'tsconfig.types.json', '--outDir', types], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' });
|
||||
if (tsc.exitCode !== 0) throw new Error(`tsc (declarations) failed\n${tsc.stdout.toString()}${tsc.stderr.toString()}`);
|
||||
if (!statSync(join(types, 'lib', 'config.d.ts'), { throwIfNoEntry: false })) throw new Error('no dist/types/lib/config.d.ts');
|
||||
pruneDeclarations(types, 'lib/config.d.ts');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue