@haibun/cli 1.25.1 → 1.26.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/package.json +4 -4
- package/build/BaseOptions.d.ts +0 -145
- package/build/BaseOptions.js +0 -122
- package/build/BaseOptions.js.map +0 -1
- package/build/BaseOptions.test.d.ts +0 -1
- package/build/BaseOptions.test.js +0 -31
- package/build/BaseOptions.test.js.map +0 -1
- package/build/cli.d.ts +0 -2
- package/build/cli.js +0 -86
- package/build/cli.js.map +0 -1
- package/build/lib.d.ts +0 -17
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haibun/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.26.1",
|
|
5
5
|
"description": "command line execution for @haibun",
|
|
6
6
|
"bin": {
|
|
7
7
|
"haibun-cli": "build/cli.js"
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@haibun/core": "1.
|
|
25
|
-
"@haibun/domain-storage": "1.
|
|
24
|
+
"@haibun/core": "1.26.1",
|
|
25
|
+
"@haibun/domain-storage": "1.26.1",
|
|
26
26
|
"source-map-support": "^0.5.21"
|
|
27
27
|
},
|
|
28
28
|
"gitHead": "7cf9680bd922fb622fb59f1e6bf5b65284cb8fd5"
|
|
29
|
-
}
|
|
29
|
+
}
|
package/build/BaseOptions.d.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { IHasOptions, TOptions } from "@haibun/core/build/lib/defs.js";
|
|
2
|
-
export declare class BaseOptions implements IHasOptions {
|
|
3
|
-
static options: {
|
|
4
|
-
SPLIT_SHARED: {
|
|
5
|
-
desc: string;
|
|
6
|
-
parse: (input: string) => {
|
|
7
|
-
error: string;
|
|
8
|
-
result?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
result: {
|
|
11
|
-
[x: string]: string;
|
|
12
|
-
}[];
|
|
13
|
-
error?: undefined;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
TRACE: {
|
|
17
|
-
desc: string;
|
|
18
|
-
parse: (input: string) => {
|
|
19
|
-
error: string;
|
|
20
|
-
result?: undefined;
|
|
21
|
-
} | {
|
|
22
|
-
result: boolean;
|
|
23
|
-
error?: undefined;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
TITLE: {
|
|
27
|
-
desc: string;
|
|
28
|
-
parse: (result: string) => {
|
|
29
|
-
result: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
CLI: {
|
|
33
|
-
desc: string;
|
|
34
|
-
parse: (input: string) => {
|
|
35
|
-
error: string;
|
|
36
|
-
result?: undefined;
|
|
37
|
-
} | {
|
|
38
|
-
result: boolean;
|
|
39
|
-
error?: undefined;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
SETTING: {
|
|
43
|
-
desc: string;
|
|
44
|
-
parse: (result: string) => {
|
|
45
|
-
result: string;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
DEST: {
|
|
49
|
-
desc: string;
|
|
50
|
-
parse: (result: string) => {
|
|
51
|
-
result: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
STAY: {
|
|
55
|
-
desc: string;
|
|
56
|
-
parse: (result: string) => {
|
|
57
|
-
result: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
LOG_FOLLOW: {
|
|
61
|
-
desc: string;
|
|
62
|
-
parse: (result: string) => {
|
|
63
|
-
result: string;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
LOG_LEVEL: {
|
|
67
|
-
desc: string;
|
|
68
|
-
parse: (result: string) => {
|
|
69
|
-
result: string;
|
|
70
|
-
error?: undefined;
|
|
71
|
-
} | {
|
|
72
|
-
error: string;
|
|
73
|
-
result?: undefined;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
ENV: {
|
|
77
|
-
desc: string;
|
|
78
|
-
parse: (input: string, cur: TOptions) => {
|
|
79
|
-
error: string;
|
|
80
|
-
env?: undefined;
|
|
81
|
-
} | {
|
|
82
|
-
env: {
|
|
83
|
-
[name: string]: string;
|
|
84
|
-
};
|
|
85
|
-
error?: undefined;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
ENVC: {
|
|
89
|
-
desc: string;
|
|
90
|
-
parse: (input: string, cur: TOptions) => {
|
|
91
|
-
error: string;
|
|
92
|
-
env?: undefined;
|
|
93
|
-
} | {
|
|
94
|
-
env: TOptions;
|
|
95
|
-
error?: undefined;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
STEP_DELAY: {
|
|
99
|
-
desc: string;
|
|
100
|
-
parse: (input: string) => {
|
|
101
|
-
error: string;
|
|
102
|
-
result?: undefined;
|
|
103
|
-
} | {
|
|
104
|
-
result: number;
|
|
105
|
-
error?: undefined;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
LOOPS: {
|
|
109
|
-
desc: string;
|
|
110
|
-
parse: (input: string) => {
|
|
111
|
-
error: string;
|
|
112
|
-
result?: undefined;
|
|
113
|
-
} | {
|
|
114
|
-
result: number;
|
|
115
|
-
error?: undefined;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
MEMBERS: {
|
|
119
|
-
desc: string;
|
|
120
|
-
parse: (input: string) => {
|
|
121
|
-
error: string;
|
|
122
|
-
result?: undefined;
|
|
123
|
-
} | {
|
|
124
|
-
result: number;
|
|
125
|
-
error?: undefined;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
OUTPUT: {
|
|
129
|
-
desc: string;
|
|
130
|
-
parse: (result: string) => {
|
|
131
|
-
result: string;
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
OUTPUT_DEST: {
|
|
135
|
-
desc: string;
|
|
136
|
-
parse: (result: string) => {
|
|
137
|
-
result: string;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
PWDEBUG: {
|
|
141
|
-
desc: string;
|
|
142
|
-
parse: (input: string) => string;
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
}
|
package/build/BaseOptions.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_DEST } from "@haibun/core/build/lib/defs.js";
|
|
2
|
-
import { LOGGER_LEVELS } from "@haibun/core/build/lib/Logger.js";
|
|
3
|
-
import { boolOrError, intOrError } from "@haibun/core/build/lib/util/index.js";
|
|
4
|
-
export class BaseOptions {
|
|
5
|
-
static options = {
|
|
6
|
-
SPLIT_SHARED: {
|
|
7
|
-
desc: 'create instances based on variable options, for example, var=option1,option2',
|
|
8
|
-
parse: (input) => {
|
|
9
|
-
const [what, s] = input.split('=');
|
|
10
|
-
if (!what || !s) {
|
|
11
|
-
return { error: `var=option1,option2` };
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return { result: s.split(',').map((w) => ({ [what]: w })) };
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
TRACE: {
|
|
19
|
-
desc: 'save tracks data',
|
|
20
|
-
parse: (input) => boolOrError(input)
|
|
21
|
-
},
|
|
22
|
-
TITLE: {
|
|
23
|
-
desc: 'title for reports',
|
|
24
|
-
parse: (result) => ({ result })
|
|
25
|
-
},
|
|
26
|
-
CLI: {
|
|
27
|
-
desc: 'create a command interface for each member',
|
|
28
|
-
parse: (input) => boolOrError(input)
|
|
29
|
-
},
|
|
30
|
-
SETTING: {
|
|
31
|
-
desc: 'execution setting (eg dev, prod)',
|
|
32
|
-
parse: (result) => ({ result })
|
|
33
|
-
},
|
|
34
|
-
DEST: {
|
|
35
|
-
desc: 'destination for captures',
|
|
36
|
-
parse: (result) => ({ result })
|
|
37
|
-
},
|
|
38
|
-
STAY: {
|
|
39
|
-
desc: 'stay running after execution: always',
|
|
40
|
-
parse: (result) => ({ result })
|
|
41
|
-
},
|
|
42
|
-
LOG_FOLLOW: {
|
|
43
|
-
desc: 'filter for output',
|
|
44
|
-
parse: (result) => ({ result })
|
|
45
|
-
},
|
|
46
|
-
LOG_LEVEL: {
|
|
47
|
-
desc: Object.keys(LOGGER_LEVELS).join(', '),
|
|
48
|
-
parse: (result) => Object.keys(LOGGER_LEVELS).includes(result) ? { result } : { error: `${result} not in ${Object.keys(LOGGER_LEVELS).join(', ')}` }
|
|
49
|
-
},
|
|
50
|
-
ENV: {
|
|
51
|
-
desc: 'pass an environment variable: var=value[,var2=value]',
|
|
52
|
-
parse: (input, cur) => {
|
|
53
|
-
const pairs = input?.split(',');
|
|
54
|
-
const env = {};
|
|
55
|
-
for (const pair of pairs) {
|
|
56
|
-
const [k, v] = pair.split('=').map(i => i.trim());
|
|
57
|
-
if (cur[k] || env[k]) {
|
|
58
|
-
return { error: `ENV ${k} already defined` };
|
|
59
|
-
}
|
|
60
|
-
env[k] = v;
|
|
61
|
-
}
|
|
62
|
-
return { env };
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
ENVC: {
|
|
66
|
-
desc: 'pass multiple environment variables: var1=a,var2=b',
|
|
67
|
-
parse: (input, cur) => {
|
|
68
|
-
const pairs = new Set(input?.split(',').map(a => a.split('=')[0]));
|
|
69
|
-
let env = { DEST: DEFAULT_DEST };
|
|
70
|
-
for (const pair of pairs) {
|
|
71
|
-
const [k] = Array.from(new Set(pair.split('=')));
|
|
72
|
-
if (cur[k]) {
|
|
73
|
-
return { error: `ENVC ${k} already exists` };
|
|
74
|
-
}
|
|
75
|
-
env[k] = [];
|
|
76
|
-
}
|
|
77
|
-
for (const pair of (input || '').split(',')) {
|
|
78
|
-
const [k, v] = pair.split('=');
|
|
79
|
-
env[k].push(v);
|
|
80
|
-
}
|
|
81
|
-
return { env };
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
STEP_DELAY: {
|
|
85
|
-
desc: 'delay between steps',
|
|
86
|
-
parse: (input) => intOrError(input)
|
|
87
|
-
},
|
|
88
|
-
LOOPS: {
|
|
89
|
-
desc: 'how many loops',
|
|
90
|
-
parse: (input) => intOrError(input)
|
|
91
|
-
},
|
|
92
|
-
// LOOP_START: {
|
|
93
|
-
// desc: 'wip',
|
|
94
|
-
// parse: (input: string) => intOrError(input)
|
|
95
|
-
// },
|
|
96
|
-
// LOOP_INC: {
|
|
97
|
-
// desc: 'wip',
|
|
98
|
-
// parse: (input: string) => intOrError(input)
|
|
99
|
-
// },
|
|
100
|
-
MEMBERS: {
|
|
101
|
-
desc: 'number of members in each loop',
|
|
102
|
-
parse: (input) => intOrError(input)
|
|
103
|
-
},
|
|
104
|
-
// CONTINUE_ON_ERROR_IF_SCORED: {
|
|
105
|
-
// desc: 'wip',
|
|
106
|
-
// parse: (result: string) => ({ result })
|
|
107
|
-
// },
|
|
108
|
-
OUTPUT: {
|
|
109
|
-
desc: 'Output format (AsXUnit)',
|
|
110
|
-
parse: (result) => ({ result })
|
|
111
|
-
},
|
|
112
|
-
OUTPUT_DEST: {
|
|
113
|
-
desc: 'Output destination (results.xml)',
|
|
114
|
-
parse: (result) => ({ result })
|
|
115
|
-
},
|
|
116
|
-
PWDEBUG: {
|
|
117
|
-
desc: '(web) Enable Playwright debugging (0 or 1)',
|
|
118
|
-
parse: (input) => process.env['PWDEBUG'] = 'true'
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=BaseOptions.js.map
|
package/build/BaseOptions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseOptions.js","sourceRoot":"","sources":["../src/BaseOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAyB,MAAM,gCAAgC,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAC/E,MAAM,OAAO,WAAW;IAC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C,UAAU,CAAC,KAAK,CAAC;SAC9C;QACD,gBAAgB;QAChB,mBAAmB;QACnB,kDAAkD;QAClD,KAAK;QACL,cAAc;QACd,mBAAmB;QACnB,kDAAkD;QAClD,KAAK;QACL,OAAO,EAAE;YACL,IAAI,EAAE,gCAAgC;YACtC,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;SAC9C;QACD,iCAAiC;QACjC,mBAAmB;QACnB,8CAA8C;QAC9C,KAAK;QACL,MAAM,EAAE;YACJ,IAAI,EAAE,yBAAyB;YAC/B,KAAK,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;SAC1C;QACD,WAAW,EAAE;YACT,IAAI,EAAE,kCAAkC;YACxC,KAAK,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;SAC1C;QACD,OAAO,EAAE;YACL,IAAI,EAAE,4CAA4C;YAClD,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,MAAM;SAC5D;KACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_DEST } from '@haibun/core/build/lib/defs.js';
|
|
2
|
-
import { BaseOptions } from './BaseOptions.js';
|
|
3
|
-
describe('applyEnvCollections', () => {
|
|
4
|
-
it.skip('creates pairs', () => {
|
|
5
|
-
const p = { DEST: DEFAULT_DEST };
|
|
6
|
-
const res = BaseOptions.options.ENVC.parse('a=1,b=2,a=3,b=4', p);
|
|
7
|
-
expect(res.env).toEqual({
|
|
8
|
-
a: ["1", "3"],
|
|
9
|
-
b: ["2", "4"]
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
it('prevents collision', () => {
|
|
13
|
-
const p = { DEST: DEFAULT_DEST, a: 1 };
|
|
14
|
-
const res = BaseOptions.options.ENVC.parse('a=1', p);
|
|
15
|
-
expect(res.error).toBeDefined();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
describe('apply ENV', () => {
|
|
19
|
-
it('creates env', () => {
|
|
20
|
-
const p = { DEST: DEFAULT_DEST };
|
|
21
|
-
const res = BaseOptions.options.ENV.parse('a=1', p);
|
|
22
|
-
expect(res.error).not.toBeDefined();
|
|
23
|
-
expect(res.env).toEqual({ a: "1" });
|
|
24
|
-
});
|
|
25
|
-
it('prevents collision', () => {
|
|
26
|
-
const p = { DEST: DEFAULT_DEST, a: 1 };
|
|
27
|
-
const res = BaseOptions.options.ENV.parse('a=1', p);
|
|
28
|
-
expect(res.error).toBeDefined();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=BaseOptions.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseOptions.test.js","sourceRoot":"","sources":["../src/BaseOptions.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;YACtB,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;YACb,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,oBAAoB,EAAE,GAAG,E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|
|
3
|
-
import repl from 'repl';
|
|
4
|
-
import { findStepper, getConfigFromBase, getDefaultOptions, basesFrom } from '@haibun/core/build/lib/util/index.js';
|
|
5
|
-
import runWithOptions from '@haibun/core/build/lib/run-with-options.js';
|
|
6
|
-
import { processArgs, processBaseEnvToOptionsAndErrors, usageThenExit } from './lib.js';
|
|
7
|
-
import { Timer } from '@haibun/core/build/lib/Timer.js';
|
|
8
|
-
import { writeFileSync } from 'fs';
|
|
9
|
-
sourceMapSupport.install();
|
|
10
|
-
process.on('unhandledRejection', console.error);
|
|
11
|
-
go();
|
|
12
|
-
async function go() {
|
|
13
|
-
const { params, configLoc, showHelp } = processArgs(process.argv.slice(2));
|
|
14
|
-
const [paramsBases, paramsFilter] = params;
|
|
15
|
-
const featureFilter = paramsFilter ? paramsFilter.split(',') : undefined;
|
|
16
|
-
const bases = basesFrom(paramsBases?.replace(/\/$/, ''));
|
|
17
|
-
const specl = getSpeclOrExit(configLoc ? [configLoc] : bases);
|
|
18
|
-
if (showHelp) {
|
|
19
|
-
await usageThenExit(specl);
|
|
20
|
-
}
|
|
21
|
-
const { protoOptions, errors } = processBaseEnvToOptionsAndErrors(process.env, specl.options);
|
|
22
|
-
if (errors.length > 0) {
|
|
23
|
-
await usageThenExit(specl, errors.join('\n'));
|
|
24
|
-
}
|
|
25
|
-
const splits = protoOptions.options.SPLITS || [{}];
|
|
26
|
-
console.info('\n_________________________________ start');
|
|
27
|
-
const loops = protoOptions.options.LOOPS || 1;
|
|
28
|
-
const members = protoOptions.options.MEMBERS || 1;
|
|
29
|
-
const { TRACE: trace, OUTPUT: output, OUTPUT_DEST: outputDest } = protoOptions.options;
|
|
30
|
-
const title = protoOptions.options.TITLE || bases + ' ' + [...featureFilter || []].join(',');
|
|
31
|
-
if (outputDest && !output) {
|
|
32
|
-
await usageThenExit(specl, 'OUTPUT_DEST requires OUTPUT');
|
|
33
|
-
}
|
|
34
|
-
const startRunCallback = (world) => {
|
|
35
|
-
if (protoOptions.options.CLI)
|
|
36
|
-
repl.start().context.runtime = world.runtime;
|
|
37
|
-
};
|
|
38
|
-
let endFeatureCallback = undefined;
|
|
39
|
-
if (trace) {
|
|
40
|
-
endFeatureCallback = async (params) => {
|
|
41
|
-
const { world, result, steppers, startOffset } = params;
|
|
42
|
-
const tracker = findStepper(steppers, 'OutReviews');
|
|
43
|
-
const loc = { ...world };
|
|
44
|
-
await tracker.writeTracksFile({ ...loc, mediaType: "json" /* EMediaTypes.json */ }, title, result, Timer.startTime, startOffset);
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const runOptions = { featureFilter, loops, members, splits, trace, specl, bases, protoOptions, startRunCallback, endFeatureCallback };
|
|
48
|
-
const { ok, exceptionResults, ranResults, allFailures, logger, passed, failed, totalRan, runTime, output: runOutput } = await runWithOptions(runOptions);
|
|
49
|
-
// FIXME
|
|
50
|
-
if (runOutput?.length > 0) {
|
|
51
|
-
if (outputDest) {
|
|
52
|
-
runOutput.map((a, i) => {
|
|
53
|
-
if (a?.length > 0) {
|
|
54
|
-
writeFileSync(outputDest.replace('/', `/${i}-`), a);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
logger.log(runOutput.join('\n'));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (ok && exceptionResults.length < 1) {
|
|
63
|
-
logger.log('OK ' + ranResults.every((r) => r.output));
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
logger.error('failures:' + JSON.stringify(allFailures, null, 2));
|
|
67
|
-
}
|
|
68
|
-
console.info('\nRESULT>>>', { ok, startDate: Timer.startTime, startTime: Timer.startTime, passed, failed, totalRan, runTime, 'features/s:': totalRan / runTime });
|
|
69
|
-
if (ok && exceptionResults.length < 1 && protoOptions.options.STAY !== 'always') {
|
|
70
|
-
process.exit(0);
|
|
71
|
-
}
|
|
72
|
-
else if (protoOptions.options.STAY !== 'always') {
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function getSpeclOrExit(bases) {
|
|
77
|
-
const specl = getConfigFromBase(bases);
|
|
78
|
-
if (specl === null || bases?.length < 1) {
|
|
79
|
-
if (specl === null) {
|
|
80
|
-
console.error(`missing or unusable config.json from ${bases}`);
|
|
81
|
-
}
|
|
82
|
-
usageThenExit(specl ? specl : getDefaultOptions());
|
|
83
|
-
}
|
|
84
|
-
return specl;
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=cli.js.map
|
package/build/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACpH,OAAO,cAAc,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,gCAAgC,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAEnC,gBAAgB,CAAC,OAAO,EAAE,CAAC;AAE3B,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAEhD,EAAE,EAAE,CAAC;AAEL,KAAK,UAAU,EAAE;IACf,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,GAAG,MAAM,CAAC;IAC3C,MAAM,aAAa,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,K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AK,KAAK,IAAI,IAAI,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE;QACvC,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,OAAO,CAAC,KAAK,CAAC,wCAAwC,KAAK,EAAE,CAAC,CAAC;SAChE;QACD,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;KACpD;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/build/lib.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TOptions, TProtoOptions, TRunResult, TSpecl } from "@haibun/core/build/lib/defs.js";
|
|
2
|
-
type TEnv = {
|
|
3
|
-
[name: string]: string | undefined;
|
|
4
|
-
};
|
|
5
|
-
export declare function usageThenExit(specl: TSpecl, message?: string): Promise<void>;
|
|
6
|
-
export declare function usage(specl: TSpecl, message?: string): Promise<string>;
|
|
7
|
-
export declare function ranResultError(ranResults: TRunResult[], exceptionResults: any[]): any;
|
|
8
|
-
export declare function processBaseEnvToOptionsAndErrors(env: TEnv, options: TOptions): {
|
|
9
|
-
protoOptions: TProtoOptions;
|
|
10
|
-
errors: string[];
|
|
11
|
-
};
|
|
12
|
-
export declare function processArgs(args: string[]): {
|
|
13
|
-
params: any[];
|
|
14
|
-
configLoc: any;
|
|
15
|
-
showHelp: boolean;
|
|
16
|
-
};
|
|
17
|
-
export {};
|