@gluhar/cli 6.0.0-next.1 → 6.0.0-next.3
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 +2 -3
- package/src/commands/build/build.d.ts.map +1 -1
- package/src/commands/build/build.js +15 -3
- package/src/scripts/cmd/executeBash.d.ts.map +1 -1
- package/src/scripts/cmd/executeBash.js +2 -1
- package/src/scripts/cmd/parseArgs.d.ts +6 -1
- package/src/scripts/cmd/parseArgs.d.ts.map +1 -1
- package/src/scripts/cmd/parseArgs.js +10 -2
- package/src/scripts/cmd/parseBashArgs.d.ts +1 -1
- package/src/scripts/cmd/parseBashArgs.d.ts.map +1 -1
- package/src/scripts/cmd/parseBashArgs.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gluhar/cli",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.3",
|
|
4
4
|
"description": "Gluhar cli commands and scripts",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
"directory": "packages/cli"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
|
-
".": "./src/index.
|
|
12
|
-
"./*": "./src/*/index.ts"
|
|
11
|
+
".": "./src/index.js"
|
|
13
12
|
},
|
|
14
13
|
"main": "./src/index.js",
|
|
15
14
|
"bin": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,KAAK,GAAI,SAAS,YAAY,SAmC1C,CAAC"}
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.build = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
4
5
|
const cmd_1 = require("../../scripts/cmd");
|
|
5
6
|
const log_1 = require("./log");
|
|
6
7
|
const build = (options) => {
|
|
7
8
|
const { type } = options;
|
|
8
9
|
// INFO Nuxt modules need a structure of [pkg.json, dist/] to function properly where as my release script needs all pkgs to be released from a dist folder
|
|
9
10
|
if (type === "module") {
|
|
11
|
+
// The package's own builder, not whatever `nuxt-module-build` is first on PATH: the CLI runs
|
|
12
|
+
// through the root workspace, whose .bin holds @nuxtjs/device's module-builder 0.8.3 (Nuxt 3).
|
|
13
|
+
// Every 6.0.0-next.* up to .1 was built with it instead of the declared ^1. npm only nests ^1
|
|
14
|
+
// under each package while that conflict lasts; once it can hoist ^1, the root bin is right.
|
|
15
|
+
const local = "./node_modules/.bin/nuxt-module-build";
|
|
16
|
+
const builder = (0, fs_1.existsSync)(local) ? local : "nuxt-module-build";
|
|
17
|
+
// Every module's tsconfig extends ./.nuxt/tsconfig.json, which only `prepare` generates.
|
|
18
|
+
// Locally `dev:prepare` has always run; on a clean CI checkout it hasn't, the build
|
|
19
|
+
// fails, and an empty dist used to get published (6.0.0-next.1).
|
|
20
|
+
log_1.log.info("Prepare nuxt module types");
|
|
21
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)(`${builder} prepare`), "nuxt-module-build prepare");
|
|
10
22
|
log_1.log.info("Build nuxt module in dist");
|
|
11
|
-
(0, cmd_1.executeCmd)("nuxt-module-build build");
|
|
23
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)(`${builder} build`), "nuxt-module-build build");
|
|
12
24
|
log_1.log.info("Copy contents of dist on level down");
|
|
13
|
-
(0, cmd_1.executeCmd)('copyfiles "dist/**/*" dist');
|
|
25
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)('copyfiles "dist/**/*" dist'), "copyfiles dist");
|
|
14
26
|
// log.info("Delete the copied files");
|
|
15
27
|
// executeCmd(
|
|
16
28
|
// "find ./dist -mindepth 1 ! -path './dist/dist*' -exec rm -rf {} +"
|
|
17
29
|
// );
|
|
18
30
|
log_1.log.info("Copy pkg.json and mds to dist as well");
|
|
19
|
-
(0, cmd_1.executeCmd)("copyfiles package.json README.md CHANGELOG.md dist");
|
|
31
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)("copyfiles package.json README.md CHANGELOG.md dist"), "copyfiles package.json");
|
|
20
32
|
}
|
|
21
33
|
};
|
|
22
34
|
exports.build = build;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeBash.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeBash.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,IAAI,EAAE,WAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"executeBash.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeBash.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,IAAI,EAAE,WAAW,OAAO,qDASxE,CAAC"}
|
|
@@ -11,7 +11,8 @@ const parseBashArgs_1 = require("./parseBashArgs");
|
|
|
11
11
|
* @returns Executes the bash script file in the same stdio.
|
|
12
12
|
*/
|
|
13
13
|
const executeBash = (path, args, absolute) => {
|
|
14
|
-
|
|
14
|
+
// An argv array, not a shell line: values must not be quoted
|
|
15
|
+
const bashArgs = (0, parseBashArgs_1.parseBashArgs)(path, args, absolute, false);
|
|
15
16
|
// TODO make stdio configurable
|
|
16
17
|
// TODO make an async option
|
|
17
18
|
return (0, child_process_1.spawnSync)('bash', bashArgs, {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { Args } from "./types";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @param shell The result is joined into a shell command line, so values with spaces stay
|
|
4
|
+
* quoted. Pass `false` for an argv array (`spawnSync` without a shell), where quotes would
|
|
5
|
+
* end up in the value itself.
|
|
6
|
+
*/
|
|
7
|
+
export declare const parseArgs: (args: Args, shell?: boolean) => string[];
|
|
3
8
|
//# sourceMappingURL=parseArgs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA+B,MAAM,SAAS,CAAC;AAQjE,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"parseArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA+B,MAAM,SAAS,CAAC;AAQjE;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,EAAE,eAAY,KAAG,MAAM,EAoC1D,CAAC"}
|
|
@@ -9,7 +9,12 @@ const hyphenize = (s) => humps_1.default.decamelize(s, { separator: "-" });
|
|
|
9
9
|
const hasValue = (arg) => {
|
|
10
10
|
return arg.value !== undefined;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @param shell The result is joined into a shell command line, so values with spaces stay
|
|
14
|
+
* quoted. Pass `false` for an argv array (`spawnSync` without a shell), where quotes would
|
|
15
|
+
* end up in the value itself.
|
|
16
|
+
*/
|
|
17
|
+
const parseArgs = (args, shell = true) => {
|
|
13
18
|
return Object.entries(args)
|
|
14
19
|
.map(([name, value]) => ({
|
|
15
20
|
name,
|
|
@@ -26,7 +31,10 @@ const parseArgs = (args) => {
|
|
|
26
31
|
result.push(`-${parsedName}`);
|
|
27
32
|
}
|
|
28
33
|
value.toString();
|
|
29
|
-
if (value !== true) {
|
|
34
|
+
if (value !== true && !shell) {
|
|
35
|
+
result.push(String(value));
|
|
36
|
+
}
|
|
37
|
+
else if (value !== true) {
|
|
30
38
|
let v = parsedValue;
|
|
31
39
|
if (v.length > 2 &&
|
|
32
40
|
v[0] === '"' &&
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Args } from './types';
|
|
2
|
-
export declare const parseBashArgs: (path: string, args?: Args, absolute?: boolean) => string[];
|
|
2
|
+
export declare const parseBashArgs: (path: string, args?: Args, absolute?: boolean, shell?: boolean) => string[];
|
|
3
3
|
//# sourceMappingURL=parseBashArgs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBashArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseBashArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EACZ,OAAO,IAAI,EACX,WAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"parseBashArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseBashArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EACZ,OAAO,IAAI,EACX,WAAW,OAAO,EAClB,eAAY,aAab,CAAC"}
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseBashArgs = void 0;
|
|
4
4
|
const log_1 = require("./log");
|
|
5
5
|
const parseArgs_1 = require("./parseArgs");
|
|
6
|
-
const parseBashArgs = (path, args, absolute) => {
|
|
6
|
+
const parseBashArgs = (path, args, absolute, shell = true) => {
|
|
7
7
|
const filePath = path.endsWith('.sh') ? path : `${path}.sh`;
|
|
8
8
|
const absolutePath = !absolute ? `${__dirname}/../${filePath}` : filePath;
|
|
9
9
|
const flags = [absolutePath];
|
|
10
10
|
if (args) {
|
|
11
|
-
flags.push(...(0, parseArgs_1.parseArgs)(args));
|
|
11
|
+
flags.push(...(0, parseArgs_1.parseArgs)(args, shell));
|
|
12
12
|
}
|
|
13
13
|
log_1.log.verbose('executeBash:', flags.join(' '));
|
|
14
14
|
return flags;
|