@cedarjs/cli-helpers 2.2.0 → 2.2.1-next.21

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/auth/authFiles.js +1 -1
  2. package/dist/auth/authTasks.js +1 -1
  3. package/dist/build.d.ts +2 -0
  4. package/dist/build.d.ts.map +1 -0
  5. package/dist/cjs/auth/authFiles.js +5 -5
  6. package/dist/cjs/auth/authTasks.js +14 -14
  7. package/dist/cjs/lib/index.js +4 -4
  8. package/dist/cjs/lib/version.js +2 -2
  9. package/dist/lib/index.js +1 -1
  10. package/dist/lib/version.js +1 -1
  11. package/dist/src/auth/__tests__/authFiles.test.d.ts +2 -0
  12. package/dist/src/auth/__tests__/authFiles.test.d.ts.map +1 -0
  13. package/dist/src/auth/__tests__/authTasks.test.d.ts +2 -0
  14. package/dist/src/auth/__tests__/authTasks.test.d.ts.map +1 -0
  15. package/dist/src/auth/__tests__/mockFsFiles.d.ts +14 -0
  16. package/dist/src/auth/__tests__/mockFsFiles.d.ts.map +1 -0
  17. package/dist/src/auth/__tests__/setupHelpers.test.d.ts +2 -0
  18. package/dist/src/auth/__tests__/setupHelpers.test.d.ts.map +1 -0
  19. package/dist/src/auth/authFiles.d.ts +44 -0
  20. package/dist/src/auth/authFiles.d.ts.map +1 -0
  21. package/dist/src/auth/authTasks.d.ts +49 -0
  22. package/dist/src/auth/authTasks.d.ts.map +1 -0
  23. package/dist/src/auth/setupHelpers.d.ts +26 -0
  24. package/dist/src/auth/setupHelpers.d.ts.map +1 -0
  25. package/dist/src/index.d.ts +12 -0
  26. package/dist/src/index.d.ts.map +1 -0
  27. package/dist/src/lib/__tests__/index.test.d.ts +2 -0
  28. package/dist/src/lib/__tests__/index.test.d.ts.map +1 -0
  29. package/dist/src/lib/__tests__/loadEnvFiles.test.d.ts +2 -0
  30. package/dist/src/lib/__tests__/loadEnvFiles.test.d.ts.map +1 -0
  31. package/dist/src/lib/__tests__/project.addTomlSetting.test.d.ts +2 -0
  32. package/dist/src/lib/__tests__/project.addTomlSetting.test.d.ts.map +1 -0
  33. package/dist/src/lib/__tests__/project.test.d.ts +2 -0
  34. package/dist/src/lib/__tests__/project.test.d.ts.map +1 -0
  35. package/dist/src/lib/__tests__/version.test.d.ts +2 -0
  36. package/dist/src/lib/__tests__/version.test.d.ts.map +1 -0
  37. package/dist/src/lib/colors.d.ts +22 -0
  38. package/dist/src/lib/colors.d.ts.map +1 -0
  39. package/dist/src/lib/index.d.ts +21 -0
  40. package/dist/src/lib/index.d.ts.map +1 -0
  41. package/dist/src/lib/installHelpers.d.ts +17 -0
  42. package/dist/src/lib/installHelpers.d.ts.map +1 -0
  43. package/dist/src/lib/loadEnvFiles.d.ts +5 -0
  44. package/dist/src/lib/loadEnvFiles.d.ts.map +1 -0
  45. package/dist/src/lib/paths.d.ts +6 -0
  46. package/dist/src/lib/paths.d.ts.map +1 -0
  47. package/dist/src/lib/project.d.ts +42 -0
  48. package/dist/src/lib/project.d.ts.map +1 -0
  49. package/dist/src/lib/version.d.ts +17 -0
  50. package/dist/src/lib/version.d.ts.map +1 -0
  51. package/dist/src/telemetry/index.d.ts +20 -0
  52. package/dist/src/telemetry/index.d.ts.map +1 -0
  53. package/dist/tsconfig.tsbuildinfo +1 -0
  54. package/dist/vitest.config.d.mts +3 -0
  55. package/dist/vitest.config.d.mts.map +1 -0
  56. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import pascalcase from "pascalcase";
4
4
  import { transformTSToJS } from "../lib/index.js";
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
4
4
  import { getConfig, resolveFile } from "@cedarjs/project-config";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":""}
@@ -32,7 +32,7 @@ __export(authFiles_exports, {
32
32
  generateUniqueFileNames: () => generateUniqueFileNames
33
33
  });
34
34
  module.exports = __toCommonJS(authFiles_exports);
35
- var import_fs = __toESM(require("fs"), 1);
35
+ var import_node_fs = __toESM(require("node:fs"), 1);
36
36
  var import_path = __toESM(require("path"), 1);
37
37
  var import_pascalcase = __toESM(require("pascalcase"), 1);
38
38
  var import_lib = require("../lib/index.js");
@@ -41,10 +41,10 @@ var import_project = require("../lib/project.js");
41
41
  const apiSideFiles = async ({ basedir, webAuthn }) => {
42
42
  const apiSrcPath = (0, import_paths.getPaths)().api.src;
43
43
  const apiBaseTemplatePath = import_path.default.join(basedir, "templates", "api");
44
- const templateDirectories = import_fs.default.readdirSync(apiBaseTemplatePath);
44
+ const templateDirectories = import_node_fs.default.readdirSync(apiBaseTemplatePath);
45
45
  let filesRecord = {};
46
46
  for (const dir of templateDirectories) {
47
- const templateFiles = import_fs.default.readdirSync(import_path.default.join(apiBaseTemplatePath, dir));
47
+ const templateFiles = import_node_fs.default.readdirSync(import_path.default.join(apiBaseTemplatePath, dir));
48
48
  const filePaths = templateFiles.filter((fileName) => {
49
49
  const fileNameParts = fileName.split(".");
50
50
  return fileNameParts.length <= 3 || fileNameParts.at(-3) !== "webAuthn";
@@ -72,7 +72,7 @@ const apiSideFiles = async ({ basedir, webAuthn }) => {
72
72
  return { templateFilePath, outputFilePath };
73
73
  });
74
74
  for (const paths of filePaths) {
75
- const content = import_fs.default.readFileSync(paths.templateFilePath, "utf8");
75
+ const content = import_node_fs.default.readFileSync(paths.templateFilePath, "utf8");
76
76
  filesRecord = {
77
77
  ...filesRecord,
78
78
  [paths.outputFilePath]: (0, import_project.isTypeScriptProject)() ? content : await (0, import_lib.transformTSToJS)(paths.outputFilePath, content)
@@ -86,7 +86,7 @@ function generateUniqueFileNames(filesRecord, provider) {
86
86
  Object.keys(filesRecord).forEach((fullPath) => {
87
87
  let newFullPath = fullPath;
88
88
  let i = 1;
89
- while (import_fs.default.existsSync(newFullPath)) {
89
+ while (import_node_fs.default.existsSync(newFullPath)) {
90
90
  const nameParts = import_path.default.basename(fullPath).split(".");
91
91
  if (nameParts[0] === provider) {
92
92
  const newFileName = provider + (i + 1) + "." + nameParts.slice(1).join(".");
@@ -40,7 +40,7 @@ __export(authTasks_exports, {
40
40
  setAuthSetupMode: () => setAuthSetupMode
41
41
  });
42
42
  module.exports = __toCommonJS(authTasks_exports);
43
- var import_fs = __toESM(require("fs"), 1);
43
+ var import_node_fs = __toESM(require("node:fs"), 1);
44
44
  var import_path = __toESM(require("path"), 1);
45
45
  var import_prompt_adapter_enquirer = require("@listr2/prompt-adapter-enquirer");
46
46
  var import_project_config = require("@cedarjs/project-config");
@@ -78,7 +78,7 @@ const addApiConfig = ({
78
78
  if (!graphqlPath) {
79
79
  throw new Error("Could not find your graphql file path");
80
80
  }
81
- const content = import_fs.default.readFileSync(graphqlPath).toString();
81
+ const content = import_node_fs.default.readFileSync(graphqlPath).toString();
82
82
  let newContent = content;
83
83
  if (authDecoderImport) {
84
84
  if (replaceExistingImport) {
@@ -107,11 +107,11 @@ $1$2$3`
107
107
  );
108
108
  }
109
109
  if (newContent !== content) {
110
- import_fs.default.writeFileSync(graphqlPath, newContent);
110
+ import_node_fs.default.writeFileSync(graphqlPath, newContent);
111
111
  }
112
112
  };
113
113
  const apiSrcDoesExist = () => {
114
- return import_fs.default.existsSync(import_path.default.join((0, import_paths.getPaths)().api.src));
114
+ return import_node_fs.default.existsSync(import_path.default.join((0, import_paths.getPaths)().api.src));
115
115
  };
116
116
  const addAuthImportToApp = (content) => {
117
117
  const contentLines = content.split("\n");
@@ -207,11 +207,11 @@ const addConfigToWebApp = () => {
207
207
  title: "Updating web/src/App.{jsx,tsx}",
208
208
  task: (ctx, task) => {
209
209
  const webAppPath = getWebAppPath();
210
- if (!import_fs.default.existsSync(webAppPath)) {
210
+ if (!import_node_fs.default.existsSync(webAppPath)) {
211
211
  const ext = (0, import_project.isTypeScriptProject)() ? "tsx" : "jsx";
212
212
  throw new Error(`Could not find root App.${ext}`);
213
213
  }
214
- let content = import_fs.default.readFileSync(webAppPath, "utf-8");
214
+ let content = import_node_fs.default.readFileSync(webAppPath, "utf-8");
215
215
  if (!content.includes(AUTH_PROVIDER_HOOK_IMPORT)) {
216
216
  content = addAuthImportToApp(content);
217
217
  }
@@ -231,13 +231,13 @@ const addConfigToWebApp = () => {
231
231
  "Could not find <RedwoodApolloProvider>.\nIf you are using a custom GraphQL Client you will have to make sure it gets access to your `useAuth`, if it needs it."
232
232
  );
233
233
  }
234
- import_fs.default.writeFileSync(webAppPath, content);
234
+ import_node_fs.default.writeFileSync(webAppPath, content);
235
235
  }
236
236
  };
237
237
  };
238
238
  const createWebAuth = (basedir, webAuthn) => {
239
239
  const templatesBaseDir = import_path.default.join(basedir, "templates", "web");
240
- const templates = import_fs.default.readdirSync(templatesBaseDir);
240
+ const templates = import_node_fs.default.readdirSync(templatesBaseDir);
241
241
  const rscEnabled = (0, import_project_config.getConfig)().experimental?.rsc?.enabled;
242
242
  const templateStart = "auth" + (webAuthn ? ".webAuthn" : "") + (rscEnabled ? ".rsc" : "") + ".ts";
243
243
  const templateFileName = templates.find((template) => {
@@ -270,12 +270,12 @@ const createWebAuth = (basedir, webAuthn) => {
270
270
  }
271
271
  }
272
272
  authFileName = authFileName + "." + ext;
273
- let template = import_fs.default.readFileSync(
273
+ let template = import_node_fs.default.readFileSync(
274
274
  import_path.default.join(templatesBaseDir, templateFileName),
275
275
  "utf-8"
276
276
  );
277
277
  template = isTSProject ? template : await (0, import_lib.transformTSToJS)(authFileName, template);
278
- import_fs.default.writeFileSync(authFileName, template);
278
+ import_node_fs.default.writeFileSync(authFileName, template);
279
279
  }
280
280
  };
281
281
  };
@@ -284,14 +284,14 @@ const addConfigToRoutes = () => {
284
284
  title: "Updating Routes file...",
285
285
  task: () => {
286
286
  const webRoutesPath = (0, import_paths.getPaths)().web.routes;
287
- let content = import_fs.default.readFileSync(webRoutesPath).toString();
287
+ let content = import_node_fs.default.readFileSync(webRoutesPath).toString();
288
288
  if (!content.includes(AUTH_HOOK_IMPORT)) {
289
289
  content = addAuthImportToRoutes(content);
290
290
  }
291
291
  if (!hasUseAuthHook("Router", content)) {
292
292
  content = addUseAuthHook("Router", content);
293
293
  }
294
- import_fs.default.writeFileSync(webRoutesPath, content);
294
+ import_node_fs.default.writeFileSync(webRoutesPath, content);
295
295
  }
296
296
  };
297
297
  };
@@ -332,7 +332,7 @@ const generateAuthApiFiles = (basedir, webAuthn) => {
332
332
  };
333
333
  };
334
334
  function findExistingFiles(filesMap) {
335
- return Object.keys(filesMap).filter((filePath) => import_fs.default.existsSync(filePath)).map((filePath) => filePath.replace((0, import_paths.getPaths)().base, ""));
335
+ return Object.keys(filesMap).filter((filePath) => import_node_fs.default.existsSync(filePath)).map((filePath) => filePath.replace((0, import_paths.getPaths)().base, ""));
336
336
  }
337
337
  const addAuthConfigToGqlApi = (authDecoderImport) => ({
338
338
  title: "Adding auth config to GraphQL API...",
@@ -357,7 +357,7 @@ const setAuthSetupMode = (force) => {
357
357
  ctx.setupMode = "FORCE";
358
358
  return;
359
359
  }
360
- const webAppContents = import_fs.default.readFileSync(getWebAppPath(), "utf-8");
360
+ const webAppContents = import_node_fs.default.readFileSync(getWebAppPath(), "utf-8");
361
361
  if (hasAuthProvider(webAppContents) && ctx.setupMode === "UNKNOWN") {
362
362
  const setupMode = "REPLACE";
363
363
  ctx.setupMode = setupMode;
@@ -35,7 +35,7 @@ __export(lib_exports, {
35
35
  writeFilesTask: () => writeFilesTask
36
36
  });
37
37
  module.exports = __toCommonJS(lib_exports);
38
- var import_fs = __toESM(require("fs"), 1);
38
+ var import_node_fs = __toESM(require("node:fs"), 1);
39
39
  var import_path = __toESM(require("path"), 1);
40
40
  var babel = __toESM(require("@babel/core"), 1);
41
41
  var import_listr2 = require("listr2");
@@ -105,7 +105,7 @@ const prettify = async (templateFilename, renderedTemplate) => {
105
105
  const writeFile = (target, contents, { existingFiles = "FAIL" } = {}, task = {}) => {
106
106
  const { base } = (0, import_paths.getPaths)();
107
107
  task.title = `Writing \`./${import_path.default.relative(base, target)}\``;
108
- const exists = import_fs.default.existsSync(target);
108
+ const exists = import_node_fs.default.existsSync(target);
109
109
  if (exists && existingFiles === "FAIL") {
110
110
  throw new Error(`${target} already exists.`);
111
111
  }
@@ -115,8 +115,8 @@ const writeFile = (target, contents, { existingFiles = "FAIL" } = {}, task = {})
115
115
  }
116
116
  const filename = import_path.default.basename(target);
117
117
  const targetDir = target.replace(filename, "");
118
- import_fs.default.mkdirSync(targetDir, { recursive: true });
119
- import_fs.default.writeFileSync(target, contents);
118
+ import_node_fs.default.mkdirSync(targetDir, { recursive: true });
119
+ import_node_fs.default.writeFileSync(target, contents);
120
120
  task.title = `Successfully wrote file \`./${import_path.default.relative(base, target)}\``;
121
121
  };
122
122
  const writeFilesTask = (files, options) => {
@@ -31,7 +31,7 @@ __export(version_exports, {
31
31
  getCompatibilityData: () => getCompatibilityData
32
32
  });
33
33
  module.exports = __toCommonJS(version_exports);
34
- var import_fs = __toESM(require("fs"), 1);
34
+ var import_node_fs = __toESM(require("node:fs"), 1);
35
35
  var import_path = __toESM(require("path"), 1);
36
36
  var import_semver = __toESM(require("semver"), 1);
37
37
  var import_project_config = require("@cedarjs/project-config");
@@ -40,7 +40,7 @@ function getCorrespondingTag(version, distTags) {
40
40
  }
41
41
  async function getCompatibilityData(packageName, preferredVersionOrTag) {
42
42
  const projectPackageJson = JSON.parse(
43
- import_fs.default.readFileSync(import_path.default.join((0, import_project_config.getPaths)().base, "package.json"), {
43
+ import_node_fs.default.readFileSync(import_path.default.join((0, import_project_config.getPaths)().base, "package.json"), {
44
44
  encoding: "utf8"
45
45
  })
46
46
  );
package/dist/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import * as babel from "@babel/core";
4
4
  import { Listr } from "listr2";
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import semver from "semver";
4
4
  import { getPaths } from "@cedarjs/project-config";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authFiles.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authFiles.test.d.ts","sourceRoot":"","sources":["../../../../src/auth/__tests__/authFiles.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authTasks.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authTasks.test.d.ts","sourceRoot":"","sources":["../../../../src/auth/__tests__/authTasks.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export declare const webAppTsx: string;
2
+ export declare const graphqlTs: string;
3
+ export declare const auth0WebAuthTsTemplate: string;
4
+ export declare const clerkWebAuthTsTemplate: string;
5
+ export declare const routesTsx: string;
6
+ export declare const legacyAuthWebAppTsx: string;
7
+ export declare const customApolloAppTsx: string;
8
+ export declare const customPropsRoutesTsx: string;
9
+ export declare const useAuthRoutesTsx: string;
10
+ export declare const explicitReturnAppTsx: string;
11
+ export declare const withoutRedwoodApolloAppTsx: string;
12
+ export declare const withAuthDecoderGraphqlTs: string;
13
+ export declare const nonStandardAuthDecoderGraphqlTs: string;
14
+ //# sourceMappingURL=mockFsFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockFsFiles.d.ts","sourceRoot":"","sources":["../../../../src/auth/__tests__/mockFsFiles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,QAoBrB,CAAA;AAED,eAAO,MAAM,SAAS,QAoBrB,CAAA;AAED,eAAO,MAAM,sBAAsB,QAyBlC,CAAA;AAED,eAAO,MAAM,sBAAsB,QAsDlC,CAAA;AAED,eAAO,MAAM,SAAS,QAqBrB,CAAA;AAED,eAAO,MAAM,mBAAmB,QA4B/B,CAAA;AAED,eAAO,MAAM,kBAAkB,QAoB9B,CAAA;AAED,eAAO,MAAM,oBAAoB,QA8BhC,CAAA;AAED,eAAO,MAAM,gBAAgB,QAkC5B,CAAA;AAED,eAAO,MAAM,oBAAoB,QA+BhC,CAAA;AAED,eAAO,MAAM,0BAA0B,QAuBtC,CAAA;AAED,eAAO,MAAM,wBAAwB,QAwBpC,CAAA;AAED,eAAO,MAAM,+BAA+B,QAwB3C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=setupHelpers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupHelpers.test.d.ts","sourceRoot":"","sources":["../../../../src/auth/__tests__/setupHelpers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,49 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,26 @@
1
+ import type { ListrTask } from 'listr2';
2
+ import type { Argv } from 'yargs';
3
+ import type { AuthGeneratorCtx } from './authTasks.js';
4
+ export declare const standardAuthBuilder: (yargs: Argv) => Argv<{
5
+ force: boolean;
6
+ } & {
7
+ verbose: boolean;
8
+ }>;
9
+ export interface AuthHandlerArgs {
10
+ basedir: string;
11
+ forceArg: boolean;
12
+ provider: string;
13
+ authDecoderImport?: string;
14
+ webAuthn?: boolean;
15
+ webPackages?: string[];
16
+ apiPackages?: string[];
17
+ extraTasks?: (ListrTask<AuthGeneratorCtx> | undefined)[];
18
+ notes?: string[];
19
+ verbose?: boolean;
20
+ }
21
+ /**
22
+ * basedir assumes that you must have a templates folder in that directory.
23
+ * See folder structure of auth providers in packages/auth-providers/<provider>/setup/src
24
+ */
25
+ export declare const standardAuthHandler: ({ basedir, forceArg, provider, authDecoderImport, webAuthn, webPackages, apiPackages, extraTasks, notes, verbose, }: AuthHandlerArgs) => Promise<void>;
26
+ //# sourceMappingURL=setupHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupHelpers.d.ts","sourceRoot":"","sources":["../../../src/auth/setupHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAWjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAUtD,eAAO,MAAM,mBAAmB,GAAI,OAAO,IAAI;;;;EAoB9C,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC,EAAE,CAAA;IACxD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AASD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAU,qHAWvC,eAAe,kBAiFjB,CAAA"}
@@ -0,0 +1,12 @@
1
+ export * from './lib/index.js';
2
+ export * from './lib/colors.js';
3
+ export { loadEnvFiles } from './lib/loadEnvFiles.js';
4
+ export { loadDefaultEnvFiles, loadNodeEnvDerivedEnvFile, loadUserSpecifiedEnvFiles, } from './lib/loadEnvFiles.js';
5
+ export * from './lib/paths.js';
6
+ export * from './lib/project.js';
7
+ export * from './lib/version.js';
8
+ export * from './auth/setupHelpers.js';
9
+ export type { AuthHandlerArgs } from './auth/setupHelpers.js';
10
+ export * from './lib/installHelpers.js';
11
+ export * from './telemetry/index.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,cAAc,yBAAyB,CAAA;AAEvC,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/__tests__/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=loadEnvFiles.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadEnvFiles.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/__tests__/loadEnvFiles.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project.addTomlSetting.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.addTomlSetting.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/__tests__/project.addTomlSetting.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/__tests__/project.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=version.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/__tests__/version.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * To keep a consistent color/style palette between cli packages, such as
3
+ * @redwood/cli and @redwood/create-cedar-app, please only use the colors
4
+ * defined here. If you *really* can't find a color that fits your needs,
5
+ * it's better to add it here than to introduce a new one-off color in whatever
6
+ * package you're going to use it in.
7
+ */
8
+ export declare const colors: {
9
+ error: import("ansis").Ansis;
10
+ warning: import("ansis").Ansis;
11
+ highlight: import("ansis").Ansis;
12
+ success: import("ansis").Ansis;
13
+ info: import("ansis").Ansis;
14
+ bold: import("ansis").Ansis;
15
+ underline: import("ansis").Ansis;
16
+ note: import("ansis").Ansis;
17
+ tip: import("ansis").Ansis;
18
+ important: import("ansis").Ansis;
19
+ caution: import("ansis").Ansis;
20
+ link: import("ansis").Ansis;
21
+ };
22
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../src/lib/colors.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAalB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import type { ListrTaskWrapper, ListrRenderer } from 'listr2';
2
+ import { Listr } from 'listr2';
3
+ export declare const transformTSToJS: (filename: string, content: string) => string | Promise<string>;
4
+ /**
5
+ * This returns the config present in `prettier.config.cjs` of a Redwood project.
6
+ */
7
+ export declare const getPrettierOptions: () => Promise<any>;
8
+ export declare const prettify: (templateFilename: string, renderedTemplate: string) => Promise<string>;
9
+ export type ExistingFiles = 'OVERWRITE' | 'SKIP' | 'FAIL';
10
+ export declare const writeFile: <Renderer extends typeof ListrRenderer>(target: string, contents: string, { existingFiles }?: {
11
+ existingFiles?: ExistingFiles;
12
+ }, task?: ListrTaskWrapper<never, Renderer, Renderer>) => void;
13
+ /**
14
+ * Creates a list of tasks that write files to the disk.
15
+ *
16
+ * @param files - {[filepath]: contents}
17
+ */
18
+ export declare const writeFilesTask: <Renderer extends typeof ListrRenderer>(files: Record<string, string>, options: {
19
+ existingFiles: ExistingFiles;
20
+ }) => Listr<never, Renderer, "simple">;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EAEd,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAU9B,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,SAAS,MAAM,6BA8BhE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,oBAkB9B,CAAA;AAED,eAAO,MAAM,QAAQ,GACnB,kBAAkB,MAAM,EACxB,kBAAkB,MAAM,KACvB,OAAO,CAAC,MAAM,CAwBhB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,CAAA;AAEzD,eAAO,MAAM,SAAS,GAAI,QAAQ,SAAS,OAAO,aAAa,EAC7D,QAAQ,MAAM,EACd,UAAU,MAAM,EAChB,oBAA4B;IAAE,aAAa,CAAC,EAAE,aAAa,CAAA;CAAO,EAGlE,OAAM,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAI/C,SAoBF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,OAAO,aAAa,EAClE,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,SAAS;IAAE,aAAa,EAAE,aAAa,CAAA;CAAE,qCAuB1C,CAAA"}
@@ -0,0 +1,17 @@
1
+ export declare const addWebPackages: (webPackages: string[]) => {
2
+ title: string;
3
+ task: () => Promise<void>;
4
+ };
5
+ export declare const addApiPackages: (apiPackages: string[]) => {
6
+ title: string;
7
+ task: () => Promise<void>;
8
+ };
9
+ export declare const addRootPackages: (packages: string[], devDependency?: boolean) => {
10
+ title: string;
11
+ task: () => Promise<void>;
12
+ };
13
+ export declare const installPackages: {
14
+ title: string;
15
+ task: () => Promise<void>;
16
+ };
17
+ //# sourceMappingURL=installHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/installHelpers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,EAAE;;;CAKlD,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,EAAE,uBAAqB;;;CAQxE,CAAA;AAED,eAAO,MAAM,eAAe;;;CAK3B,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare function loadEnvFiles(): void;
2
+ export declare function loadDefaultEnvFiles(cwd: string): void;
3
+ export declare function loadNodeEnvDerivedEnvFile(cwd: string): void;
4
+ export declare function loadUserSpecifiedEnvFiles(cwd: string, loadEnvFiles: string[]): void;
5
+ //# sourceMappingURL=loadEnvFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadEnvFiles.d.ts","sourceRoot":"","sources":["../../../src/lib/loadEnvFiles.ts"],"names":[],"mappings":"AAUA,wBAAgB,YAAY,SAsB3B;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,QAQ9C;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,QAcpD;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAW5E"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This wraps the core version of getPaths into something that catches the exception
3
+ * and displays a helpful error message.
4
+ */
5
+ export declare function getPaths(): import("@cedarjs/project-config").Paths;
6
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/lib/paths.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,QAAQ,4CAUvB"}
@@ -0,0 +1,42 @@
1
+ import type { Config } from '@cedarjs/project-config';
2
+ export declare const getGraphqlPath: () => string | null;
3
+ export declare const graphFunctionDoesExist: () => boolean | "" | null;
4
+ export declare const isTypeScriptProject: () => boolean;
5
+ export declare const getInstalledRedwoodVersion: () => any;
6
+ /**
7
+ * Updates the project's redwood.toml file to include the specified packages plugin
8
+ *
9
+ * Uses toml parsing to determine if the plugin is already included in the file and
10
+ * only adds it if it is not.
11
+ *
12
+ * Writes the updated config to the file system by appending strings, not stringify-ing the toml.
13
+ */
14
+ export declare const updateTomlConfig: (packageName: string) => void;
15
+ export declare const updateTomlConfigTask: (packageName: string) => {
16
+ title: string;
17
+ task: () => void;
18
+ };
19
+ export declare const addEnvVarTask: (name: string, value: string, comment: string) => {
20
+ title: string;
21
+ task: () => void;
22
+ };
23
+ export declare const addEnvVar: (name: string, value: string, comment: string) => string | void;
24
+ /**
25
+ * This sets the `RWJS_CWD` env var to the redwood project directory. This is typically required for internal
26
+ * redwood packages to work correctly. For example, `@cedarjs/project-config` uses this when reading config
27
+ * or paths.
28
+ *
29
+ * @param cwd Explicitly set the redwood cwd. If not set, we'll try to determine it automatically. You likely
30
+ * only want to set this based on some specific input, like a CLI flag.
31
+ */
32
+ export declare const setRedwoodCWD: (cwd?: string) => void;
33
+ /**
34
+ * Create or update the given setting, in the given section, with the given value.
35
+ *
36
+ * If the section already exists it adds the new setting last
37
+ * If the section, and the setting, already exists, the setting is updated
38
+ * If the section does not exist it is created at the end of the file and the setting is added
39
+ * If the setting exists in the section, but is commented out, it will be uncommented and updated
40
+ */
41
+ export declare function setTomlSetting(section: keyof Config, setting: string, value: string | boolean | number): void;
42
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +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,qBAE1B,CAAA;AAED,eAAO,MAAM,sBAAsB,2BAGlC,CAAA;AAED,eAAO,MAAM,mBAAmB,eAM/B,CAAA;AAED,eAAO,MAAM,0BAA0B,WAQtC,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,aAAa,MAAM,SAmDnD,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM;;;CAOvD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,SAAS,MAAM;;;CAOzE,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,SAAS,MAAM,kBAqCrE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,SAyBzC,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,QA0HjC"}