mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-19 00:03:33 +00:00
fix(build): replace execSync with execFileSync for TypeScript compilation
This commit is contained in:
parent
fff89fb272
commit
9ee1d978d9
2 changed files with 16 additions and 4 deletions
|
|
@ -9,4 +9,4 @@
|
|||
<div id="root"></div>
|
||||
<script type="module" src="./src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* 3. Copy gitnexus-shared/dist → dist/_shared
|
||||
* 4. Rewrite bare 'gitnexus-shared' specifiers → relative paths
|
||||
*/
|
||||
import { execSync } from 'node:child_process';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
|
@ -19,13 +19,25 @@ const SHARED_ROOT = path.resolve(ROOT, '..', 'gitnexus-shared');
|
|||
const DIST = path.join(ROOT, 'dist');
|
||||
const SHARED_DEST = path.join(DIST, '_shared');
|
||||
|
||||
function compileTypeScriptProject(projectRoot) {
|
||||
const tscCliPath = path.join(projectRoot, 'node_modules', 'typescript', 'bin', 'tsc');
|
||||
|
||||
if (!fs.existsSync(tscCliPath)) {
|
||||
throw new Error(
|
||||
`[build] Missing TypeScript CLI at ${tscCliPath}. Run npm install in ${projectRoot}.`,
|
||||
);
|
||||
}
|
||||
|
||||
execFileSync(process.execPath, [tscCliPath], { cwd: projectRoot, stdio: 'inherit' });
|
||||
}
|
||||
|
||||
// ── 1. Build gitnexus-shared ───────────────────────────────────────
|
||||
console.log('[build] compiling gitnexus-shared…');
|
||||
execSync('npx tsc', { cwd: SHARED_ROOT, stdio: 'inherit' });
|
||||
compileTypeScriptProject(SHARED_ROOT);
|
||||
|
||||
// ── 2. Build gitnexus ──────────────────────────────────────────────
|
||||
console.log('[build] compiling gitnexus…');
|
||||
execSync('npx tsc', { cwd: ROOT, stdio: 'inherit' });
|
||||
compileTypeScriptProject(ROOT);
|
||||
|
||||
// ── 3. Copy shared dist ────────────────────────────────────────────
|
||||
console.log('[build] copying shared module into dist/_shared…');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue