@altronix/cli 0.8.0 → 0.8.1

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.
package/dist/build.js CHANGED
@@ -444,7 +444,9 @@ function tovoid() {
444
444
  export async function build() {
445
445
  const config = this.opts()['config'] || path.resolve('./', 'atx.json');
446
446
  const verbose = this.optsWithGlobals()['verbose'];
447
- const matches = new RegExp(this.opts()['matches'] || '(.*)');
447
+ const mBoard = new RegExp(this.opts()['matchesBoard'] || '(.*)');
448
+ const mApplication = new RegExp(this.opts()['matchesApplication'] || '(.*)');
449
+ const mConfig = new RegExp(this.opts()['matchesConfig'] || '(.*)');
448
450
  const cwd = path.resolve(path.dirname(config));
449
451
  const data = await fs.promises.readFile(config, 'ascii');
450
452
  const atx = JSON.parse(data);
@@ -454,16 +456,22 @@ export async function build() {
454
456
  throw validate.errors;
455
457
  const env = path.resolve(cwd, '.env');
456
458
  dotenv.config({ path: env });
457
- const apps = keys(atx.applications).flatMap((app) => {
459
+ const apps = keys(atx.applications)
460
+ .filter(({ __key }) => __key.match(mApplication))
461
+ .flatMap((app) => {
458
462
  return keys(app.boards)
459
- .filter(({ __key }) => __key.match(matches))
463
+ .filter(({ __key }) => __key.match(mBoard))
460
464
  .flatMap((board) => {
461
- return keys(board).map((config) => westOptionsNormalize(board.__key, config, app, cwd, verbose));
465
+ return keys(board)
466
+ .filter(({ __key }) => __key.match(mConfig))
467
+ .map((config) => {
468
+ return westOptionsNormalize(board.__key, config, app, cwd, verbose);
469
+ });
462
470
  });
463
471
  });
464
472
  const bootloaders = keys(atx.bootloaders).flatMap((app) => {
465
473
  return keys(app.boards)
466
- .filter(({ __key }) => __key.match(matches))
474
+ .filter(({ __key }) => __key.match(mBoard))
467
475
  .flatMap((board) => {
468
476
  return keys(board).map((config) => westOptionsNormalize(board.__key, config, app, cwd, verbose));
469
477
  });
@@ -500,13 +508,17 @@ export async function build() {
500
508
  dst: path.join(d, `${board}-${name}-${config}.bin`)
501
509
  };
502
510
  }))).pipe(copy(), tovoid());
503
- await lastValueFrom(ready$);
504
- const items = await lastValueFrom(items$);
505
- const renderer = render(React.createElement(Ui, { items: items, "progress$": build$, onComplete: () => renderer.unmount() }));
506
- await renderer.waitUntilExit();
507
- renderer.cleanup();
508
- return lastValueFrom(install$).catch((e) => {
511
+ try {
512
+ await lastValueFrom(ready$);
513
+ const items = await lastValueFrom(items$);
514
+ const renderer = render(React.createElement(Ui, { items: items, "progress$": build$, onComplete: () => renderer.unmount() }));
515
+ await renderer.waitUntilExit();
516
+ renderer.cleanup();
517
+ return lastValueFrom(install$);
518
+ }
519
+ catch (e) {
509
520
  if (!(e instanceof EmptyError))
510
521
  throw e;
511
- });
522
+ console.log('nothing to build');
523
+ }
512
524
  }
package/dist/index.js CHANGED
@@ -46,7 +46,9 @@ program
46
46
  .option('-A, --application', 'build applications')
47
47
  .option('-B, --bootloader', 'build bootloaders')
48
48
  .option('-W, --wasm', 'build wasm')
49
- .option('-M, --matches [regex]', 'board regex match expr')
49
+ .option('--matches-board [regex]', 'board regex match expr')
50
+ .option('--matches-application [regex]', 'application regex match expr')
51
+ .option('--matches-config [regex]', 'config regex match expr')
50
52
  .option('-y, --yes', 'answer yes automatically')
51
53
  .action(build);
52
54
  const device = program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altronix/cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {