Skip to content

Commit

Permalink
chore: print human-readable errors in postbuild script (#1443)
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya authored Nov 21, 2023
1 parent 4f4b328 commit 69fb236
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .changeset/warm-kings-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
14 changes: 10 additions & 4 deletions scripts/postbuild.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { execSync } from 'child_process';
import { error } from 'console';
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { join } from 'path';

/**
* 1) Emit Declaration Maps
*/
if (existsSync(join(process.cwd(), 'tsconfig.dts.json'))) {
execSync('tsc --emitDeclarationOnly -p tsconfig.dts.json');
} else if (existsSync(join(process.cwd(), 'tsconfig.json'))) {
execSync('tsc --emitDeclarationOnly -p tsconfig.json');
try {
if (existsSync(join(process.cwd(), 'tsconfig.dts.json'))) {
execSync('tsc --emitDeclarationOnly -p tsconfig.dts.json');
} else if (existsSync(join(process.cwd(), 'tsconfig.json'))) {
execSync('tsc --emitDeclarationOnly -p tsconfig.json');
}
} catch (err) {
error(err.toString());
process.exit(1);
}

/**
Expand Down

0 comments on commit 69fb236

Please sign in to comment.