@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.
Files changed (58) hide show
  1. package/dist/auth/authTasks.d.ts.map +1 -1
  2. package/dist/auth/authTasks.js +4 -11
  3. package/dist/cjs/auth/authFiles.d.ts +44 -0
  4. package/dist/cjs/auth/authFiles.d.ts.map +1 -0
  5. package/dist/cjs/auth/authFiles.js +109 -0
  6. package/dist/cjs/auth/authTasks.d.ts +49 -0
  7. package/dist/cjs/auth/authTasks.d.ts.map +1 -0
  8. package/dist/cjs/auth/authTasks.js +384 -0
  9. package/dist/cjs/auth/setupHelpers.d.ts +27 -0
  10. package/dist/cjs/auth/setupHelpers.d.ts.map +1 -0
  11. package/dist/cjs/auth/setupHelpers.js +141 -0
  12. package/dist/cjs/index.d.ts +12 -0
  13. package/dist/cjs/index.d.ts.map +1 -0
  14. package/dist/cjs/index.js +52 -0
  15. package/dist/cjs/lib/colors.d.ts +24 -0
  16. package/dist/cjs/lib/colors.d.ts.map +1 -0
  17. package/dist/cjs/lib/colors.js +52 -0
  18. package/dist/cjs/lib/index.d.ts +22 -0
  19. package/dist/cjs/lib/index.d.ts.map +1 -0
  20. package/dist/cjs/lib/index.js +147 -0
  21. package/dist/cjs/lib/installHelpers.d.ts +17 -0
  22. package/dist/cjs/lib/installHelpers.d.ts.map +1 -0
  23. package/dist/cjs/lib/installHelpers.js +65 -0
  24. package/dist/cjs/lib/loadEnvFiles.d.ts +5 -0
  25. package/dist/cjs/lib/loadEnvFiles.d.ts.map +1 -0
  26. package/dist/cjs/lib/loadEnvFiles.js +99 -0
  27. package/dist/cjs/lib/paths.d.ts +6 -0
  28. package/dist/cjs/lib/paths.d.ts.map +1 -0
  29. package/dist/cjs/lib/paths.js +42 -0
  30. package/dist/cjs/lib/project.d.ts +44 -0
  31. package/dist/cjs/lib/project.d.ts.map +1 -0
  32. package/dist/cjs/lib/project.js +268 -0
  33. package/dist/cjs/lib/version.d.ts +17 -0
  34. package/dist/cjs/lib/version.d.ts.map +1 -0
  35. package/dist/cjs/lib/version.js +107 -0
  36. package/dist/cjs/package.json +1 -0
  37. package/dist/cjs/packageManager/display.d.ts +90 -0
  38. package/dist/cjs/packageManager/display.d.ts.map +1 -0
  39. package/dist/cjs/packageManager/display.js +139 -0
  40. package/dist/cjs/packageManager/exec.d.ts +77 -0
  41. package/dist/cjs/packageManager/exec.d.ts.map +1 -0
  42. package/dist/cjs/packageManager/exec.js +152 -0
  43. package/dist/cjs/packageManager/index.d.ts +13 -0
  44. package/dist/cjs/packageManager/index.d.ts.map +1 -0
  45. package/dist/cjs/packageManager/index.js +73 -0
  46. package/dist/cjs/packageManager/packages.d.ts +39 -0
  47. package/dist/cjs/packageManager/packages.d.ts.map +1 -0
  48. package/dist/cjs/packageManager/packages.js +91 -0
  49. package/dist/cjs/packageManager/workspaces.d.ts +4 -0
  50. package/dist/cjs/packageManager/workspaces.d.ts.map +1 -0
  51. package/dist/cjs/packageManager/workspaces.js +93 -0
  52. package/dist/cjs/telemetry/index.d.ts +20 -0
  53. package/dist/cjs/telemetry/index.d.ts.map +1 -0
  54. package/dist/cjs/telemetry/index.js +64 -0
  55. package/dist/lib/project.d.ts.map +1 -1
  56. package/dist/lib/project.js +1 -2
  57. package/dist/package.json +1 -0
  58. package/package.json +50 -18
@@ -0,0 +1,93 @@
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
+ });
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,64 @@
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
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/lib/project.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAWrD,eAAO,MAAM,cAAc,qBAE1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AO,MAAM,EAAE,SAAS,MAAM,kBAqCrE,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,MAAM,QAmCzC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,QA0HjC"}
@@ -23,8 +23,7 @@ const isTypeScriptProject = () => {
23
23
  };
24
24
  const getInstalledRedwoodVersion = () => {
25
25
  try {
26
- const packageJsonPath = path.join(import.meta.dirname, "../../package.json");
27
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
26
+ const packageJson = require("../../package.json");
28
27
  return packageJson.version;
29
28
  } catch {
30
29
  console.error(colors.error("Could not find installed Cedar version"));
@@ -0,0 +1 @@
1
+ {"type":"module"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli-helpers",
3
- "version": "5.0.4-next.167",
3
+ "version": "5.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -10,51 +10,83 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
- "default": {
13
+ "import": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "default": "./dist/index.js"
16
+ },
17
+ "default": {
18
+ "types": "./dist/cjs/index.d.ts",
19
+ "default": "./dist/cjs/index.js"
16
20
  }
17
21
  },
18
22
  "./loadEnvFiles": {
19
- "default": {
23
+ "import": {
20
24
  "types": "./dist/lib/loadEnvFiles.d.ts",
21
25
  "default": "./dist/lib/loadEnvFiles.js"
26
+ },
27
+ "default": {
28
+ "types": "./dist/cjs/lib/loadEnvFiles.d.ts",
29
+ "default": "./dist/cjs/lib/loadEnvFiles.js"
22
30
  }
23
31
  },
24
32
  "./dist/lib/loadEnvFiles.js": {
25
- "default": {
33
+ "import": {
26
34
  "types": "./dist/lib/loadEnvFiles.d.ts",
27
35
  "default": "./dist/lib/loadEnvFiles.js"
36
+ },
37
+ "default": {
38
+ "types": "./dist/cjs/lib/loadEnvFiles.d.ts",
39
+ "default": "./dist/cjs/lib/loadEnvFiles.js"
28
40
  }
29
41
  },
30
42
  "./packageManager": {
31
- "default": {
43
+ "import": {
32
44
  "types": "./dist/packageManager/index.d.ts",
33
45
  "default": "./dist/packageManager/index.js"
46
+ },
47
+ "default": {
48
+ "types": "./dist/cjs/packageManager/index.d.ts",
49
+ "default": "./dist/cjs/packageManager/index.js"
34
50
  }
35
51
  },
36
52
  "./packageManager/exec": {
37
- "default": {
53
+ "import": {
38
54
  "types": "./dist/packageManager/exec.d.ts",
39
55
  "default": "./dist/packageManager/exec.js"
56
+ },
57
+ "default": {
58
+ "types": "./dist/cjs/packageManager/exec.d.ts",
59
+ "default": "./dist/cjs/packageManager/exec.js"
40
60
  }
41
61
  },
42
62
  "./packageManager/packages": {
43
- "default": {
63
+ "import": {
44
64
  "types": "./dist/packageManager/packages.d.ts",
45
65
  "default": "./dist/packageManager/packages.js"
66
+ },
67
+ "default": {
68
+ "types": "./dist/cjs/packageManager/packages.d.ts",
69
+ "default": "./dist/cjs/packageManager/packages.js"
46
70
  }
47
71
  },
48
72
  "./packageManager/display": {
49
- "default": {
73
+ "import": {
50
74
  "types": "./dist/packageManager/display.d.ts",
51
75
  "default": "./dist/packageManager/display.js"
76
+ },
77
+ "default": {
78
+ "types": "./dist/cjs/packageManager/display.d.ts",
79
+ "default": "./dist/cjs/packageManager/display.js"
52
80
  }
53
81
  },
54
82
  "./packageManager/workspaces": {
55
- "default": {
83
+ "import": {
56
84
  "types": "./dist/packageManager/workspaces.d.ts",
57
85
  "default": "./dist/packageManager/workspaces.js"
86
+ },
87
+ "default": {
88
+ "types": "./dist/cjs/packageManager/workspaces.d.ts",
89
+ "default": "./dist/cjs/packageManager/workspaces.js"
58
90
  }
59
91
  }
60
92
  },
@@ -63,9 +95,9 @@
63
95
  "dist"
64
96
  ],
65
97
  "scripts": {
66
- "build": "node ./build.ts",
98
+ "build": "node ./build.ts && yarn build:types",
67
99
  "build:pack": "yarn pack -o cedarjs-cli-helpers.tgz",
68
- "build:types": "tsc --build --verbose ./tsconfig.build.json",
100
+ "build:types": "tsc --build --verbose ./tsconfig.build.json ./tsconfig.cjs.json",
69
101
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
70
102
  "prepublishOnly": "NODE_ENV=production yarn build",
71
103
  "test": "vitest run",
@@ -73,11 +105,11 @@
73
105
  },
74
106
  "dependencies": {
75
107
  "@babel/core": "^7.26.10",
76
- "@cedarjs/project-config": "5.0.4-next.167",
77
- "@cedarjs/telemetry": "5.0.4-next.167",
78
- "@listr2/prompt-adapter-enquirer": "4.3.0",
108
+ "@cedarjs/project-config": "5.0.4",
109
+ "@cedarjs/telemetry": "5.0.4",
110
+ "@listr2/prompt-adapter-enquirer": "4.2.1",
79
111
  "@opentelemetry/api": "1.9.1",
80
- "ansis": "4.3.1",
112
+ "ansis": "4.2.0",
81
113
  "dotenv": "16.6.1",
82
114
  "dotenv-defaults": "5.0.2",
83
115
  "enquirer": "2.4.1",
@@ -93,16 +125,16 @@
93
125
  "yargs-parser": "21.1.1"
94
126
  },
95
127
  "devDependencies": {
96
- "@cedarjs/framework-tools": "5.0.4-next.167",
128
+ "@cedarjs/framework-tools": "5.0.4",
97
129
  "@types/dotenv-defaults": "^5.0.0",
98
130
  "@types/lodash": "4.17.24",
99
131
  "@types/pascalcase": "1.0.3",
100
132
  "@types/semver": "^7",
101
133
  "@types/yargs": "17.0.35",
102
134
  "@types/yargs-parser": "21.0.3",
103
- "prettier-plugin-tailwindcss": "0.8.1",
135
+ "prettier-plugin-tailwindcss": "0.8.0",
104
136
  "typescript": "5.9.3",
105
- "vitest": "4.1.10"
137
+ "vitest": "3.2.6"
106
138
  },
107
139
  "engines": {
108
140
  "node": ">=24"