@cedarjs/cli-helpers 4.0.0-canary.13673 → 4.0.0-canary.13675

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.
@@ -1 +1 @@
1
- {"version":3,"file":"installHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/installHelpers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,EAAE,uBAAqB;;;CAQxE,CAAA;AAED,eAAO,MAAM,eAAe;;;CAK3B,CAAA"}
1
+ {"version":3,"file":"installHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/installHelpers.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAMlD,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAMlD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,EAAE,uBAAqB;;;CASxE,CAAA;AAED,eAAO,MAAM,eAAe;;;CAM3B,CAAA"}
@@ -35,32 +35,38 @@ __export(installHelpers_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(installHelpers_exports);
37
37
  var import_execa = __toESM(require("execa"), 1);
38
+ var import_packageManager = require("@cedarjs/project-config/packageManager");
39
+ var import_packageManager2 = require("../packageManager/index.js");
38
40
  var import_paths = require("./paths.js");
39
41
  const addWebPackages = (webPackages) => ({
40
42
  title: "Adding required web packages...",
41
43
  task: async () => {
42
- await (0, import_execa.default)("yarn", ["add", ...webPackages], { cwd: (0, import_paths.getPaths)().web.base });
44
+ const pm = (0, import_packageManager.getPackageManager)();
45
+ await (0, import_execa.default)(pm, [(0, import_packageManager2.add)(), ...webPackages], { cwd: (0, import_paths.getPaths)().web.base });
43
46
  }
44
47
  });
45
48
  const addApiPackages = (apiPackages) => ({
46
49
  title: "Adding required api packages...",
47
50
  task: async () => {
48
- await (0, import_execa.default)("yarn", ["add", ...apiPackages], { cwd: (0, import_paths.getPaths)().api.base });
51
+ const pm = (0, import_packageManager.getPackageManager)();
52
+ await (0, import_execa.default)(pm, [(0, import_packageManager2.add)(), ...apiPackages], { cwd: (0, import_paths.getPaths)().api.base });
49
53
  }
50
54
  });
51
55
  const addRootPackages = (packages, devDependency = false) => {
52
- const addMode = devDependency ? ["add", "-D"] : ["add"];
56
+ const addMode = devDependency ? [(0, import_packageManager2.add)(), "-D"] : [(0, import_packageManager2.add)()];
53
57
  return {
54
58
  title: "Installing packages...",
55
59
  task: async () => {
56
- await (0, import_execa.default)("yarn", [...addMode, ...packages], { cwd: (0, import_paths.getPaths)().base });
60
+ const pm = (0, import_packageManager.getPackageManager)();
61
+ await (0, import_execa.default)(pm, [...addMode, ...packages], { cwd: (0, import_paths.getPaths)().base });
57
62
  }
58
63
  };
59
64
  };
60
65
  const installPackages = {
61
66
  title: "Installing packages...",
62
67
  task: async () => {
63
- await (0, import_execa.default)("yarn", ["install"], { cwd: (0, import_paths.getPaths)().base });
68
+ const pm = (0, import_packageManager.getPackageManager)();
69
+ await (0, import_execa.default)(pm, ["install"], { cwd: (0, import_paths.getPaths)().base });
64
70
  }
65
71
  };
66
72
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,2 +1,13 @@
1
1
  export declare function workspacePackageSpecifier(): string;
2
+ export declare function add(): "install" | "add";
3
+ export declare function install(): string;
4
+ export declare function dedupe(): "dedupe" | undefined;
5
+ export declare function dedupeIsSupported(): boolean;
6
+ export declare function installationErrorMessage(): string;
7
+ /**
8
+ * Gets a string suitable for displaying to the user when telling them to run a
9
+ * Cedar bin command, like `yarn cedar upgrade` or
10
+ * `yarn cedar generate page home /`.
11
+ */
12
+ export declare function prettyPrintCedarCommand(args: string[]): string;
2
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packageManager/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,IAAI,MAAM,CAMlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packageManager/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,IAAI,MAAM,CAMlD;AAED,wBAAgB,GAAG,sBAGlB;AAED,wBAAgB,OAAO,WAEtB;AAED,wBAAgB,MAAM,yBAMrB;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,wBAAwB,WAYvC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9D"}
@@ -18,6 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var packageManager_exports = {};
20
20
  __export(packageManager_exports, {
21
+ add: () => add,
22
+ dedupe: () => dedupe,
23
+ dedupeIsSupported: () => dedupeIsSupported,
24
+ install: () => install,
25
+ installationErrorMessage: () => installationErrorMessage,
26
+ prettyPrintCedarCommand: () => prettyPrintCedarCommand,
21
27
  workspacePackageSpecifier: () => workspacePackageSpecifier
22
28
  });
23
29
  module.exports = __toCommonJS(packageManager_exports);
@@ -28,7 +34,40 @@ function workspacePackageSpecifier() {
28
34
  }
29
35
  return "workspace:*";
30
36
  }
37
+ function add() {
38
+ const pm = (0, import_packageManager.getPackageManager)();
39
+ return pm === "npm" ? "install" : "add";
40
+ }
41
+ function install() {
42
+ return "install";
43
+ }
44
+ function dedupe() {
45
+ if ((0, import_packageManager.getPackageManager)() === "yarn") {
46
+ return "dedupe";
47
+ }
48
+ return void 0;
49
+ }
50
+ function dedupeIsSupported() {
51
+ return (0, import_packageManager.getPackageManager)() === "yarn";
52
+ }
53
+ function installationErrorMessage() {
54
+ if ((0, import_packageManager.getPackageManager)() === "yarn") {
55
+ return "Could not finish installation. Please run `yarn install` and then `yarn dedupe`, before continuing";
56
+ }
57
+ return `Could not finish installation. Please run \`${(0, import_packageManager.getPackageManager)()} ${install()}\` before continuing`;
58
+ }
59
+ function prettyPrintCedarCommand(args) {
60
+ const packageManager = (0, import_packageManager.getPackageManager)();
61
+ const packageManagerBin = packageManager === "npm" ? "npx" : packageManager;
62
+ return `${packageManagerBin} cedar ${args.join(" ")}`;
63
+ }
31
64
  // Annotate the CommonJS export names for ESM import in node:
32
65
  0 && (module.exports = {
66
+ add,
67
+ dedupe,
68
+ dedupeIsSupported,
69
+ install,
70
+ installationErrorMessage,
71
+ prettyPrintCedarCommand,
33
72
  workspacePackageSpecifier
34
73
  });
@@ -1 +1 @@
1
- {"version":3,"file":"installHelpers.d.ts","sourceRoot":"","sources":["../../src/lib/installHelpers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,EAAE,uBAAqB;;;CAQxE,CAAA;AAED,eAAO,MAAM,eAAe;;;CAK3B,CAAA"}
1
+ {"version":3,"file":"installHelpers.d.ts","sourceRoot":"","sources":["../../src/lib/installHelpers.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAMlD,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAMlD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,EAAE,uBAAqB;;;CASxE,CAAA;AAED,eAAO,MAAM,eAAe;;;CAM3B,CAAA"}
@@ -1,30 +1,36 @@
1
1
  import execa from "execa";
2
+ import { getPackageManager } from "@cedarjs/project-config/packageManager";
3
+ import { add } from "../packageManager/index.js";
2
4
  import { getPaths } from "./paths.js";
3
5
  const addWebPackages = (webPackages) => ({
4
6
  title: "Adding required web packages...",
5
7
  task: async () => {
6
- await execa("yarn", ["add", ...webPackages], { cwd: getPaths().web.base });
8
+ const pm = getPackageManager();
9
+ await execa(pm, [add(), ...webPackages], { cwd: getPaths().web.base });
7
10
  }
8
11
  });
9
12
  const addApiPackages = (apiPackages) => ({
10
13
  title: "Adding required api packages...",
11
14
  task: async () => {
12
- await execa("yarn", ["add", ...apiPackages], { cwd: getPaths().api.base });
15
+ const pm = getPackageManager();
16
+ await execa(pm, [add(), ...apiPackages], { cwd: getPaths().api.base });
13
17
  }
14
18
  });
15
19
  const addRootPackages = (packages, devDependency = false) => {
16
- const addMode = devDependency ? ["add", "-D"] : ["add"];
20
+ const addMode = devDependency ? [add(), "-D"] : [add()];
17
21
  return {
18
22
  title: "Installing packages...",
19
23
  task: async () => {
20
- await execa("yarn", [...addMode, ...packages], { cwd: getPaths().base });
24
+ const pm = getPackageManager();
25
+ await execa(pm, [...addMode, ...packages], { cwd: getPaths().base });
21
26
  }
22
27
  };
23
28
  };
24
29
  const installPackages = {
25
30
  title: "Installing packages...",
26
31
  task: async () => {
27
- await execa("yarn", ["install"], { cwd: getPaths().base });
32
+ const pm = getPackageManager();
33
+ await execa(pm, ["install"], { cwd: getPaths().base });
28
34
  }
29
35
  };
30
36
  export {
@@ -1,2 +1,13 @@
1
1
  export declare function workspacePackageSpecifier(): string;
2
+ export declare function add(): "install" | "add";
3
+ export declare function install(): string;
4
+ export declare function dedupe(): "dedupe" | undefined;
5
+ export declare function dedupeIsSupported(): boolean;
6
+ export declare function installationErrorMessage(): string;
7
+ /**
8
+ * Gets a string suitable for displaying to the user when telling them to run a
9
+ * Cedar bin command, like `yarn cedar upgrade` or
10
+ * `yarn cedar generate page home /`.
11
+ */
12
+ export declare function prettyPrintCedarCommand(args: string[]): string;
2
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/packageManager/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,IAAI,MAAM,CAMlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/packageManager/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,IAAI,MAAM,CAMlD;AAED,wBAAgB,GAAG,sBAGlB;AAED,wBAAgB,OAAO,WAEtB;AAED,wBAAgB,MAAM,yBAMrB;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,wBAAwB,WAYvC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9D"}
@@ -5,6 +5,39 @@ function workspacePackageSpecifier() {
5
5
  }
6
6
  return "workspace:*";
7
7
  }
8
+ function add() {
9
+ const pm = getPackageManager();
10
+ return pm === "npm" ? "install" : "add";
11
+ }
12
+ function install() {
13
+ return "install";
14
+ }
15
+ function dedupe() {
16
+ if (getPackageManager() === "yarn") {
17
+ return "dedupe";
18
+ }
19
+ return void 0;
20
+ }
21
+ function dedupeIsSupported() {
22
+ return getPackageManager() === "yarn";
23
+ }
24
+ function installationErrorMessage() {
25
+ if (getPackageManager() === "yarn") {
26
+ return "Could not finish installation. Please run `yarn install` and then `yarn dedupe`, before continuing";
27
+ }
28
+ return `Could not finish installation. Please run \`${getPackageManager()} ${install()}\` before continuing`;
29
+ }
30
+ function prettyPrintCedarCommand(args) {
31
+ const packageManager = getPackageManager();
32
+ const packageManagerBin = packageManager === "npm" ? "npx" : packageManager;
33
+ return `${packageManagerBin} cedar ${args.join(" ")}`;
34
+ }
8
35
  export {
36
+ add,
37
+ dedupe,
38
+ dedupeIsSupported,
39
+ install,
40
+ installationErrorMessage,
41
+ prettyPrintCedarCommand,
9
42
  workspacePackageSpecifier
10
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"installHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/installHelpers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,EAAE,uBAAqB;;;CAQxE,CAAA;AAED,eAAO,MAAM,eAAe;;;CAK3B,CAAA"}
1
+ {"version":3,"file":"installHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/installHelpers.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAMlD,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAMlD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,EAAE,uBAAqB;;;CASxE,CAAA;AAED,eAAO,MAAM,eAAe;;;CAM3B,CAAA"}
@@ -1,2 +1,13 @@
1
1
  export declare function workspacePackageSpecifier(): string;
2
+ export declare function add(): "install" | "add";
3
+ export declare function install(): string;
4
+ export declare function dedupe(): "dedupe" | undefined;
5
+ export declare function dedupeIsSupported(): boolean;
6
+ export declare function installationErrorMessage(): string;
7
+ /**
8
+ * Gets a string suitable for displaying to the user when telling them to run a
9
+ * Cedar bin command, like `yarn cedar upgrade` or
10
+ * `yarn cedar generate page home /`.
11
+ */
12
+ export declare function prettyPrintCedarCommand(args: string[]): string;
2
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packageManager/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,IAAI,MAAM,CAMlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packageManager/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,IAAI,MAAM,CAMlD;AAED,wBAAgB,GAAG,sBAGlB;AAED,wBAAgB,OAAO,WAEtB;AAED,wBAAgB,MAAM,yBAMrB;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,wBAAwB,WAYvC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9D"}