@gluhar/cli 6.0.0-next.1 → 6.0.0-next.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gluhar/cli",
3
- "version": "6.0.0-next.1",
3
+ "version": "6.0.0-next.4",
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.ts",
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":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,KAAK,GAAI,SAAS,YAAY,SAmB1C,CAAC"}
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;
@@ -6,5 +6,5 @@ import type { Args } from './types';
6
6
  * @param absolute Flag if you are providing an absolute path.
7
7
  * @returns Executes the bash script file in the same stdio.
8
8
  */
9
- export declare const executeBash: (path: string, args?: Args, absolute?: boolean) => import("child_process").SpawnSyncReturns<Buffer>;
9
+ export declare const executeBash: (path: string, args?: Args, absolute?: boolean) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
10
10
  //# sourceMappingURL=executeBash.d.ts.map
@@ -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,qDAQxE,CAAC"}
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,8DASxE,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
- const bashArgs = (0, parseBashArgs_1.parseBashArgs)(path, args, absolute);
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, {
@@ -5,5 +5,5 @@ import type { Args } from './types';
5
5
  * @param args Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
6
6
  * @returns Executes the bash script in the same stdio.
7
7
  */
8
- export declare const executeCmd: (cmd: string, args?: Args) => import("child_process").SpawnSyncReturns<Buffer>;
8
+ export declare const executeCmd: (cmd: string, args?: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
9
9
  //# sourceMappingURL=executeCmd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executeCmd.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeCmd.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,OAAO,IAAI,qDASlD,CAAC"}
1
+ {"version":3,"file":"executeCmd.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeCmd.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,OAAO,IAAI,8DASlD,CAAC"}
@@ -1,3 +1,8 @@
1
1
  import type { Args } from "./types";
2
- export declare const parseArgs: (args: Args) => string[];
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,EAkC5C,CAAC"}
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
- const parseArgs = (args) => {
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,aAanB,CAAC"}
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;
@@ -1,5 +1,5 @@
1
1
  export interface CheckoutOptions {
2
2
  newBranch?: boolean;
3
3
  }
4
- export declare const checkout: (branchName: string, opt?: CheckoutOptions) => import("child_process").SpawnSyncReturns<Buffer>;
4
+ export declare const checkout: (branchName: string, opt?: CheckoutOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
5
5
  //# sourceMappingURL=checkout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/branch/checkout.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,QAAQ,GAAI,YAAY,MAAM,EAAE,MAAK,eAAoB,qDAYrE,CAAC"}
1
+ {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/branch/checkout.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,QAAQ,GAAI,YAAY,MAAM,EAAE,MAAK,eAAoB,8DAYrE,CAAC"}
@@ -3,10 +3,10 @@ export declare const git: {
3
3
  openPr: (sourceBranch: string, destinationBranch: string) => void;
4
4
  getRepo: () => string;
5
5
  remoteStatus: (branch?: string, upstream?: string) => import("./remoteStatus").RemoteStatus;
6
- commit: (args: Args) => import("child_process").SpawnSyncReturns<Buffer>;
7
- push: (branchOrTag: string, remote?: string) => import("child_process").SpawnSyncReturns<Buffer>;
8
- pull: (branchName: string, remote?: string) => import("child_process").SpawnSyncReturns<Buffer>;
9
- merge: (branchName: string, y?: boolean) => import("child_process").SpawnSyncReturns<Buffer>;
6
+ commit: (args: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
7
+ push: (branchOrTag: string, remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
8
+ pull: (branchName: string, remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
9
+ merge: (branchName: string, y?: boolean) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
10
10
  branch: {
11
11
  exists: (branchName: string) => {
12
12
  local: boolean;
@@ -14,14 +14,14 @@ export declare const git: {
14
14
  };
15
15
  delete: (branch: string, options?: import("./branch/branchDelete").BranchDeleteOptions) => void;
16
16
  getCurrent: () => import("./branch/getCurrentBranch").BranchInfo;
17
- checkout: (branchName: string, opt?: import("./branch/checkout").CheckoutOptions) => import("child_process").SpawnSyncReturns<Buffer>;
17
+ checkout: (branchName: string, opt?: import("./branch/checkout").CheckoutOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
18
18
  };
19
19
  tag: {
20
20
  getAll: () => string[];
21
- create: (name: string, options?: import("./tag/createTag").TagCreateOptions) => import("child_process").SpawnSyncReturns<Buffer>;
21
+ create: (name: string, options?: import("./tag/createTag").TagCreateOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
22
22
  delete: (name: string) => void;
23
23
  rename: (oldTagName: string, newTagName: string) => void;
24
- pushAll: (remote?: string) => import("child_process").SpawnSyncReturns<Buffer>;
24
+ pushAll: (remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
25
25
  };
26
26
  clone: (repo: string, dir?: string, options?: import("./clone").CloneOptions) => void;
27
27
  };
@@ -14,5 +14,5 @@ export interface TagCreateOptions {
14
14
  * @param name The name of the tag to create.
15
15
  * @param object The object that the new tag will refer to, usually a commit. Defaults to HEAD.
16
16
  */
17
- export declare const createTag: (name: string, options?: TagCreateOptions) => import("child_process").SpawnSyncReturns<Buffer>;
17
+ export declare const createTag: (name: string, options?: TagCreateOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
18
18
  //# sourceMappingURL=createTag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTag.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/createTag.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,UAAS,gBAAqB,qDAOrE,CAAC"}
1
+ {"version":3,"file":"createTag.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/createTag.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,UAAS,gBAAqB,8DAOrE,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const pushAllTags: (remote?: string) => import("child_process").SpawnSyncReturns<Buffer>;
1
+ export declare const pushAllTags: (remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
2
2
  //# sourceMappingURL=pushAllTags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pushAllTags.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/pushAllTags.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,eAAiB,qDAGzC,CAAC"}
1
+ {"version":3,"file":"pushAllTags.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/pushAllTags.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,eAAiB,8DAGzC,CAAC"}
@@ -2,8 +2,8 @@ import { getDependencies } from './getDependencies';
2
2
  import { filterByDependency } from './filterByDependency';
3
3
  import type { Args } from '../cmd/types';
4
4
  export declare const lerna: {
5
- version: (args?: Args) => import("child_process").SpawnSyncReturns<Buffer>;
6
- list: (args?: Args) => import("child_process").SpawnSyncReturns<Buffer>;
5
+ version: (args?: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
6
+ list: (args?: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
7
7
  changed: () => import("./types").LernaPackage[];
8
8
  getConfig: () => import("./types").LernaConfig | null;
9
9
  getDependencies: typeof getDependencies;