@cedarjs/cli-helpers 5.0.4-next.167 → 5.0.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/dist/auth/authTasks.d.ts.map +1 -1
- package/dist/auth/authTasks.js +4 -11
- package/dist/cjs/auth/authFiles.d.ts +44 -0
- package/dist/cjs/auth/authFiles.d.ts.map +1 -0
- package/dist/cjs/auth/authFiles.js +109 -0
- package/dist/cjs/auth/authTasks.d.ts +49 -0
- package/dist/cjs/auth/authTasks.d.ts.map +1 -0
- package/dist/cjs/auth/authTasks.js +384 -0
- package/dist/cjs/auth/setupHelpers.d.ts +27 -0
- package/dist/cjs/auth/setupHelpers.d.ts.map +1 -0
- package/dist/cjs/auth/setupHelpers.js +141 -0
- package/dist/cjs/index.d.ts +12 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +52 -0
- package/dist/cjs/lib/colors.d.ts +24 -0
- package/dist/cjs/lib/colors.d.ts.map +1 -0
- package/dist/cjs/lib/colors.js +52 -0
- package/dist/cjs/lib/index.d.ts +22 -0
- package/dist/cjs/lib/index.d.ts.map +1 -0
- package/dist/cjs/lib/index.js +147 -0
- package/dist/cjs/lib/installHelpers.d.ts +17 -0
- package/dist/cjs/lib/installHelpers.d.ts.map +1 -0
- package/dist/cjs/lib/installHelpers.js +65 -0
- package/dist/cjs/lib/loadEnvFiles.d.ts +5 -0
- package/dist/cjs/lib/loadEnvFiles.d.ts.map +1 -0
- package/dist/cjs/lib/loadEnvFiles.js +99 -0
- package/dist/cjs/lib/paths.d.ts +6 -0
- package/dist/cjs/lib/paths.d.ts.map +1 -0
- package/dist/cjs/lib/paths.js +42 -0
- package/dist/cjs/lib/project.d.ts +44 -0
- package/dist/cjs/lib/project.d.ts.map +1 -0
- package/dist/cjs/lib/project.js +268 -0
- package/dist/cjs/lib/version.d.ts +17 -0
- package/dist/cjs/lib/version.d.ts.map +1 -0
- package/dist/cjs/lib/version.js +107 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/packageManager/display.d.ts +90 -0
- package/dist/cjs/packageManager/display.d.ts.map +1 -0
- package/dist/cjs/packageManager/display.js +139 -0
- package/dist/cjs/packageManager/exec.d.ts +77 -0
- package/dist/cjs/packageManager/exec.d.ts.map +1 -0
- package/dist/cjs/packageManager/exec.js +152 -0
- package/dist/cjs/packageManager/index.d.ts +13 -0
- package/dist/cjs/packageManager/index.d.ts.map +1 -0
- package/dist/cjs/packageManager/index.js +73 -0
- package/dist/cjs/packageManager/packages.d.ts +39 -0
- package/dist/cjs/packageManager/packages.d.ts.map +1 -0
- package/dist/cjs/packageManager/packages.js +91 -0
- package/dist/cjs/packageManager/workspaces.d.ts +4 -0
- package/dist/cjs/packageManager/workspaces.d.ts.map +1 -0
- package/dist/cjs/packageManager/workspaces.js +93 -0
- package/dist/cjs/telemetry/index.d.ts +20 -0
- package/dist/cjs/telemetry/index.d.ts.map +1 -0
- package/dist/cjs/telemetry/index.js +64 -0
- package/dist/lib/project.d.ts.map +1 -1
- package/dist/lib/project.js +1 -2
- package/dist/package.json +1 -0
- package/package.json +50 -18
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var display_exports = {};
|
|
20
|
+
__export(display_exports, {
|
|
21
|
+
formatAddRootPackagesCommand: () => formatAddRootPackagesCommand,
|
|
22
|
+
formatAddWorkspacePackagesCommand: () => formatAddWorkspacePackagesCommand,
|
|
23
|
+
formatCedarCommand: () => formatCedarCommand,
|
|
24
|
+
formatDlxCommand: () => formatDlxCommand,
|
|
25
|
+
formatInstallCommand: () => formatInstallCommand,
|
|
26
|
+
formatRemoveWorkspacePackagesCommand: () => formatRemoveWorkspacePackagesCommand,
|
|
27
|
+
formatRunBinCommand: () => formatRunBinCommand,
|
|
28
|
+
formatRunScriptCommand: () => formatRunScriptCommand,
|
|
29
|
+
formatRunWorkspaceBinCommand: () => formatRunWorkspaceBinCommand,
|
|
30
|
+
formatRunWorkspaceScriptCommand: () => formatRunWorkspaceScriptCommand
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(display_exports);
|
|
33
|
+
var import_packageManager = require("@cedarjs/project-config/packageManager");
|
|
34
|
+
function formatInstallCommand() {
|
|
35
|
+
return `${(0, import_packageManager.getPackageManager)()} install`;
|
|
36
|
+
}
|
|
37
|
+
function formatCedarCommand(args) {
|
|
38
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
39
|
+
const argStr = args.length > 0 ? ` ${args.join(" ")}` : "";
|
|
40
|
+
if (pm === "npm") {
|
|
41
|
+
return `npx cedar${argStr}`;
|
|
42
|
+
}
|
|
43
|
+
return `${pm} cedar${argStr}`;
|
|
44
|
+
}
|
|
45
|
+
function formatRunScriptCommand(script, args = []) {
|
|
46
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
47
|
+
const argStr = args.length > 0 ? ` ${args.join(" ")}` : "";
|
|
48
|
+
if (pm === "npm") {
|
|
49
|
+
const separator = args.length > 0 ? " -- " : "";
|
|
50
|
+
return `npm run ${script}${separator}${args.join(" ")}`;
|
|
51
|
+
}
|
|
52
|
+
return `${pm} ${script}${argStr}`;
|
|
53
|
+
}
|
|
54
|
+
function formatRunWorkspaceScriptCommand(workspace, script, args = []) {
|
|
55
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
56
|
+
const argStr = args.length > 0 ? ` ${args.join(" ")}` : "";
|
|
57
|
+
if (pm === "yarn") {
|
|
58
|
+
return `yarn workspace ${workspace} ${script}${argStr}`;
|
|
59
|
+
}
|
|
60
|
+
if (pm === "npm") {
|
|
61
|
+
const separator2 = args.length > 0 ? " -- " : "";
|
|
62
|
+
return `npm run ${script} -w ${workspace}${separator2}${args.join(" ")}`;
|
|
63
|
+
}
|
|
64
|
+
const separator = args.length > 0 ? " -- " : "";
|
|
65
|
+
return `pnpm ${script} --filter ${workspace}${separator}${args.join(" ")}`;
|
|
66
|
+
}
|
|
67
|
+
function formatRunBinCommand(bin, args = []) {
|
|
68
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
69
|
+
const argStr = args.length > 0 ? ` ${args.join(" ")}` : "";
|
|
70
|
+
if (pm === "npm") {
|
|
71
|
+
return `npx ${bin}${argStr}`;
|
|
72
|
+
}
|
|
73
|
+
if (pm === "pnpm") {
|
|
74
|
+
return `pnpm exec ${bin}${argStr}`;
|
|
75
|
+
}
|
|
76
|
+
return `yarn ${bin}${argStr}`;
|
|
77
|
+
}
|
|
78
|
+
function formatRunWorkspaceBinCommand(workspace, bin, args = []) {
|
|
79
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
80
|
+
const argStr = args.length > 0 ? ` ${args.join(" ")}` : "";
|
|
81
|
+
if (pm === "yarn") {
|
|
82
|
+
return `yarn workspace ${workspace} ${bin}${argStr}`;
|
|
83
|
+
}
|
|
84
|
+
if (pm === "npm") {
|
|
85
|
+
return `npm exec -w ${workspace} -- ${bin}${argStr}`;
|
|
86
|
+
}
|
|
87
|
+
return `pnpm exec --filter ${workspace} ${bin}${argStr}`;
|
|
88
|
+
}
|
|
89
|
+
function formatDlxCommand(command, args = []) {
|
|
90
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
91
|
+
const argStr = args.length > 0 ? ` ${args.join(" ")}` : "";
|
|
92
|
+
if (pm === "npm") {
|
|
93
|
+
return `npx ${command}${argStr}`;
|
|
94
|
+
}
|
|
95
|
+
return `${pm} dlx ${command}${argStr}`;
|
|
96
|
+
}
|
|
97
|
+
function formatAddRootPackagesCommand(packages, dev = false) {
|
|
98
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
99
|
+
const devFlag = dev ? " -D" : "";
|
|
100
|
+
const pkgStr = packages.join(" ");
|
|
101
|
+
const addCmd = pm === "npm" ? "install" : "add";
|
|
102
|
+
return `${pm} ${addCmd}${devFlag} ${pkgStr}`;
|
|
103
|
+
}
|
|
104
|
+
function formatAddWorkspacePackagesCommand(workspace, packages, dev = false) {
|
|
105
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
106
|
+
const devFlag = dev ? " -D" : "";
|
|
107
|
+
const pkgStr = packages.join(" ");
|
|
108
|
+
if (pm === "yarn") {
|
|
109
|
+
return `yarn workspace ${workspace} add${devFlag} ${pkgStr}`;
|
|
110
|
+
}
|
|
111
|
+
if (pm === "npm") {
|
|
112
|
+
return `npm install${devFlag} ${pkgStr} -w ${workspace}`;
|
|
113
|
+
}
|
|
114
|
+
return `pnpm add${devFlag} ${pkgStr} --filter ${workspace}`;
|
|
115
|
+
}
|
|
116
|
+
function formatRemoveWorkspacePackagesCommand(workspace, packages) {
|
|
117
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
118
|
+
const pkgStr = packages.join(" ");
|
|
119
|
+
if (pm === "yarn") {
|
|
120
|
+
return `yarn workspace ${workspace} remove ${pkgStr}`;
|
|
121
|
+
}
|
|
122
|
+
if (pm === "npm") {
|
|
123
|
+
return `npm uninstall ${pkgStr} -w ${workspace}`;
|
|
124
|
+
}
|
|
125
|
+
return `pnpm remove ${pkgStr} --filter ${workspace}`;
|
|
126
|
+
}
|
|
127
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
+
0 && (module.exports = {
|
|
129
|
+
formatAddRootPackagesCommand,
|
|
130
|
+
formatAddWorkspacePackagesCommand,
|
|
131
|
+
formatCedarCommand,
|
|
132
|
+
formatDlxCommand,
|
|
133
|
+
formatInstallCommand,
|
|
134
|
+
formatRemoveWorkspacePackagesCommand,
|
|
135
|
+
formatRunBinCommand,
|
|
136
|
+
formatRunScriptCommand,
|
|
137
|
+
formatRunWorkspaceBinCommand,
|
|
138
|
+
formatRunWorkspaceScriptCommand
|
|
139
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
import type { Options as ExecaOptions, SyncOptions as ExecaSyncOptions } from 'execa';
|
|
3
|
+
/**
|
|
4
|
+
* Run a script defined in package.json "scripts".
|
|
5
|
+
*
|
|
6
|
+
* - yarn: `yarn <script> [args]`
|
|
7
|
+
* - npm: `npm run <script> [-- args]`
|
|
8
|
+
* - pnpm: `pnpm <script> [args]`
|
|
9
|
+
*/
|
|
10
|
+
export declare function runScript(script: string, args?: string[], options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Synchronous variant of {@link runScript}.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runScriptSync(script: string, args?: string[], options?: ExecaSyncOptions): execa.ExecaSyncReturnValue<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Run a script in a workspace.
|
|
17
|
+
*
|
|
18
|
+
* - yarn: `yarn workspace <workspace> <script> [args]`
|
|
19
|
+
* - npm: `npm run <script> -w <workspace> [-- args]`
|
|
20
|
+
* - pnpm: `pnpm <script> --filter <workspace> [-- args]`
|
|
21
|
+
*/
|
|
22
|
+
export declare function runWorkspaceScript(workspace: string, script: string, args?: string[], options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Run a local binary from node_modules/.bin (PnP-safe for Yarn).
|
|
25
|
+
* Does not support running transitive dependencies, like prisma
|
|
26
|
+
*
|
|
27
|
+
* - yarn: `yarn <bin> [args]`
|
|
28
|
+
* - npm: `npx <bin> [args]`
|
|
29
|
+
* - pnpm: `pnpm exec <bin> [args]`
|
|
30
|
+
*/
|
|
31
|
+
export declare function runBin(bin: string, args?: string[], options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
32
|
+
/** Synchronous variant of {@link runBin} */
|
|
33
|
+
export declare function runBinSync(bin: string, args?: string[], options?: ExecaSyncOptions): execa.ExecaSyncReturnValue<string>;
|
|
34
|
+
export declare function runTransitiveBin(bin: string, args?: string[], options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
35
|
+
/** Synchronous variant of {@link runTransitiveBin} */
|
|
36
|
+
export declare function runTransitiveBinSync(bin: string, args?: string[], options?: ExecaSyncOptions): execa.ExecaSyncReturnValue<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Run a local binary in a workspace context.
|
|
39
|
+
*
|
|
40
|
+
* - yarn: `yarn workspace <workspace> <bin> [args]`
|
|
41
|
+
* - npm: `npm exec -w <workspace> -- <bin> [args]`
|
|
42
|
+
* - pnpm: `pnpm exec --filter <workspace> <bin> [args]`
|
|
43
|
+
*/
|
|
44
|
+
export declare function runWorkspaceBin(workspace: string, bin: string, args?: string[], options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
45
|
+
/**
|
|
46
|
+
* One-off package execution (equivalent to `npx`).
|
|
47
|
+
*
|
|
48
|
+
* - yarn: `yarn dlx <command> [args]`
|
|
49
|
+
* - npm: `npx <command> [args]`
|
|
50
|
+
* - pnpm: `pnpm dlx <command> [args]`
|
|
51
|
+
*/
|
|
52
|
+
export declare function dlx(command: string, args?: string[], options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns spawn-compatible `[cmd, args]` for running a node script.
|
|
55
|
+
*
|
|
56
|
+
* Yarn PnP requires wrapping node via `yarn node` so module resolution works.
|
|
57
|
+
* npm and pnpm use standard `node_modules`, so running `node <script>`
|
|
58
|
+
* directly is sufficient.
|
|
59
|
+
*
|
|
60
|
+
* - yarn: `yarn node <script>`
|
|
61
|
+
* - npm: `node <script>`
|
|
62
|
+
* - pnpm: `node <script>`
|
|
63
|
+
*/
|
|
64
|
+
export declare function getNodeRunnerArgs(scriptPath: string): [string, string[]];
|
|
65
|
+
/**
|
|
66
|
+
* Run a node script via execa.
|
|
67
|
+
*
|
|
68
|
+
* Yarn PnP requires wrapping node via `yarn node` so module resolution works.
|
|
69
|
+
* npm and pnpm use standard `node_modules`, so running `node <script>`
|
|
70
|
+
* directly is sufficient.
|
|
71
|
+
*
|
|
72
|
+
* - yarn: `yarn node <script>`
|
|
73
|
+
* - npm: `node <script>`
|
|
74
|
+
* - pnpm: `node <script>`
|
|
75
|
+
*/
|
|
76
|
+
export declare function runWithNode(scriptPath: string, options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
77
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../src/packageManager/exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EACV,OAAO,IAAI,YAAY,EACvB,WAAW,IAAI,gBAAgB,EAChC,MAAM,OAAO,CAAA;AAId;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,YAAY,mCAWvB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,gBAAgB,sCAkB3B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,YAAY,mCAsBvB;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,YAAY,mCAcvB;AAED,4CAA4C;AAC5C,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,gBAAgB,sCAc3B;AAYD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,YAAY,mCAUvB;AAED,sDAAsD;AACtD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,gBAAgB,sCAU3B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,YAAY,mCAcvB;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CACjB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,CAAC,EAAE,YAAY,mCASvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAQxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,mCAGrE"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var exec_exports = {};
|
|
30
|
+
__export(exec_exports, {
|
|
31
|
+
dlx: () => dlx,
|
|
32
|
+
getNodeRunnerArgs: () => getNodeRunnerArgs,
|
|
33
|
+
runBin: () => runBin,
|
|
34
|
+
runBinSync: () => runBinSync,
|
|
35
|
+
runScript: () => runScript,
|
|
36
|
+
runScriptSync: () => runScriptSync,
|
|
37
|
+
runTransitiveBin: () => runTransitiveBin,
|
|
38
|
+
runTransitiveBinSync: () => runTransitiveBinSync,
|
|
39
|
+
runWithNode: () => runWithNode,
|
|
40
|
+
runWorkspaceBin: () => runWorkspaceBin,
|
|
41
|
+
runWorkspaceScript: () => runWorkspaceScript
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(exec_exports);
|
|
44
|
+
var import_execa = __toESM(require("execa"), 1);
|
|
45
|
+
var import_packageManager = require("@cedarjs/project-config/packageManager");
|
|
46
|
+
function runScript(script, args = [], options) {
|
|
47
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
48
|
+
if (pm === "npm") {
|
|
49
|
+
const npmArgs = args.length > 0 ? ["run", script, "--", ...args] : ["run", script];
|
|
50
|
+
return (0, import_execa.default)(pm, npmArgs, options);
|
|
51
|
+
}
|
|
52
|
+
return (0, import_execa.default)(pm, [script, ...args], options);
|
|
53
|
+
}
|
|
54
|
+
function runScriptSync(script, args = [], options) {
|
|
55
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
56
|
+
if (pm === "npm") {
|
|
57
|
+
if (script === "run" && args.length === 0) {
|
|
58
|
+
return import_execa.default.sync(pm, ["run"], options);
|
|
59
|
+
}
|
|
60
|
+
const npmArgs = args.length > 0 ? ["run", script, "--", ...args] : ["run", script];
|
|
61
|
+
return import_execa.default.sync(pm, npmArgs, options);
|
|
62
|
+
}
|
|
63
|
+
return import_execa.default.sync(pm, [script, ...args], options);
|
|
64
|
+
}
|
|
65
|
+
function runWorkspaceScript(workspace, script, args = [], options) {
|
|
66
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
67
|
+
if (pm === "yarn") {
|
|
68
|
+
return (0, import_execa.default)(pm, ["workspace", workspace, script, ...args], options);
|
|
69
|
+
}
|
|
70
|
+
if (pm === "npm") {
|
|
71
|
+
const npmArgs = args.length > 0 ? ["run", script, "-w", workspace, "--", ...args] : ["run", script, "-w", workspace];
|
|
72
|
+
return (0, import_execa.default)(pm, npmArgs, options);
|
|
73
|
+
}
|
|
74
|
+
const pnpmArgs = args.length > 0 ? [script, "--filter", workspace, "--", ...args] : [script, "--filter", workspace];
|
|
75
|
+
return (0, import_execa.default)(pm, pnpmArgs, options);
|
|
76
|
+
}
|
|
77
|
+
function runBin(bin, args = [], options) {
|
|
78
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
79
|
+
if (pm === "npm") {
|
|
80
|
+
return (0, import_execa.default)("npx", [bin, ...args], options);
|
|
81
|
+
}
|
|
82
|
+
if (pm === "pnpm") {
|
|
83
|
+
return (0, import_execa.default)(pm, ["exec", bin, ...args], options);
|
|
84
|
+
}
|
|
85
|
+
return (0, import_execa.default)(pm, [bin, ...args], options);
|
|
86
|
+
}
|
|
87
|
+
function runBinSync(bin, args = [], options) {
|
|
88
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
89
|
+
if (pm === "npm") {
|
|
90
|
+
return import_execa.default.sync("npx", [bin, ...args], options);
|
|
91
|
+
}
|
|
92
|
+
if (pm === "pnpm") {
|
|
93
|
+
return import_execa.default.sync(pm, ["exec", bin, ...args], options);
|
|
94
|
+
}
|
|
95
|
+
return import_execa.default.sync(pm, [bin, ...args], options);
|
|
96
|
+
}
|
|
97
|
+
function runTransitiveBin(bin, args = [], options) {
|
|
98
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
99
|
+
if (pm === "pnpm") {
|
|
100
|
+
return (0, import_execa.default)(pm, ["exec", bin, ...args], options);
|
|
101
|
+
}
|
|
102
|
+
return (0, import_execa.default)("npx", [bin, ...args], options);
|
|
103
|
+
}
|
|
104
|
+
function runTransitiveBinSync(bin, args = [], options) {
|
|
105
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
106
|
+
if (pm === "pnpm") {
|
|
107
|
+
return import_execa.default.sync(pm, ["exec", bin, ...args], options);
|
|
108
|
+
}
|
|
109
|
+
return import_execa.default.sync("npx", [bin, ...args], options);
|
|
110
|
+
}
|
|
111
|
+
function runWorkspaceBin(workspace, bin, args = [], options) {
|
|
112
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
113
|
+
if (pm === "yarn") {
|
|
114
|
+
return (0, import_execa.default)(pm, ["workspace", workspace, bin, ...args], options);
|
|
115
|
+
}
|
|
116
|
+
if (pm === "npm") {
|
|
117
|
+
return (0, import_execa.default)(pm, ["exec", "-w", workspace, "--", bin, ...args], options);
|
|
118
|
+
}
|
|
119
|
+
return (0, import_execa.default)(pm, ["exec", "--filter", workspace, bin, ...args], options);
|
|
120
|
+
}
|
|
121
|
+
function dlx(command, args = [], options) {
|
|
122
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
123
|
+
if (pm === "npm") {
|
|
124
|
+
return (0, import_execa.default)("npx", [command, ...args], options);
|
|
125
|
+
}
|
|
126
|
+
return (0, import_execa.default)(pm, ["dlx", command, ...args], options);
|
|
127
|
+
}
|
|
128
|
+
function getNodeRunnerArgs(scriptPath) {
|
|
129
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
130
|
+
if (pm === "yarn") {
|
|
131
|
+
return ["yarn", ["node", scriptPath]];
|
|
132
|
+
}
|
|
133
|
+
return ["node", [scriptPath]];
|
|
134
|
+
}
|
|
135
|
+
function runWithNode(scriptPath, options) {
|
|
136
|
+
const [cmd, args] = getNodeRunnerArgs(scriptPath);
|
|
137
|
+
return (0, import_execa.default)(cmd, args, options);
|
|
138
|
+
}
|
|
139
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
140
|
+
0 && (module.exports = {
|
|
141
|
+
dlx,
|
|
142
|
+
getNodeRunnerArgs,
|
|
143
|
+
runBin,
|
|
144
|
+
runBinSync,
|
|
145
|
+
runScript,
|
|
146
|
+
runScriptSync,
|
|
147
|
+
runTransitiveBin,
|
|
148
|
+
runTransitiveBinSync,
|
|
149
|
+
runWithNode,
|
|
150
|
+
runWorkspaceBin,
|
|
151
|
+
runWorkspaceScript
|
|
152
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var packageManager_exports = {};
|
|
20
|
+
__export(packageManager_exports, {
|
|
21
|
+
add: () => add,
|
|
22
|
+
dedupe: () => dedupe,
|
|
23
|
+
dedupeIsSupported: () => dedupeIsSupported,
|
|
24
|
+
install: () => install,
|
|
25
|
+
installationErrorMessage: () => installationErrorMessage,
|
|
26
|
+
prettyPrintCedarCommand: () => prettyPrintCedarCommand,
|
|
27
|
+
workspacePackageSpecifier: () => workspacePackageSpecifier
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(packageManager_exports);
|
|
30
|
+
var import_packageManager = require("@cedarjs/project-config/packageManager");
|
|
31
|
+
function workspacePackageSpecifier() {
|
|
32
|
+
if ((0, import_packageManager.getPackageManager)() === "npm") {
|
|
33
|
+
return "*";
|
|
34
|
+
}
|
|
35
|
+
return "workspace:*";
|
|
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
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
add,
|
|
67
|
+
dedupe,
|
|
68
|
+
dedupeIsSupported,
|
|
69
|
+
install,
|
|
70
|
+
installationErrorMessage,
|
|
71
|
+
prettyPrintCedarCommand,
|
|
72
|
+
workspacePackageSpecifier
|
|
73
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
import type { Options as ExecaOptions } from 'execa';
|
|
3
|
+
type AddOptions = ExecaOptions & {
|
|
4
|
+
dev?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Add packages to the project root.
|
|
8
|
+
*
|
|
9
|
+
* - yarn: `yarn add [-D] <packages>`
|
|
10
|
+
* - npm: `npm install [-D] <packages>`
|
|
11
|
+
* - pnpm: `pnpm add -w [-D] <packages>`
|
|
12
|
+
*/
|
|
13
|
+
export declare function addRootPackages(packages: string[], options?: AddOptions): execa.ExecaChildProcess<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Add packages to a specific workspace.
|
|
16
|
+
*
|
|
17
|
+
* - yarn: `yarn workspace <workspace> add [-D] <packages>`
|
|
18
|
+
* - npm: `npm install [-D] <packages> -w <workspace>`
|
|
19
|
+
* - pnpm: `pnpm add [-D] <packages> --filter <workspace>`
|
|
20
|
+
*/
|
|
21
|
+
export declare function addWorkspacePackages(workspace: string, packages: string[], options?: AddOptions): execa.ExecaChildProcess<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Remove packages from a specific workspace.
|
|
24
|
+
*
|
|
25
|
+
* - yarn: `yarn workspace <workspace> remove <packages>`
|
|
26
|
+
* - npm: `npm uninstall <packages> -w <workspace>`
|
|
27
|
+
* - pnpm: `pnpm remove <packages> --filter <workspace>`
|
|
28
|
+
*/
|
|
29
|
+
export declare function removeWorkspacePackages(workspace: string, packages: string[], options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Install all project dependencies.
|
|
32
|
+
*
|
|
33
|
+
* - yarn: `yarn install`
|
|
34
|
+
* - npm: `npm install`
|
|
35
|
+
* - pnpm: `pnpm install`
|
|
36
|
+
*/
|
|
37
|
+
export declare function installPackages(options?: ExecaOptions): execa.ExecaChildProcess<string>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=packages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/packageManager/packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAA;AAIpD,KAAK,UAAU,GAAG,YAAY,GAAG;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAElD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,UAAU,mCAQvE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,CAAC,EAAE,UAAU,mCA4BrB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,CAAC,EAAE,YAAY,mCAcvB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,mCAGrD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var packages_exports = {};
|
|
30
|
+
__export(packages_exports, {
|
|
31
|
+
addRootPackages: () => addRootPackages,
|
|
32
|
+
addWorkspacePackages: () => addWorkspacePackages,
|
|
33
|
+
installPackages: () => installPackages,
|
|
34
|
+
removeWorkspacePackages: () => removeWorkspacePackages
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(packages_exports);
|
|
37
|
+
var import_execa = __toESM(require("execa"), 1);
|
|
38
|
+
var import_packageManager = require("@cedarjs/project-config/packageManager");
|
|
39
|
+
function addRootPackages(packages, options) {
|
|
40
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
41
|
+
const { dev, ...execaOptions } = options ?? {};
|
|
42
|
+
const addCmd = pm === "npm" ? "install" : "add";
|
|
43
|
+
const devFlag = dev ? ["-D"] : [];
|
|
44
|
+
const rootFlag = pm === "pnpm" ? ["-w"] : [];
|
|
45
|
+
return (0, import_execa.default)(pm, [addCmd, ...rootFlag, ...devFlag, ...packages], execaOptions);
|
|
46
|
+
}
|
|
47
|
+
function addWorkspacePackages(workspace, packages, options) {
|
|
48
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
49
|
+
const { dev, ...execaOptions } = options ?? {};
|
|
50
|
+
const devFlag = dev ? ["-D"] : [];
|
|
51
|
+
if (pm === "yarn") {
|
|
52
|
+
return (0, import_execa.default)(
|
|
53
|
+
pm,
|
|
54
|
+
["workspace", workspace, "add", ...devFlag, ...packages],
|
|
55
|
+
execaOptions
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
if (pm === "npm") {
|
|
59
|
+
return (0, import_execa.default)(
|
|
60
|
+
pm,
|
|
61
|
+
["install", ...devFlag, ...packages, "-w", workspace],
|
|
62
|
+
execaOptions
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return (0, import_execa.default)(
|
|
66
|
+
pm,
|
|
67
|
+
["add", ...devFlag, ...packages, "--filter", workspace],
|
|
68
|
+
execaOptions
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function removeWorkspacePackages(workspace, packages, options) {
|
|
72
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
73
|
+
if (pm === "yarn") {
|
|
74
|
+
return (0, import_execa.default)(pm, ["workspace", workspace, "remove", ...packages], options);
|
|
75
|
+
}
|
|
76
|
+
if (pm === "npm") {
|
|
77
|
+
return (0, import_execa.default)(pm, ["uninstall", ...packages, "-w", workspace], options);
|
|
78
|
+
}
|
|
79
|
+
return (0, import_execa.default)(pm, ["remove", ...packages, "--filter", workspace], options);
|
|
80
|
+
}
|
|
81
|
+
function installPackages(options) {
|
|
82
|
+
const pm = (0, import_packageManager.getPackageManager)();
|
|
83
|
+
return (0, import_execa.default)(pm, ["install"], options);
|
|
84
|
+
}
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
addRootPackages,
|
|
88
|
+
addWorkspacePackages,
|
|
89
|
+
installPackages,
|
|
90
|
+
removeWorkspacePackages
|
|
91
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PackageManager } from '@cedarjs/project-config/packageManager';
|
|
2
|
+
export type AddWorkspaceDirResult = 'exists' | 'added';
|
|
3
|
+
export declare function addWorkspaceDir(baseDir: string, packagePath: string, pm: PackageManager): AddWorkspaceDirResult;
|
|
4
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../src/packageManager/workspaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAE5E,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEtD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,cAAc,GACjB,qBAAqB,CAMvB"}
|