@altronix/cli 0.7.13 → 0.7.14
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 +5 -7
- package/dist/build.ui.d.ts +2 -2
- package/dist/build.ui.js +5 -10
- package/dist/index.js +34 -41
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -379,13 +379,11 @@ function extraBootConfs(board, extraConfs) {
|
|
|
379
379
|
function copy() {
|
|
380
380
|
return (obs$) => obs$.pipe(mergeMap((opts) => {
|
|
381
381
|
const { src, dst } = opts;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
.finally(() => subscriber.complete());
|
|
388
|
-
});
|
|
382
|
+
const promise = fs.promises
|
|
383
|
+
.copyFile(src, dst)
|
|
384
|
+
.then(() => opts)
|
|
385
|
+
.catch(() => ({ ...opts, err: dst }));
|
|
386
|
+
return from(promise);
|
|
389
387
|
}));
|
|
390
388
|
}
|
|
391
389
|
function concatFiles(src, dest) {
|
package/dist/build.ui.d.ts
CHANGED
|
@@ -18,10 +18,10 @@ export interface BuildProgress<K extends string = string> {
|
|
|
18
18
|
export interface Options {
|
|
19
19
|
items: BuildItem[];
|
|
20
20
|
progress$: Observable<BuildProgress>;
|
|
21
|
-
onComplete:
|
|
21
|
+
onComplete: BuildEffectCallback;
|
|
22
22
|
}
|
|
23
23
|
export default function ({ items, progress$, onComplete }: Options): React.JSX.Element;
|
|
24
|
-
interface
|
|
24
|
+
interface BuildEffectCallback<E extends Error = Error> {
|
|
25
25
|
(e?: E): void;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
package/dist/build.ui.js
CHANGED
|
@@ -21,8 +21,7 @@ export class BuildError extends Error {
|
|
|
21
21
|
export default function ({ items, progress$, onComplete }) {
|
|
22
22
|
const [col, _rows] = useStdoutDimensions();
|
|
23
23
|
const [width, setWidth] = useState(0);
|
|
24
|
-
const progress = useBuildEffect(progress$, items.map(({ item: i }) => i));
|
|
25
|
-
useCompleteEffect(progress$, onComplete);
|
|
24
|
+
const progress = useBuildEffect(progress$, items.map(({ item: i }) => i), onComplete);
|
|
26
25
|
useLayoutEffect(() => {
|
|
27
26
|
const width = items.map(({ item }) => item).reduce(calculateItemWidth, 0);
|
|
28
27
|
setWidth(width);
|
|
@@ -81,17 +80,13 @@ function progressReducer(acc, next) {
|
|
|
81
80
|
: progressInc(acc[next.item]);
|
|
82
81
|
return acc;
|
|
83
82
|
}
|
|
84
|
-
function
|
|
85
|
-
useLayoutEffect(() => {
|
|
86
|
-
const s = obs$.subscribe({ complete: cb, error: cb });
|
|
87
|
-
return s.unsubscribe();
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function useBuildEffect(obs$, items) {
|
|
83
|
+
function useBuildEffect(obs$, items, cb) {
|
|
91
84
|
const [progress, setProgress] = useState(initProgress(items));
|
|
92
85
|
useLayoutEffect(() => {
|
|
93
86
|
const s = obs$.pipe(scan(progressReducer, progress)).subscribe({
|
|
94
|
-
next: (progress) => setProgress({ ...progress })
|
|
87
|
+
next: (progress) => setProgress({ ...progress }),
|
|
88
|
+
complete: cb,
|
|
89
|
+
error: cb
|
|
95
90
|
});
|
|
96
91
|
return () => s.unsubscribe();
|
|
97
92
|
}, [obs$]);
|
package/dist/index.js
CHANGED
|
@@ -7,45 +7,38 @@ import { build } from './build.js';
|
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
// https://stackoverflow.com/questions/8817423/why-is-dirname-not-defined-in-node-repl
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
// Parse package.json to get version
|
|
11
|
+
const pkg = path.resolve(__dirname, '..', 'package.json');
|
|
12
|
+
const ver = JSON.parse(fs.readFileSync(pkg, 'ascii')).version;
|
|
13
|
+
// const cwd = path.resolve('./');
|
|
14
|
+
program
|
|
15
|
+
.name('atx')
|
|
16
|
+
.description('build atx zdk projects')
|
|
17
|
+
.version(ver)
|
|
18
|
+
.option('-VV, --verbose', 'extra logging');
|
|
19
|
+
// Scan command
|
|
20
|
+
/*
|
|
21
|
+
const ignore = 'node_modules;target;build;.git';
|
|
15
22
|
program
|
|
16
|
-
.
|
|
17
|
-
.description('
|
|
18
|
-
.
|
|
19
|
-
.option('-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.option('-A, --application', 'build applications')
|
|
39
|
-
.option('-B, --bootloader', 'build bootloaders')
|
|
40
|
-
.option('-W, --wasm', 'build wasm')
|
|
41
|
-
.option('-y, --yes', 'answer yes automatically')
|
|
42
|
-
.action(build);
|
|
43
|
-
// Load plugins
|
|
44
|
-
// (await plugins()).forEach(({ plugin: _, path: __, description: ___ }) => {});
|
|
45
|
-
try {
|
|
46
|
-
await program.parseAsync();
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
console.error(e);
|
|
50
|
-
}
|
|
51
|
-
})();
|
|
23
|
+
.command('scan')
|
|
24
|
+
.description('scan for *.cddl files')
|
|
25
|
+
.option('-p, --path <PATH>', 'root directory to start scan', cwd)
|
|
26
|
+
.option('-m, --matches <REGEX>', 'match expression', '.*cddl$')
|
|
27
|
+
.option('-i, --ignores <REGEX>', 'ignore directories', ignore)
|
|
28
|
+
.action(seedle.scan);
|
|
29
|
+
*/
|
|
30
|
+
// Build command
|
|
31
|
+
// TODO - detect if west is available and fail early
|
|
32
|
+
program
|
|
33
|
+
.command('build')
|
|
34
|
+
.description('build atx zdk application')
|
|
35
|
+
.option('-c, --config <CONFIG>', 'workspace config file')
|
|
36
|
+
.option('-C, --concurrent <NUMBER>', 'how many builds to run concurrently')
|
|
37
|
+
.option('-A, --application', 'build applications')
|
|
38
|
+
.option('-B, --bootloader', 'build bootloaders')
|
|
39
|
+
.option('-W, --wasm', 'build wasm')
|
|
40
|
+
.option('-y, --yes', 'answer yes automatically')
|
|
41
|
+
.action(build);
|
|
42
|
+
// Load plugins
|
|
43
|
+
// (await plugins()).forEach(({ plugin: _, path: __, description: ___ }) => {});
|
|
44
|
+
program.parseAsync().catch((e) => console.error(e));
|