tcbuilder 2.12.0 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/tcbuild.js +31 -15
  2. package/package.json +4 -3
package/dist/tcbuild.js CHANGED
@@ -22,6 +22,9 @@ import path from 'node:path';
22
22
  import url from 'node:url';
23
23
  import { execSync } from 'node:child_process';
24
24
  import * as glob from 'glob';
25
+ import * as commander from 'commander';
26
+ // @ts-ignore
27
+ global.commander = commander;
25
28
  const contextStack = [];
26
29
  async function _build(name = '', cb) {
27
30
  let prevStack = contextStack.join('/');
@@ -495,6 +498,7 @@ function findExecutable(map, exts, depth = -1) {
495
498
  }
496
499
  process.once('beforeExit', async () => {
497
500
  for (const [name, group] of Object.entries(groups)) {
501
+ let failure = false;
498
502
  const compileCommandsFiles = [];
499
503
  const groupBuildDir = group.buildDir ?? globalBuildDir;
500
504
  if (!groupBuildDir)
@@ -543,26 +547,36 @@ process.once('beforeExit', async () => {
543
547
  continue;
544
548
  }
545
549
  console.log(cmd);
546
- execSync(cmd, { stdio: 'inherit' });
550
+ try {
551
+ execSync(cmd, { stdio: 'inherit' });
552
+ }
553
+ catch (err) {
554
+ console.error(`Exit code: ${err.status}`);
555
+ failure = true;
556
+ }
547
557
  }
548
558
  if (fs.existsSync(obj + '_compile_commands.json'))
549
559
  compileCommandsFiles.push(obj + '_compile_commands.json');
560
+ if (failure)
561
+ break;
550
562
  }
551
563
  }
552
- const finalOutName = `${groupBuildDir}/${name}${group.finalExeSuffix ? `.${group.finalExeSuffix}` : ``}`;
553
- if (group.finalExe.length > 0 && linkNeedsRebuild(finalOutName, objects)) {
554
- let finalFlags = group.finalFlags
555
- .sort((a, b) => a.sort - b.sort)
556
- .map(x => x.flag)
557
- .join(' ');
558
- /*if (group.finalFlagsToBeRemoved.length > 0)
559
- for (const remove of group.finalFlagsToBeRemoved)
560
- finalFlags = finalFlags.replaceAll(remove, '')*/
561
- const cmd = `${group.finalExe} ${(group.finalFlagsGenCb ? group.finalFlagsGenCb(group, objects, finalFlags) : finalFlags).replaceAll('{out}', finalOutName).replaceAll('{in}', objects.map(x => group.finalInputPattern.replaceAll('{in}', x)).join(' '))}`;
562
- console.log(cmd);
563
- execSync(cmd, {
564
- stdio: 'inherit'
565
- });
564
+ if (!failure) {
565
+ const finalOutName = `${groupBuildDir}/${name}${group.finalExeSuffix ? `.${group.finalExeSuffix}` : ``}`;
566
+ if (group.finalExe.length > 0 && linkNeedsRebuild(finalOutName, objects)) {
567
+ let finalFlags = group.finalFlags
568
+ .sort((a, b) => a.sort - b.sort)
569
+ .map(x => x.flag)
570
+ .join(' ');
571
+ /*if (group.finalFlagsToBeRemoved.length > 0)
572
+ for (const remove of group.finalFlagsToBeRemoved)
573
+ finalFlags = finalFlags.replaceAll(remove, '')*/
574
+ const cmd = `${group.finalExe} ${(group.finalFlagsGenCb ? group.finalFlagsGenCb(group, objects, finalFlags) : finalFlags).replaceAll('{out}', finalOutName).replaceAll('{in}', objects.map(x => group.finalInputPattern.replaceAll('{in}', x)).join(' '))}`;
575
+ console.log(cmd);
576
+ execSync(cmd, {
577
+ stdio: 'inherit'
578
+ });
579
+ }
566
580
  }
567
581
  if (compileCommandsFiles.length > 0) {
568
582
  let compileCommands = '[';
@@ -571,6 +585,8 @@ process.once('beforeExit', async () => {
571
585
  compileCommands += ']';
572
586
  fs.writeFileSync(path.join(process.cwd(), groupBuildDir, 'compile_commands.json'), compileCommands);
573
587
  }
588
+ if (failure)
589
+ process.exit();
574
590
  }
575
591
  // @ts-ignore
576
592
  if (global['post_compile'])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tcbuilder",
3
- "version": "2.12.0",
3
+ "version": "2.12.2",
4
4
  "description": "Build System",
5
5
  "homepage": "https://github.com/umutfahriozkan/tcbuild#readme",
6
6
  "bugs": {
@@ -34,15 +34,16 @@
34
34
  "devDependencies": {
35
35
  "@types/node": "^26.6.6",
36
36
  "@types/react": "^19.3.0",
37
- "typescript": "^7.0.2",
38
37
  "ink": "^8.0.0",
39
38
  "react": "^19.3.1",
40
- "react-jsx": "^1.0.0"
39
+ "react-jsx": "^1.0.0",
40
+ "typescript": "^7.0.2"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=22"
44
44
  },
45
45
  "dependencies": {
46
+ "commander": "^15.1.0",
46
47
  "glob": "^14.0.4"
47
48
  }
48
49
  }