@cedarjs/cli-helpers 9.0.0-canary.1784 → 9.0.0-canary.3124

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 (134) hide show
  1. package/dist/auth/authFiles.d.ts +9 -1
  2. package/dist/auth/authFiles.d.ts.map +1 -1
  3. package/dist/auth/authFiles.js +44 -22
  4. package/dist/auth/authTasks.d.ts +1 -1
  5. package/dist/auth/authTasks.d.ts.map +1 -1
  6. package/dist/auth/authTasks.js +21 -14
  7. package/dist/auth/setupHelpers.d.ts +3 -1
  8. package/dist/auth/setupHelpers.d.ts.map +1 -1
  9. package/dist/auth/setupHelpers.js +2 -1
  10. package/dist/lib/colors.d.ts +7 -5
  11. package/dist/lib/colors.d.ts.map +1 -1
  12. package/dist/lib/index.d.ts +1 -1
  13. package/dist/lib/index.d.ts.map +1 -1
  14. package/dist/lib/index.js +9 -22
  15. package/dist/lib/installHelpers.d.ts.map +1 -1
  16. package/dist/lib/installHelpers.js +14 -7
  17. package/dist/lib/loadEnvFiles.js +2 -2
  18. package/dist/lib/project.d.ts.map +1 -1
  19. package/dist/lib/project.js +10 -10
  20. package/dist/lib/transpileTSToJS.d.ts +18 -0
  21. package/dist/lib/transpileTSToJS.d.ts.map +1 -0
  22. package/dist/lib/transpileTSToJS.js +38 -0
  23. package/dist/lib/tty.d.ts +11 -0
  24. package/dist/lib/tty.d.ts.map +1 -0
  25. package/dist/lib/tty.js +16 -0
  26. package/dist/lib/version.js +5 -5
  27. package/dist/packageManager/display.d.ts +100 -0
  28. package/dist/packageManager/display.d.ts.map +1 -0
  29. package/dist/packageManager/display.js +115 -0
  30. package/dist/packageManager/exec.d.ts +77 -0
  31. package/dist/packageManager/exec.d.ts.map +1 -0
  32. package/dist/packageManager/exec.js +108 -0
  33. package/dist/packageManager/index.d.ts +13 -0
  34. package/dist/packageManager/index.d.ts.map +1 -0
  35. package/dist/packageManager/index.js +43 -0
  36. package/dist/packageManager/packages.d.ts +39 -0
  37. package/dist/packageManager/packages.d.ts.map +1 -0
  38. package/dist/packageManager/packages.js +54 -0
  39. package/dist/packageManager/workspaces.d.ts +4 -0
  40. package/dist/packageManager/workspaces.d.ts.map +1 -0
  41. package/dist/packageManager/workspaces.js +59 -0
  42. package/dist/telemetry/index.d.ts +1 -1
  43. package/dist/telemetry/index.d.ts.map +1 -1
  44. package/dist/telemetry/index.js +3 -1
  45. package/package.json +114 -40
  46. package/LICENSE +0 -21
  47. package/dist/build.d.ts +0 -2
  48. package/dist/build.d.ts.map +0 -1
  49. package/dist/cjs/auth/authFiles.d.ts +0 -44
  50. package/dist/cjs/auth/authFiles.d.ts.map +0 -1
  51. package/dist/cjs/auth/authFiles.js +0 -109
  52. package/dist/cjs/auth/authTasks.d.ts +0 -49
  53. package/dist/cjs/auth/authTasks.d.ts.map +0 -1
  54. package/dist/cjs/auth/authTasks.js +0 -384
  55. package/dist/cjs/auth/setupHelpers.d.ts +0 -26
  56. package/dist/cjs/auth/setupHelpers.d.ts.map +0 -1
  57. package/dist/cjs/auth/setupHelpers.js +0 -141
  58. package/dist/cjs/index.d.ts +0 -12
  59. package/dist/cjs/index.d.ts.map +0 -1
  60. package/dist/cjs/index.js +0 -52
  61. package/dist/cjs/lib/colors.d.ts +0 -22
  62. package/dist/cjs/lib/colors.d.ts.map +0 -1
  63. package/dist/cjs/lib/colors.js +0 -52
  64. package/dist/cjs/lib/index.d.ts +0 -22
  65. package/dist/cjs/lib/index.d.ts.map +0 -1
  66. package/dist/cjs/lib/index.js +0 -146
  67. package/dist/cjs/lib/installHelpers.d.ts +0 -17
  68. package/dist/cjs/lib/installHelpers.d.ts.map +0 -1
  69. package/dist/cjs/lib/installHelpers.js +0 -72
  70. package/dist/cjs/lib/loadEnvFiles.d.ts +0 -5
  71. package/dist/cjs/lib/loadEnvFiles.d.ts.map +0 -1
  72. package/dist/cjs/lib/loadEnvFiles.js +0 -99
  73. package/dist/cjs/lib/paths.d.ts +0 -6
  74. package/dist/cjs/lib/paths.d.ts.map +0 -1
  75. package/dist/cjs/lib/paths.js +0 -42
  76. package/dist/cjs/lib/project.d.ts +0 -44
  77. package/dist/cjs/lib/project.d.ts.map +0 -1
  78. package/dist/cjs/lib/project.js +0 -269
  79. package/dist/cjs/lib/version.d.ts +0 -17
  80. package/dist/cjs/lib/version.d.ts.map +0 -1
  81. package/dist/cjs/lib/version.js +0 -107
  82. package/dist/cjs/package.json +0 -1
  83. package/dist/cjs/telemetry/index.d.ts +0 -20
  84. package/dist/cjs/telemetry/index.d.ts.map +0 -1
  85. package/dist/cjs/telemetry/index.js +0 -62
  86. package/dist/index.d.ts +0 -12
  87. package/dist/index.d.ts.map +0 -1
  88. package/dist/index.js +0 -20
  89. package/dist/package.json +0 -1
  90. package/dist/src/auth/__tests__/authFiles.test.d.ts +0 -2
  91. package/dist/src/auth/__tests__/authFiles.test.d.ts.map +0 -1
  92. package/dist/src/auth/__tests__/authTasks.test.d.ts +0 -2
  93. package/dist/src/auth/__tests__/authTasks.test.d.ts.map +0 -1
  94. package/dist/src/auth/__tests__/mockFsFiles.d.ts +0 -14
  95. package/dist/src/auth/__tests__/mockFsFiles.d.ts.map +0 -1
  96. package/dist/src/auth/__tests__/setupHelpers.test.d.ts +0 -2
  97. package/dist/src/auth/__tests__/setupHelpers.test.d.ts.map +0 -1
  98. package/dist/src/auth/authFiles.d.ts +0 -44
  99. package/dist/src/auth/authFiles.d.ts.map +0 -1
  100. package/dist/src/auth/authTasks.d.ts +0 -49
  101. package/dist/src/auth/authTasks.d.ts.map +0 -1
  102. package/dist/src/auth/setupHelpers.d.ts +0 -26
  103. package/dist/src/auth/setupHelpers.d.ts.map +0 -1
  104. package/dist/src/index.d.ts +0 -12
  105. package/dist/src/index.d.ts.map +0 -1
  106. package/dist/src/lib/__tests__/index.test.d.ts +0 -2
  107. package/dist/src/lib/__tests__/index.test.d.ts.map +0 -1
  108. package/dist/src/lib/__tests__/loadEnvFiles.test.d.ts +0 -2
  109. package/dist/src/lib/__tests__/loadEnvFiles.test.d.ts.map +0 -1
  110. package/dist/src/lib/__tests__/project.addTomlSetting.test.d.ts +0 -2
  111. package/dist/src/lib/__tests__/project.addTomlSetting.test.d.ts.map +0 -1
  112. package/dist/src/lib/__tests__/project.test.d.ts +0 -2
  113. package/dist/src/lib/__tests__/project.test.d.ts.map +0 -1
  114. package/dist/src/lib/__tests__/version.test.d.ts +0 -2
  115. package/dist/src/lib/__tests__/version.test.d.ts.map +0 -1
  116. package/dist/src/lib/colors.d.ts +0 -22
  117. package/dist/src/lib/colors.d.ts.map +0 -1
  118. package/dist/src/lib/index.d.ts +0 -22
  119. package/dist/src/lib/index.d.ts.map +0 -1
  120. package/dist/src/lib/installHelpers.d.ts +0 -17
  121. package/dist/src/lib/installHelpers.d.ts.map +0 -1
  122. package/dist/src/lib/loadEnvFiles.d.ts +0 -5
  123. package/dist/src/lib/loadEnvFiles.d.ts.map +0 -1
  124. package/dist/src/lib/paths.d.ts +0 -6
  125. package/dist/src/lib/paths.d.ts.map +0 -1
  126. package/dist/src/lib/project.d.ts +0 -44
  127. package/dist/src/lib/project.d.ts.map +0 -1
  128. package/dist/src/lib/version.d.ts +0 -17
  129. package/dist/src/lib/version.d.ts.map +0 -1
  130. package/dist/src/telemetry/index.d.ts +0 -20
  131. package/dist/src/telemetry/index.d.ts.map +0 -1
  132. package/dist/tsconfig.tsbuildinfo +0 -1
  133. package/dist/vitest.config.d.mts +0 -3
  134. package/dist/vitest.config.d.mts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli-helpers",
3
- "version": "9.0.0-canary.1784+baa47810a",
3
+ "version": "9.0.0-canary.3124",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -9,84 +9,158 @@
9
9
  "license": "MIT",
10
10
  "type": "module",
11
11
  "exports": {
12
- ".": {
13
- "import": {
14
- "types": "./dist/index.d.ts",
15
- "default": "./dist/index.js"
16
- },
17
- "default": {
18
- "types": "./dist/cjs/index.d.ts",
19
- "default": "./dist/cjs/index.js"
20
- }
21
- },
22
12
  "./loadEnvFiles": {
23
- "import": {
13
+ "default": {
24
14
  "types": "./dist/lib/loadEnvFiles.d.ts",
25
15
  "default": "./dist/lib/loadEnvFiles.js"
26
- },
27
- "default": {
28
- "types": "./dist/cjs/lib/loadEnvFiles.d.ts",
29
- "default": "./dist/cjs/lib/loadEnvFiles.js"
30
16
  }
31
17
  },
32
18
  "./dist/lib/loadEnvFiles.js": {
33
- "import": {
19
+ "default": {
34
20
  "types": "./dist/lib/loadEnvFiles.d.ts",
35
21
  "default": "./dist/lib/loadEnvFiles.js"
36
- },
22
+ }
23
+ },
24
+ "./packageManager": {
25
+ "default": {
26
+ "types": "./dist/packageManager/index.d.ts",
27
+ "default": "./dist/packageManager/index.js"
28
+ }
29
+ },
30
+ "./packageManager/exec": {
31
+ "default": {
32
+ "types": "./dist/packageManager/exec.d.ts",
33
+ "default": "./dist/packageManager/exec.js"
34
+ }
35
+ },
36
+ "./packageManager/packages": {
37
+ "default": {
38
+ "types": "./dist/packageManager/packages.d.ts",
39
+ "default": "./dist/packageManager/packages.js"
40
+ }
41
+ },
42
+ "./packageManager/display": {
43
+ "default": {
44
+ "types": "./dist/packageManager/display.d.ts",
45
+ "default": "./dist/packageManager/display.js"
46
+ }
47
+ },
48
+ "./packageManager/workspaces": {
49
+ "default": {
50
+ "types": "./dist/packageManager/workspaces.d.ts",
51
+ "default": "./dist/packageManager/workspaces.js"
52
+ }
53
+ },
54
+ "./fileHelpers": {
55
+ "default": {
56
+ "types": "./dist/lib/index.d.ts",
57
+ "default": "./dist/lib/index.js"
58
+ }
59
+ },
60
+ "./colors": {
37
61
  "default": {
38
- "types": "./dist/cjs/lib/loadEnvFiles.d.ts",
39
- "default": "./dist/cjs/lib/loadEnvFiles.js"
62
+ "types": "./dist/lib/colors.d.ts",
63
+ "default": "./dist/lib/colors.js"
64
+ }
65
+ },
66
+ "./paths": {
67
+ "default": {
68
+ "types": "./dist/lib/paths.d.ts",
69
+ "default": "./dist/lib/paths.js"
70
+ }
71
+ },
72
+ "./project": {
73
+ "default": {
74
+ "types": "./dist/lib/project.d.ts",
75
+ "default": "./dist/lib/project.js"
76
+ }
77
+ },
78
+ "./transpileTSToJS": {
79
+ "default": {
80
+ "types": "./dist/lib/transpileTSToJS.d.ts",
81
+ "default": "./dist/lib/transpileTSToJS.js"
82
+ }
83
+ },
84
+ "./tty": {
85
+ "default": {
86
+ "types": "./dist/lib/tty.d.ts",
87
+ "default": "./dist/lib/tty.js"
88
+ }
89
+ },
90
+ "./version": {
91
+ "default": {
92
+ "types": "./dist/lib/version.d.ts",
93
+ "default": "./dist/lib/version.js"
94
+ }
95
+ },
96
+ "./auth/setupHelpers": {
97
+ "default": {
98
+ "types": "./dist/auth/setupHelpers.d.ts",
99
+ "default": "./dist/auth/setupHelpers.js"
100
+ }
101
+ },
102
+ "./installHelpers": {
103
+ "default": {
104
+ "types": "./dist/lib/installHelpers.d.ts",
105
+ "default": "./dist/lib/installHelpers.js"
106
+ }
107
+ },
108
+ "./telemetry": {
109
+ "default": {
110
+ "types": "./dist/telemetry/index.d.ts",
111
+ "default": "./dist/telemetry/index.js"
40
112
  }
41
113
  }
42
114
  },
43
- "types": "./dist/index.d.ts",
44
115
  "files": [
45
116
  "dist"
46
117
  ],
47
118
  "scripts": {
48
- "build": "tsx ./build.ts && yarn build:types",
119
+ "build": "node ./build.ts",
49
120
  "build:pack": "yarn pack -o cedarjs-cli-helpers.tgz",
50
- "build:types": "tsc --build --verbose ./tsconfig.build.json ./tsconfig.cjs.json",
121
+ "build:types": "tsc --build --verbose ./tsconfig.build.json",
51
122
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
52
123
  "prepublishOnly": "NODE_ENV=production yarn build",
53
124
  "test": "vitest run",
54
125
  "test:watch": "vitest watch"
55
126
  },
56
127
  "dependencies": {
57
- "@babel/core": "^7.26.10",
58
- "@cedarjs/project-config": "9.0.0-canary.1784",
59
- "@cedarjs/telemetry": "9.0.0-canary.1784",
60
- "@opentelemetry/api": "1.9.0",
61
- "ansis": "4.2.0",
128
+ "@cedarjs/project-config": "9.0.0-canary.3124",
129
+ "@cedarjs/telemetry": "9.0.0-canary.3124",
130
+ "@listr2/prompt-adapter-enquirer": "4.3.2",
131
+ "@opentelemetry/api": "1.9.1",
132
+ "ansis": "4.3.1",
62
133
  "dotenv": "16.6.1",
63
134
  "dotenv-defaults": "5.0.2",
135
+ "enquirer": "2.4.1",
64
136
  "execa": "5.1.1",
65
- "listr2": "7.0.2",
66
- "lodash": "4.17.23",
137
+ "listr2": "10.2.2",
138
+ "lodash": "4.18.1",
67
139
  "pascalcase": "1.0.0",
68
- "prettier": "3.8.1",
140
+ "prettier": "3.9.6",
69
141
  "prompts": "2.4.2",
70
- "semver": "7.7.4",
71
- "smol-toml": "1.6.0",
142
+ "smol-toml": "1.8.0",
143
+ "sucrase": "3.35.1",
72
144
  "termi-link": "1.1.0",
145
+ "verkit": "0.4.0",
73
146
  "yargs-parser": "21.1.1"
74
147
  },
75
148
  "devDependencies": {
76
- "@cedarjs/framework-tools": "9.0.0-canary.1784",
149
+ "@cedarjs/framework-tools": "9.0.0-canary.3124",
77
150
  "@types/dotenv-defaults": "^5.0.0",
78
- "@types/lodash": "4.17.23",
151
+ "@types/lodash": "4.17.25",
79
152
  "@types/pascalcase": "1.0.3",
80
- "@types/semver": "^7",
81
153
  "@types/yargs": "17.0.35",
82
154
  "@types/yargs-parser": "21.0.3",
83
- "prettier-plugin-tailwindcss": "0.7.2",
84
- "tsx": "4.21.0",
155
+ "prettier-plugin-tailwindcss": "0.8.1",
85
156
  "typescript": "5.9.3",
86
- "vitest": "3.2.4"
157
+ "vitest": "4.1.11"
158
+ },
159
+ "engines": {
160
+ "node": ">=24"
87
161
  },
88
162
  "publishConfig": {
89
163
  "access": "public"
90
164
  },
91
- "gitHead": "baa47810a7defb73de27fdf513b815d679509b5e"
165
+ "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
92
166
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Cedar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/build.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":""}
@@ -1,44 +0,0 @@
1
- interface FilesArgs {
2
- basedir: string;
3
- webAuthn: boolean;
4
- }
5
- /**
6
- * Get the api side file paths and file contents to write
7
- *
8
- * Example return value:
9
- * ```json
10
- * {
11
- * "/Users/tobbe/dev/rw-app/api/src/lib/auth.ts": "<file content>",
12
- * "/Users/tobbe/dev/rw-app/api/src/lib/helperFunctions.ts": "<file content>",
13
- * "/Users/tobbe/dev/rw-app/api/src/functions/auth.ts": "<file content>"
14
- * }
15
- * ```
16
- */
17
- export declare const apiSideFiles: ({ basedir, webAuthn }: FilesArgs) => Promise<Record<string, string>>;
18
- /**
19
- * Loops through the keys in `filesRecord` and generates unique file paths if
20
- * they conflict with existing files
21
- *
22
- * Given this input:
23
- * ```json
24
- * {
25
- * "/Users/tobbe/dev/rw-app/api/src/lib/auth.ts": "<file content>",
26
- * "/Users/tobbe/dev/rw-app/api/src/lib/helperFunctions.ts": "<file content>",
27
- * "/Users/tobbe/dev/rw-app/api/src/lib/supertokens.ts": "<file content>",
28
- * "/Users/tobbe/dev/rw-app/api/src/functions/auth.ts": "<file content>"
29
- * }
30
- * ```
31
- *
32
- * You could get this output, depending on what existing files there are
33
- * ```json
34
- * {
35
- * "/Users/tobbe/dev/rw-app/api/src/lib/supertokensAuth3.ts": "<file content>",
36
- * "/Users/tobbe/dev/rw-app/api/src/lib/supertokensHelperFunctions.ts": "<file content>",
37
- * "/Users/tobbe/dev/rw-app/api/src/lib/supertokens2.ts": "<file content>",
38
- * "/Users/tobbe/dev/rw-app/api/src/functions/auth.ts": "<file content>"
39
- * }
40
- * ```
41
- */
42
- export declare function generateUniqueFileNames(filesRecord: Record<string, string>, provider: string): Record<string, string>;
43
- export {};
44
- //# sourceMappingURL=authFiles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authFiles.d.ts","sourceRoot":"","sources":["../../../src/auth/authFiles.ts"],"names":[],"mappings":"AASA,UAAU,SAAS;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAU,uBAAuB,SAAS,oCAmElE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,QAAQ,EAAE,MAAM,0BAwCjB"}
@@ -1,109 +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 authFiles_exports = {};
30
- __export(authFiles_exports, {
31
- apiSideFiles: () => apiSideFiles,
32
- generateUniqueFileNames: () => generateUniqueFileNames
33
- });
34
- module.exports = __toCommonJS(authFiles_exports);
35
- var import_node_fs = __toESM(require("node:fs"), 1);
36
- var import_path = __toESM(require("path"), 1);
37
- var import_pascalcase = __toESM(require("pascalcase"), 1);
38
- var import_lib = require("../lib/index.js");
39
- var import_paths = require("../lib/paths.js");
40
- var import_project = require("../lib/project.js");
41
- const apiSideFiles = async ({ basedir, webAuthn }) => {
42
- const apiSrcPath = (0, import_paths.getPaths)().api.src;
43
- const apiBaseTemplatePath = import_path.default.join(basedir, "templates", "api");
44
- const templateDirectories = import_node_fs.default.readdirSync(apiBaseTemplatePath);
45
- let filesRecord = {};
46
- for (const dir of templateDirectories) {
47
- const templateFiles = import_node_fs.default.readdirSync(import_path.default.join(apiBaseTemplatePath, dir));
48
- const filePaths = templateFiles.filter((fileName) => {
49
- const fileNameParts = fileName.split(".");
50
- return fileNameParts.length <= 3 || fileNameParts.at(-3) !== "webAuthn";
51
- }).map((fileName) => {
52
- let outputFileName = fileName.replace(/\.template$/, "");
53
- if (!(0, import_project.isTypeScriptProject)()) {
54
- outputFileName = outputFileName.replace(/\.ts(x?)$/, ".js$1");
55
- }
56
- if (!webAuthn) {
57
- return { templateFileName: fileName, outputFileName };
58
- }
59
- const webAuthnFileName = fileName.split(".").reverse().map((part, i) => i === 1 ? "webAuthn." + part : part).reverse().join(".");
60
- if (templateFiles.includes(webAuthnFileName)) {
61
- return { templateFileName: webAuthnFileName, outputFileName };
62
- } else {
63
- return { templateFileName: fileName, outputFileName };
64
- }
65
- }).map((f) => {
66
- const templateFilePath = import_path.default.join(
67
- apiBaseTemplatePath,
68
- dir,
69
- f.templateFileName
70
- );
71
- const outputFilePath = import_path.default.join(apiSrcPath, dir, f.outputFileName);
72
- return { templateFilePath, outputFilePath };
73
- });
74
- for (const paths of filePaths) {
75
- const content = import_node_fs.default.readFileSync(paths.templateFilePath, "utf8");
76
- filesRecord = {
77
- ...filesRecord,
78
- [paths.outputFilePath]: (0, import_project.isTypeScriptProject)() ? content : await (0, import_lib.transformTSToJS)(paths.outputFilePath, content)
79
- };
80
- }
81
- }
82
- return filesRecord;
83
- };
84
- function generateUniqueFileNames(filesRecord, provider) {
85
- const newFilesRecord = {};
86
- Object.keys(filesRecord).forEach((fullPath) => {
87
- let newFullPath = fullPath;
88
- let i = 1;
89
- while (import_node_fs.default.existsSync(newFullPath)) {
90
- const nameParts = import_path.default.basename(fullPath).split(".");
91
- if (nameParts[0] === provider) {
92
- const newFileName = provider + (i + 1) + "." + nameParts.slice(1).join(".");
93
- newFullPath = import_path.default.join(import_path.default.dirname(fullPath), newFileName);
94
- } else {
95
- const count = i > 1 ? i : "";
96
- const newFileName = provider + (0, import_pascalcase.default)(nameParts[0]) + count + "." + nameParts.slice(1).join(".");
97
- newFullPath = import_path.default.join(import_path.default.dirname(fullPath), newFileName);
98
- }
99
- i++;
100
- }
101
- newFilesRecord[newFullPath] = filesRecord[fullPath];
102
- });
103
- return newFilesRecord;
104
- }
105
- // Annotate the CommonJS export names for ESM import in node:
106
- 0 && (module.exports = {
107
- apiSideFiles,
108
- generateUniqueFileNames
109
- });
@@ -1,49 +0,0 @@
1
- import type { ListrRenderer, ListrTask, ListrTaskWrapper } from 'listr2';
2
- export declare const getWebAppPath: () => string;
3
- export declare const addApiConfig: ({ replaceExistingImport, authDecoderImport, }: {
4
- replaceExistingImport: boolean;
5
- authDecoderImport?: string;
6
- }) => void;
7
- export declare const hasAuthProvider: (content: string) => boolean;
8
- /**
9
- * Removes <AuthProvider ...> and </AuthProvider> if they exist, and un-indents
10
- * the content.
11
- *
12
- * Exported for testing
13
- */
14
- export declare const removeAuthProvider: (content: string) => string;
15
- /**
16
- * Actually inserts the required config lines into App.{jsx,tsx}
17
- * Exported for testing
18
- */
19
- export declare const addConfigToWebApp: <Renderer extends typeof ListrRenderer>() => ListrTask<AuthGeneratorCtx, Renderer>;
20
- export declare const createWebAuth: (basedir: string, webAuthn: boolean) => {
21
- title: string;
22
- task: (ctx: AuthGeneratorCtx) => Promise<void>;
23
- };
24
- export declare const addConfigToRoutes: () => {
25
- title: string;
26
- task: () => void;
27
- };
28
- /**
29
- * Will find the templates inside `${basedir}/templates/api`,
30
- * and write these files to disk with unique names if they are clashing.
31
- *
32
- * @returns Listr task
33
- */
34
- export declare const generateAuthApiFiles: <Renderer extends typeof ListrRenderer>(basedir: string, webAuthn: boolean) => ListrTask<AuthGeneratorCtx, Renderer>;
35
- export declare const addAuthConfigToGqlApi: <Renderer extends typeof ListrRenderer, FallbackRenderer extends typeof ListrRenderer>(authDecoderImport?: string) => {
36
- title: string;
37
- task: (ctx: AuthGeneratorCtx, _task: ListrTaskWrapper<AuthGeneratorCtx, Renderer, FallbackRenderer>) => void;
38
- };
39
- export type AuthSetupMode = 'FORCE' | 'REPLACE' | 'COMBINE' | 'UNKNOWN';
40
- export interface AuthGeneratorCtx {
41
- setupMode: AuthSetupMode;
42
- provider: string;
43
- force: boolean;
44
- }
45
- export declare const setAuthSetupMode: <Renderer extends typeof ListrRenderer, FallbackRenderer extends typeof ListrRenderer>(force: boolean) => {
46
- title: string;
47
- task: (ctx: AuthGeneratorCtx, task: ListrTaskWrapper<AuthGeneratorCtx, Renderer, FallbackRenderer>) => Promise<void>;
48
- };
49
- //# sourceMappingURL=authTasks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authTasks.d.ts","sourceRoot":"","sources":["../../../src/auth/authTasks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAmBxE,eAAO,MAAM,aAAa,cAA2B,CAAA;AAwDrD,eAAO,MAAM,YAAY,GAAI,+CAG1B;IACD,qBAAqB,EAAE,OAAO,CAAA;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,SAgDA,CAAA;AAmCD,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,YAE9C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,WA6CjD,CAAA;AAoED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,SAAS,OAAO,aAAa,OAClC,SAAS,CAAC,gBAAgB,EAAE,QAAQ,CA0CxC,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,EAAE,UAAU,OAAO;;gBAgC1C,gBAAgB;CA0CrC,CAAA;AAED,eAAO,MAAM,iBAAiB;;;CAmB7B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,OAAO,aAAa,EACxE,SAAS,MAAM,EACf,UAAU,OAAO,KAChB,SAAS,CAAC,gBAAgB,EAAE,QAAQ,CAgDtC,CAAA;AASD,eAAO,MAAM,qBAAqB,GAChC,QAAQ,SAAS,OAAO,aAAa,EACrC,gBAAgB,SAAS,OAAO,aAAa,EAE7C,oBAAoB,MAAM;;gBAInB,gBAAgB,SACd,gBAAgB,CAAC,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,CAAC;CAcvE,CAAA;AAEF,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,CAAA;AAEb,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,aAAa,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,SAAS,OAAO,aAAa,EACrC,gBAAgB,SAAS,OAAO,aAAa,EAE7C,OAAO,OAAO;;gBAKL,gBAAgB,QACf,gBAAgB,CAAC,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,CAAC;CA2CzE,CAAA"}