@cedarjs/cli-helpers 6.0.0-canary.2771 → 6.0.0-canary.2773

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.
Files changed (56) hide show
  1. package/dist/lib/project.d.ts.map +1 -1
  2. package/dist/lib/project.js +2 -1
  3. package/package.json +14 -46
  4. package/dist/cjs/auth/authFiles.d.ts +0 -44
  5. package/dist/cjs/auth/authFiles.d.ts.map +0 -1
  6. package/dist/cjs/auth/authFiles.js +0 -109
  7. package/dist/cjs/auth/authTasks.d.ts +0 -49
  8. package/dist/cjs/auth/authTasks.d.ts.map +0 -1
  9. package/dist/cjs/auth/authTasks.js +0 -391
  10. package/dist/cjs/auth/setupHelpers.d.ts +0 -27
  11. package/dist/cjs/auth/setupHelpers.d.ts.map +0 -1
  12. package/dist/cjs/auth/setupHelpers.js +0 -141
  13. package/dist/cjs/index.d.ts +0 -12
  14. package/dist/cjs/index.d.ts.map +0 -1
  15. package/dist/cjs/index.js +0 -52
  16. package/dist/cjs/lib/colors.d.ts +0 -24
  17. package/dist/cjs/lib/colors.d.ts.map +0 -1
  18. package/dist/cjs/lib/colors.js +0 -52
  19. package/dist/cjs/lib/index.d.ts +0 -22
  20. package/dist/cjs/lib/index.d.ts.map +0 -1
  21. package/dist/cjs/lib/index.js +0 -147
  22. package/dist/cjs/lib/installHelpers.d.ts +0 -17
  23. package/dist/cjs/lib/installHelpers.d.ts.map +0 -1
  24. package/dist/cjs/lib/installHelpers.js +0 -65
  25. package/dist/cjs/lib/loadEnvFiles.d.ts +0 -5
  26. package/dist/cjs/lib/loadEnvFiles.d.ts.map +0 -1
  27. package/dist/cjs/lib/loadEnvFiles.js +0 -99
  28. package/dist/cjs/lib/paths.d.ts +0 -6
  29. package/dist/cjs/lib/paths.d.ts.map +0 -1
  30. package/dist/cjs/lib/paths.js +0 -42
  31. package/dist/cjs/lib/project.d.ts +0 -44
  32. package/dist/cjs/lib/project.d.ts.map +0 -1
  33. package/dist/cjs/lib/project.js +0 -268
  34. package/dist/cjs/lib/version.d.ts +0 -17
  35. package/dist/cjs/lib/version.d.ts.map +0 -1
  36. package/dist/cjs/lib/version.js +0 -107
  37. package/dist/cjs/package.json +0 -1
  38. package/dist/cjs/packageManager/display.d.ts +0 -90
  39. package/dist/cjs/packageManager/display.d.ts.map +0 -1
  40. package/dist/cjs/packageManager/display.js +0 -139
  41. package/dist/cjs/packageManager/exec.d.ts +0 -77
  42. package/dist/cjs/packageManager/exec.d.ts.map +0 -1
  43. package/dist/cjs/packageManager/exec.js +0 -152
  44. package/dist/cjs/packageManager/index.d.ts +0 -13
  45. package/dist/cjs/packageManager/index.d.ts.map +0 -1
  46. package/dist/cjs/packageManager/index.js +0 -73
  47. package/dist/cjs/packageManager/packages.d.ts +0 -39
  48. package/dist/cjs/packageManager/packages.d.ts.map +0 -1
  49. package/dist/cjs/packageManager/packages.js +0 -91
  50. package/dist/cjs/packageManager/workspaces.d.ts +0 -4
  51. package/dist/cjs/packageManager/workspaces.d.ts.map +0 -1
  52. package/dist/cjs/packageManager/workspaces.js +0 -93
  53. package/dist/cjs/telemetry/index.d.ts +0 -20
  54. package/dist/cjs/telemetry/index.d.ts.map +0 -1
  55. package/dist/cjs/telemetry/index.js +0 -64
  56. package/dist/package.json +0 -1
@@ -1,77 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,152 +0,0 @@
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
- });
@@ -1,13 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,73 +0,0 @@
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
- });
@@ -1,39 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,91 +0,0 @@
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
- });
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,93 +0,0 @@
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 workspaces_exports = {};
30
- __export(workspaces_exports, {
31
- addWorkspaceDir: () => addWorkspaceDir
32
- });
33
- module.exports = __toCommonJS(workspaces_exports);
34
- var import_node_fs = __toESM(require("node:fs"), 1);
35
- var import_node_path = __toESM(require("node:path"), 1);
36
- function addWorkspaceDir(baseDir, packagePath, pm) {
37
- if (pm === "pnpm") {
38
- return addPnpmWorkspaceDir(baseDir, packagePath);
39
- }
40
- return addPackageJsonWorkspaceDir(baseDir, packagePath);
41
- }
42
- function addPnpmWorkspaceDir(baseDir, packagePath) {
43
- const yamlPath = import_node_path.default.join(baseDir, "pnpm-workspace.yaml");
44
- if (!import_node_fs.default.existsSync(yamlPath)) {
45
- throw new Error("Invalid workspace config in " + yamlPath);
46
- }
47
- const content = import_node_fs.default.readFileSync(yamlPath, "utf8");
48
- const packageEntry = ` - ${packagePath}`;
49
- if (content.includes(packageEntry)) {
50
- return "exists";
51
- }
52
- const match = content.match(/^(packages:[\s\S]*?)(?=^\w|(?![\s\S]))/m);
53
- if (!match) {
54
- throw new Error("Invalid workspace config in " + yamlPath);
55
- }
56
- const packagesSection = match[1];
57
- const lines = packagesSection.split("\n");
58
- const lastPackageLine = lines.map((line, i) => ({ line, i })).filter(({ line }) => line.trimStart().startsWith("- ")).pop();
59
- if (!lastPackageLine) {
60
- throw new Error("Invalid workspace config in " + yamlPath);
61
- }
62
- const insertAfter = lastPackageLine.i;
63
- lines.splice(insertAfter + 1, 0, packageEntry);
64
- const updatedContent = content.replace(packagesSection, lines.join("\n"));
65
- import_node_fs.default.writeFileSync(yamlPath, updatedContent, "utf8");
66
- return "added";
67
- }
68
- function addPackageJsonWorkspaceDir(baseDir, packagePath) {
69
- const pkgPath = import_node_path.default.join(baseDir, "package.json");
70
- const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf8"));
71
- if (!Array.isArray(pkg.workspaces)) {
72
- throw new Error("Invalid workspace config in " + pkgPath);
73
- }
74
- const hasWildcardPackagesWorkspace = pkg.workspaces.includes("packages/*");
75
- const hasNamedPackagesWorkspace = pkg.workspaces.includes(packagePath);
76
- const hasOtherNamedPackages = pkg.workspaces.some(
77
- (workspace) => workspace.startsWith("packages/") && workspace !== packagePath
78
- );
79
- if (hasWildcardPackagesWorkspace || hasNamedPackagesWorkspace) {
80
- return "exists";
81
- }
82
- if (hasOtherNamedPackages) {
83
- pkg.workspaces.push(packagePath);
84
- } else {
85
- pkg.workspaces.push("packages/*");
86
- }
87
- import_node_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
88
- return "added";
89
- }
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- addWorkspaceDir
93
- });
@@ -1,20 +0,0 @@
1
- import type { AttributeValue, Span } from '@opentelemetry/api';
2
- type TelemetryAttributes = {
3
- [key: string]: AttributeValue | undefined;
4
- };
5
- /**
6
- * Safely records attributes to the opentelemetry span
7
- *
8
- * @param attributes An object of key-value pairs to be individually recorded as attributes
9
- * @param span An optional span to record the attributes to. If not provided, the current active span will be used
10
- */
11
- export declare function recordTelemetryAttributes(attributes: TelemetryAttributes, span?: Span): void;
12
- /**
13
- * Safely records an error to the opentelemetry span
14
- *
15
- * @param error An error to record to the span
16
- * @param span An optional span to record the error to. If not provided, the current active span will be used
17
- */
18
- export declare function recordTelemetryError(error: any, span?: Span): void;
19
- export {};
20
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAG9D,KAAK,mBAAmB,GAAG;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAA;CAC1C,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,mBAAmB,EAC/B,IAAI,CAAC,EAAE,IAAI,QAaZ;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAe3D"}
@@ -1,64 +0,0 @@
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 telemetry_exports = {};
30
- __export(telemetry_exports, {
31
- recordTelemetryAttributes: () => recordTelemetryAttributes,
32
- recordTelemetryError: () => recordTelemetryError
33
- });
34
- module.exports = __toCommonJS(telemetry_exports);
35
- var import_api = __toESM(require("@opentelemetry/api"), 1);
36
- function recordTelemetryAttributes(attributes, span) {
37
- const spanToRecord = span ?? import_api.default.trace.getActiveSpan();
38
- if (spanToRecord === void 0) {
39
- return;
40
- }
41
- for (const [key, value] of Object.entries(attributes)) {
42
- if (value !== void 0) {
43
- spanToRecord.setAttribute(key, value);
44
- }
45
- }
46
- }
47
- function recordTelemetryError(error, span) {
48
- const spanToRecord = span ?? import_api.default.trace.getActiveSpan();
49
- if (spanToRecord === void 0) {
50
- return;
51
- }
52
- const message = error?.message ?? error?.toString() ?? "Unknown error";
53
- const firstLineOfError = message.split("\n")[0];
54
- spanToRecord.setStatus({
55
- code: import_api.SpanStatusCode.ERROR,
56
- message: firstLineOfError
57
- });
58
- spanToRecord.recordException(error ?? new Error(firstLineOfError));
59
- }
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- recordTelemetryAttributes,
63
- recordTelemetryError
64
- });
package/dist/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"module"}