@cedarjs/cli 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 (65) hide show
  1. package/dist/cfw.js +2 -2
  2. package/dist/commands/buildHandler.js +1 -1
  3. package/dist/commands/consoleHandler.js +1 -1
  4. package/dist/commands/deploy/baremetal/baremetalHandler.js +2 -2
  5. package/dist/commands/deploy/flightcontrolHandler.js +7 -7
  6. package/dist/commands/deploy/packing/nft.js +12 -7
  7. package/dist/commands/deploy/renderHandler.js +4 -4
  8. package/dist/commands/deploy/serverlessHandler.js +2 -2
  9. package/dist/commands/dev.js +2 -1
  10. package/dist/commands/devHandler.js +28 -19
  11. package/dist/commands/experimental/setupOpentelemetryHandler.js +2 -2
  12. package/dist/commands/experimental/setupReactCompilerHandler.js +6 -3
  13. package/dist/commands/experimental/setupRscHandler.js +2 -2
  14. package/dist/commands/experimental/setupStreamingSsrHandler.js +3 -3
  15. package/dist/commands/experimental/util.js +2 -2
  16. package/dist/commands/generate/dataMigration/dataMigration.js +2 -2
  17. package/dist/commands/generate/dbAuth/dbAuthHandler.js +2 -2
  18. package/dist/commands/generate/scaffold/scaffoldHandler.js +1 -1
  19. package/dist/commands/prerenderHandler.js +1 -1
  20. package/dist/commands/prismaHandler.js +1 -1
  21. package/dist/commands/serve.js +1 -1
  22. package/dist/commands/setup/auth/auth.js +4 -4
  23. package/dist/commands/setup/cache/cacheHandler.js +1 -1
  24. package/dist/commands/setup/deploy/helpers/index.js +1 -1
  25. package/dist/commands/setup/deploy/providers/coherenceHandler.js +1 -1
  26. package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +1 -1
  27. package/dist/commands/setup/deploy/providers/renderHandler.js +1 -1
  28. package/dist/commands/setup/deploy/providers/serverlessHandler.js +3 -4
  29. package/dist/commands/setup/deploy/templates/serverless/api.js +1 -1
  30. package/dist/commands/setup/docker/dockerHandler.js +12 -6
  31. package/dist/commands/setup/generator/generator.js +1 -1
  32. package/dist/commands/setup/generator/generatorHandler.js +2 -2
  33. package/dist/commands/setup/i18n/i18nHandler.js +1 -1
  34. package/dist/commands/setup/mailer/mailer.js +1 -1
  35. package/dist/commands/setup/mailer/mailerHandler.js +6 -4
  36. package/dist/commands/setup/middleware/ogImage/ogImageHandler.js +4 -2
  37. package/dist/commands/setup/monitoring/sentry/sentryHandler.js +1 -1
  38. package/dist/commands/setup/realtime/realtimeHandler.js +1 -1
  39. package/dist/commands/setup/server-file/serverFileHandler.js +1 -1
  40. package/dist/commands/setup/ui/libraries/mantineHandler.js +12 -11
  41. package/dist/commands/setup/uploads/uploadsHandler.js +1 -1
  42. package/dist/commands/setup/vite/viteHandler.js +1 -1
  43. package/dist/commands/studioHandler.js +3 -3
  44. package/dist/commands/testHandler.js +1 -1
  45. package/dist/commands/upgrade.js +51 -35
  46. package/dist/index.js +1 -1
  47. package/dist/lib/background.js +2 -2
  48. package/dist/lib/configureStorybook.js +1 -1
  49. package/dist/lib/extendFile.js +1 -1
  50. package/dist/lib/generatePrismaClient.js +1 -1
  51. package/dist/lib/index.js +1 -1
  52. package/dist/lib/locking.js +7 -3
  53. package/dist/lib/packages.js +3 -3
  54. package/dist/lib/plugin.js +1 -1
  55. package/dist/lib/ports.js +1 -1
  56. package/dist/lib/project.js +1 -1
  57. package/dist/lib/rollback.js +1 -1
  58. package/dist/lib/test.js +1 -1
  59. package/dist/lib/updateCheck.js +16 -8
  60. package/dist/telemetry/exporter.js +2 -2
  61. package/dist/telemetry/resource.js +3 -2
  62. package/dist/telemetry/send.js +7 -4
  63. package/dist/testLib/cells.js +1 -1
  64. package/dist/testLib/getRootPackageJSON.js +1 -1
  65. package/package.json +14 -15
package/dist/cfw.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import path from "path";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
3
4
  import Configstore from "configstore";
4
5
  import execa from "execa";
5
- import fs from "fs-extra";
6
6
  import { terminalLink } from "termi-link";
7
7
  import { getConfigPath } from "@cedarjs/project-config";
8
8
  const config = new Configstore("@cedarjs/cli");
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import { createRequire } from "node:module";
2
3
  import path from "node:path";
3
4
  import execa from "execa";
4
- import fs from "fs-extra";
5
5
  import { Listr } from "listr2";
6
6
  import { terminalLink } from "termi-link";
7
7
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import { createRequire } from "node:module";
2
3
  import path from "node:path";
3
4
  import repl from "node:repl";
4
- import fs from "fs-extra";
5
5
  import { registerApiSideBabelHook } from "@cedarjs/babel-config";
6
6
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
7
7
  import { getPaths } from "../lib/index.js";
@@ -1,6 +1,6 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import boxen from "boxen";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import * as toml from "smol-toml";
6
6
  import { env as envInterpolation } from "string-env-interpolation";
@@ -1,6 +1,6 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import execa from "execa";
3
- import fs from "fs-extra";
4
4
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
5
5
  import { getPaths } from "@cedarjs/project-config";
6
6
  const handler = async ({
@@ -16,9 +16,9 @@ const handler = async ({
16
16
  dataMigrate,
17
17
  serve
18
18
  });
19
- const rwjsPaths = getPaths();
19
+ const cedarPaths = getPaths();
20
20
  const execaConfig = {
21
- cwd: rwjsPaths.base,
21
+ cwd: cedarPaths.base,
22
22
  shell: true,
23
23
  stdio: "inherit"
24
24
  };
@@ -36,7 +36,7 @@ const handler = async ({
36
36
  if (prisma) {
37
37
  console.log("Running database migrations...");
38
38
  await runExecaCommand(
39
- `node_modules/.bin/prisma migrate deploy --config "${rwjsPaths.api.prismaConfig}"`
39
+ `node_modules/.bin/prisma migrate deploy --config "${cedarPaths.api.prismaConfig}"`
40
40
  );
41
41
  }
42
42
  if (dataMigrate) {
@@ -45,8 +45,8 @@ const handler = async ({
45
45
  }
46
46
  return;
47
47
  }
48
- const serverFilePath = path.join(rwjsPaths.api.dist, "server.js");
49
- const hasServerFile = fs.pathExistsSync(serverFilePath);
48
+ const serverFilePath = path.join(cedarPaths.api.dist, "server.js");
49
+ const hasServerFile = fs.existsSync(serverFilePath);
50
50
  if (hasServerFile) {
51
51
  execa(`yarn node ${serverFilePath}`, execaConfig);
52
52
  } else {
@@ -1,14 +1,14 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import { nodeFileTrace } from "@vercel/nft";
3
4
  import archiver from "archiver";
4
- import fse from "fs-extra";
5
5
  import { findApiDistFunctions } from "@cedarjs/internal/dist/files";
6
6
  import { ensurePosixPath, getPaths } from "@cedarjs/project-config";
7
7
  import * as nftPacker from "../packing/nft.js";
8
8
  const ZIPBALL_DIR = "./api/dist/zipball";
9
9
  function zipDirectory(source, out) {
10
10
  const archive = archiver("zip", { zlib: { level: 5 } });
11
- const stream = fse.createWriteStream(out);
11
+ const stream = fs.createWriteStream(out);
12
12
  return new Promise((resolve, reject) => {
13
13
  archive.directory(source, false).on("error", (err) => reject(err)).pipe(stream);
14
14
  stream.on("close", () => resolve());
@@ -32,21 +32,26 @@ async function packageSingleFunction(functionFile) {
32
32
  const copyPromises = [];
33
33
  for (const singleDependencyPath of functionDependencyFileList) {
34
34
  copyPromises.push(
35
- fse.copy(
35
+ fs.promises.cp(
36
36
  "./" + singleDependencyPath,
37
- `${ZIPBALL_DIR}/${functionName}/${singleDependencyPath}`
37
+ `${ZIPBALL_DIR}/${functionName}/${singleDependencyPath}`,
38
+ { recursive: true, force: true }
38
39
  )
39
40
  );
40
41
  }
41
42
  const [entryFilePath, content] = generateEntryFile(functionFile, functionName);
42
- const functionEntryPromise = fse.outputFile(entryFilePath, content);
43
+ const dir = path.dirname(entryFilePath);
44
+ const functionEntryPromise = fs.promises.mkdir(dir, { recursive: true }).then(() => fs.promises.writeFile(entryFilePath, content));
43
45
  copyPromises.push(functionEntryPromise);
44
46
  await Promise.all(copyPromises);
45
47
  await zipDirectory(
46
48
  `${ZIPBALL_DIR}/${functionName}`,
47
49
  `${ZIPBALL_DIR}/${functionName}.zip`
48
50
  );
49
- await fse.remove(`${ZIPBALL_DIR}/${functionName}`);
51
+ await fs.promises.rm(`${ZIPBALL_DIR}/${functionName}`, {
52
+ recursive: true,
53
+ force: true
54
+ });
50
55
  return;
51
56
  }
52
57
  function nftPack() {
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import execa from "execa";
3
- import fs from "fs-extra";
4
4
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
5
5
  import { getPaths } from "@cedarjs/project-config";
6
6
  const handler = async ({ side, prisma, dataMigrate }) => {
@@ -26,8 +26,8 @@ const handler = async ({ side, prisma, dataMigrate }) => {
26
26
  }
27
27
  if (dataMigrate) {
28
28
  console.log("Running data migrations...");
29
- const packageJson = fs.readJsonSync(
30
- path.join(cedarPaths.base, "package.json")
29
+ const packageJson = JSON.parse(
30
+ fs.readFileSync(path.join(cedarPaths.base, "package.json"), "utf-8")
31
31
  );
32
32
  const hasDataMigratePackage = !!packageJson.devDependencies["@cedarjs/cli-data-migrate"];
33
33
  if (!hasDataMigratePackage) {
@@ -47,7 +47,7 @@ const handler = async ({ side, prisma, dataMigrate }) => {
47
47
  }
48
48
  }
49
49
  const serverFilePath = path.join(cedarPaths.api.dist, "server.js");
50
- const hasServerFile = fs.pathExistsSync(serverFilePath);
50
+ const hasServerFile = fs.existsSync(serverFilePath);
51
51
  if (hasServerFile) {
52
52
  execa(`yarn node ${serverFilePath}`, execaConfig);
53
53
  } else {
@@ -1,9 +1,9 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import ansis from "ansis";
3
4
  import boxen from "boxen";
4
5
  import { config } from "dotenv-defaults";
5
6
  import execa from "execa";
6
- import fs from "fs-extra";
7
7
  import { Listr } from "listr2";
8
8
  import prompts from "prompts";
9
9
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
@@ -8,7 +8,8 @@ const builder = (yargs) => {
8
8
  choices: ["api", "web"],
9
9
  default: ["api", "web"],
10
10
  description: "Which dev server(s) to start",
11
- type: "array"
11
+ type: "string",
12
+ array: true
12
13
  }).option("forward", {
13
14
  alias: "fwd",
14
15
  description: 'String of one or more vite dev server config options, for example: `--fwd="--port=1234 --open=false"`',
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
3
  import { argv } from "node:process";
3
4
  import concurrently from "concurrently";
4
- import fs from "fs-extra";
5
5
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
6
6
  import { shutdownPort } from "@cedarjs/internal/dist/dev";
7
7
  import { getConfig, getConfigPath } from "@cedarjs/project-config";
@@ -26,8 +26,10 @@ const handler = async ({
26
26
  });
27
27
  const rwjsPaths = getPaths();
28
28
  const serverFile = serverFileExists();
29
- let apiPreferredPort = parseInt(getConfig().api.port);
30
- let webPreferredPort = parseInt(getConfig().web.port);
29
+ const apiPreferredPort = parseInt(String(getConfig().api.port));
30
+ let webPreferredPort = parseInt(
31
+ String(getConfig().web.port)
32
+ );
31
33
  let apiAvailablePort = apiPreferredPort;
32
34
  let apiPortChangeNeeded = false;
33
35
  let webAvailablePort = webPreferredPort;
@@ -46,7 +48,8 @@ const handler = async ({
46
48
  ...forward.matchAll(/\-\-port(\=|\s)(?<port>[^\s]*)/g)
47
49
  ];
48
50
  if (forwardedPortMatches.length) {
49
- webPreferredPort = parseInt(forwardedPortMatches.pop().groups.port);
51
+ const port = forwardedPortMatches.pop()?.groups?.port;
52
+ webPreferredPort = port ? parseInt(port, 10) : void 0;
50
53
  }
51
54
  webAvailablePort = await getFreePort(webPreferredPort, [
52
55
  apiPreferredPort,
@@ -84,19 +87,18 @@ const handler = async ({
84
87
  force: false
85
88
  });
86
89
  } catch (e) {
87
- errorTelemetry(
88
- process.argv,
89
- `Error generating prisma client: ${e.message}`
90
- );
91
- console.error(c.error(e.message));
90
+ const message = e instanceof Object && "message" in e ? e.message : String(e);
91
+ errorTelemetry(process.argv, `Error generating prisma client: ${message}`);
92
+ console.error(c.error(message));
92
93
  }
93
94
  if (!serverFile) {
94
95
  try {
95
96
  await shutdownPort(apiAvailablePort);
96
97
  } catch (e) {
97
- errorTelemetry(process.argv, `Error shutting down "api": ${e.message}`);
98
+ const message = e instanceof Object && "message" in e ? e.message : String(e);
99
+ errorTelemetry(process.argv, `Error shutting down "api": ${message}`);
98
100
  console.error(
99
- `Error whilst shutting down "api" port: ${c.error(e.message)}`
101
+ `Error whilst shutting down "api" port: ${c.error(message)}`
100
102
  );
101
103
  }
102
104
  }
@@ -105,9 +107,10 @@ const handler = async ({
105
107
  try {
106
108
  await shutdownPort(webAvailablePort);
107
109
  } catch (e) {
108
- errorTelemetry(process.argv, `Error shutting down "web": ${e.message}`);
110
+ const message = e instanceof Object && "message" in e ? e.message : String(e);
111
+ errorTelemetry(process.argv, `Error shutting down "web": ${message}`);
109
112
  console.error(
110
- `Error whilst shutting down "web" port: ${c.error(e.message)}`
113
+ `Error whilst shutting down "web" port: ${c.error(message)}`
111
114
  );
112
115
  }
113
116
  }
@@ -168,12 +171,18 @@ const handler = async ({
168
171
  runWhen: () => generate
169
172
  }
170
173
  };
174
+ const mappedJobs = Object.keys(jobs).map((job) => {
175
+ if (side.includes(job) || job === "gen") {
176
+ return jobs[job];
177
+ }
178
+ return {
179
+ name: "",
180
+ command: "",
181
+ runWhen: () => false
182
+ };
183
+ });
171
184
  const { result } = concurrently(
172
- Object.keys(jobs).map((job) => {
173
- if (side.includes(job) || job === "gen") {
174
- return jobs[job];
175
- }
176
- }).filter((job) => job && job.runWhen()),
185
+ mappedJobs.filter((job) => job.runWhen()),
177
186
  {
178
187
  prefix: "{name} |",
179
188
  timestampFormat: "HH:mm:ss",
@@ -181,7 +190,7 @@ const handler = async ({
181
190
  }
182
191
  );
183
192
  result.catch((e) => {
184
- if (typeof e?.message !== "undefined") {
193
+ if (e?.message) {
185
194
  errorTelemetry(
186
195
  process.argv,
187
196
  `Error concurrently starting sides: ${e.message}`
@@ -1,7 +1,7 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
3
4
  import execa from "execa";
4
- import fs from "fs-extra";
5
5
  import { Listr } from "listr2";
6
6
  import { addApiPackages } from "@cedarjs/cli-helpers";
7
7
  import {
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
3
  import execa from "execa";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import semver from "semver";
6
6
  import { getConfigPath } from "@cedarjs/project-config";
@@ -28,8 +28,11 @@ const handler = async ({ force, verbose }) => {
28
28
  "Vite needs to be setup before you can enable React Compiler"
29
29
  );
30
30
  }
31
- const webPkgJson = fs.readJSONSync(
32
- path.join(rwPaths.web.base, "package.json")
31
+ const webPkgJson = JSON.parse(
32
+ fs.readFileSync(
33
+ path.join(rwPaths.web.base, "package.json"),
34
+ "utf8"
35
+ )
33
36
  );
34
37
  const reactVersion = webPkgJson["dependencies"]["react"];
35
38
  const coercedReactVersion = semver.coerce(reactVersion);
@@ -1,6 +1,6 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import execa from "execa";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { prettify } from "@cedarjs/cli-helpers";
6
6
  import { getConfig, getConfigPath } from "@cedarjs/project-config";
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { addWebPackages } from "@cedarjs/cli-helpers";
6
6
  import { getConfigPath } from "@cedarjs/project-config";
@@ -176,11 +176,11 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
176
176
  title: 'Adding resolution for "@apollo/client-react-streaming/superjson"',
177
177
  task: () => {
178
178
  const pkgJsonPath = path.join(rwPaths.base, "package.json");
179
- const pkgJson = fs.readJsonSync(pkgJsonPath);
179
+ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
180
180
  const resolutions = pkgJson.resolutions || {};
181
181
  resolutions["@apollo/client-react-streaming/superjson"] = "^1.12.2";
182
182
  pkgJson.resolutions = resolutions;
183
- fs.writeJsonSync(pkgJsonPath, pkgJson, { spaces: 2 });
183
+ fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
184
184
  }
185
185
  },
186
186
  addWebPackages(["@apollo/client-react-streaming@0.10.0"]),
@@ -1,6 +1,6 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import ansis from "ansis";
3
- import fs from "fs-extra";
4
4
  import { terminalLink } from "termi-link";
5
5
  import { getPaths } from "../../lib/index.js";
6
6
  import { isTypeScriptProject, serverFileExists } from "../../lib/project.js";
@@ -1,6 +1,6 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import { paramCase } from "change-case";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { terminalLink } from "termi-link";
6
6
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
@@ -1,8 +1,8 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
3
4
  import { camelCase } from "camel-case";
4
5
  import execa from "execa";
5
- import fs from "fs-extra";
6
6
  import { Listr } from "listr2";
7
7
  import { titleCase } from "title-case";
8
8
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
@@ -1,8 +1,8 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import camelcase from "camelcase";
3
4
  import { paramCase } from "change-case";
4
5
  import execa from "execa";
5
- import fs from "fs-extra";
6
6
  import humanize from "humanize-string";
7
7
  import { Listr } from "listr2";
8
8
  import pascalcase from "pascalcase";
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
- import fs from "fs-extra";
3
3
  import { Listr } from "listr2";
4
4
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
5
5
  import { getConfig, getPaths, projectIsEsm } from "@cedarjs/project-config";
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import boxen from "boxen";
3
4
  import execa from "execa";
4
- import fs from "fs-extra";
5
5
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
6
6
  import { errorTelemetry } from "@cedarjs/telemetry";
7
7
  import c from "../lib/colors.js";
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
- import fs from "fs-extra";
3
3
  import { terminalLink } from "termi-link";
4
4
  import * as apiServerCLIConfig from "@cedarjs/api-server/apiCliConfig";
5
5
  import * as bothServerCLIConfig from "@cedarjs/api-server/bothCliConfig";
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
3
  import execa from "execa";
3
- import fs from "fs-extra";
4
4
  import { terminalLink } from "termi-link";
5
5
  import {
6
6
  recordTelemetryAttributes,
@@ -202,7 +202,7 @@ async function getAuthSetupHandler(module) {
202
202
  customRequire = require;
203
203
  }
204
204
  const packageJsonPath = customRequire.resolve("@cedarjs/cli/package.json");
205
- let { version } = fs.readJSONSync(packageJsonPath);
205
+ let { version } = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
206
206
  if (!isInstalled(module)) {
207
207
  if (version.includes("+")) {
208
208
  version = version.split("+")[0];
@@ -234,8 +234,8 @@ async function getAuthSetupHandler(module) {
234
234
  return setupModule.default.handler;
235
235
  }
236
236
  function isInstalled(module) {
237
- const { dependencies, devDependencies } = fs.readJSONSync(
238
- path.join(getPaths().base, "package.json")
237
+ const { dependencies, devDependencies } = JSON.parse(
238
+ fs.readFileSync(path.join(getPaths().base, "package.json"), "utf8")
239
239
  );
240
240
  const deps = {
241
241
  ...dependencies,
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
- import fs from "fs-extra";
3
3
  import { Listr } from "listr2";
4
4
  import { addEnvVarTask } from "@cedarjs/cli-helpers";
5
5
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import execa from "execa";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { getPaths, writeFilesTask } from "../../../../lib/index.js";
6
6
  const REDWOOD_TOML_PATH = path.join(getPaths().base, "redwood.toml");
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import prismaInternals from "@prisma/internals";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import * as toml from "smol-toml";
6
6
  import {
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import { EOL } from "os";
2
3
  import path from "path";
3
4
  import prismaInternals from "@prisma/internals";
4
- import fs from "fs-extra";
5
5
  import { Listr } from "listr2";
6
6
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
7
7
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import prismaInternals from "@prisma/internals";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
6
6
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -1,5 +1,5 @@
1
- import path from "path";
2
- import fs from "fs-extra";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
3
  import { Listr } from "listr2";
4
4
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
5
5
  import { getSchemaPath } from "@cedarjs/project-config";
@@ -44,8 +44,7 @@ const projectDevPackages = [
44
44
  "serverless",
45
45
  "serverless-lift",
46
46
  "@vercel/nft",
47
- "archiver",
48
- "fs-extra"
47
+ "archiver"
49
48
  ];
50
49
  const files = [
51
50
  {
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
- import fs from "fs-extra";
3
3
  import { getPaths } from "../../../../../lib/index.js";
4
4
  const PROJECT_NAME = path.basename(getPaths().base);
5
5
  const SERVERLESS_API_YML = `# See the full yml reference at https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import { createRequire } from "node:module";
2
3
  import path from "node:path";
3
4
  import execa from "execa";
4
- import fs from "fs-extra";
5
5
  import { Listr } from "listr2";
6
6
  import { writeFile } from "@cedarjs/cli-helpers";
7
7
  import { getConfig, getConfigPath, getPaths } from "@cedarjs/project-config";
@@ -59,13 +59,19 @@ async function handler({ force }) {
59
59
  title: "Adding @cedarjs/api-server and @cedarjs/web-server...",
60
60
  task: async (_ctx, task) => {
61
61
  const apiServerPackageName = "@cedarjs/api-server";
62
- const { dependencies: apiDependencies } = fs.readJSONSync(
63
- path.join(getPaths().api.base, "package.json")
62
+ const { dependencies: apiDependencies } = JSON.parse(
63
+ fs.readFileSync(
64
+ path.join(getPaths().api.base, "package.json"),
65
+ "utf-8"
66
+ )
64
67
  );
65
68
  const hasApiServerPackage = Object.keys(apiDependencies).includes(apiServerPackageName);
66
69
  const webServerPackageName = "@cedarjs/web-server";
67
- const { dependencies: webDependencies } = fs.readJSONSync(
68
- path.join(getPaths().web.base, "package.json")
70
+ const { dependencies: webDependencies } = JSON.parse(
71
+ fs.readFileSync(
72
+ path.join(getPaths().web.base, "package.json"),
73
+ "utf-8"
74
+ )
69
75
  );
70
76
  const hasWebServerPackage = Object.keys(webDependencies).includes(webServerPackageName);
71
77
  if (hasApiServerPackage && hasWebServerPackage) {
@@ -247,7 +253,7 @@ async function getVersionOfRedwoodPackageToInstall(module) {
247
253
  const packageJsonPath = createdRequire.resolve("@cedarjs/cli/package.json", {
248
254
  paths: [getPaths().base]
249
255
  });
250
- let { version } = fs.readJSONSync(packageJsonPath);
256
+ let { version } = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
251
257
  const packumentP = await fetch(`https://registry.npmjs.org/${module}`);
252
258
  const packument = await packumentP.json();
253
259
  if (version.includes("+")) {
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
- import fs from "fs-extra";
3
3
  import { terminalLink } from "termi-link";
4
4
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
5
5
  const command = "generator <name>";
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
- import fse from "fs-extra";
3
3
  import { Listr } from "listr2";
4
4
  import c from "../../../lib/colors.js";
5
5
  import { getPaths } from "../../../lib/index.js";
@@ -16,7 +16,7 @@ const copyGenerator = (name, { force }) => {
16
16
  "templates"
17
17
  );
18
18
  const to = path.join(getPaths()[side].generators, name);
19
- fse.copySync(from, to, { overwrite: force, errorOnExist: true });
19
+ fs.cpSync(from, to, { recursive: true, force });
20
20
  return to;
21
21
  };
22
22
  let destination;
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import execa from "execa";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { errorTelemetry } from "@cedarjs/telemetry";
6
6
  import c from "../../../lib/colors.js";
@@ -1,6 +1,6 @@
1
1
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  const command = "mailer";
3
- const description = "Setup the redwood mailer. This will install the required packages and add the required initial configuration to your redwood app.";
3
+ const description = "Setup the Cedar mailer. This will install the required packages and add the required initial configuration to your Cedar app.";
4
4
  const builder = (yargs) => {
5
5
  yargs.option("force", {
6
6
  alias: "f",
@@ -1,5 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
- import fs from "fs-extra";
3
+ import { pathToFileURL } from "node:url";
3
4
  import { Listr } from "listr2";
4
5
  import { addApiPackages } from "@cedarjs/cli-helpers";
5
6
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -9,14 +10,15 @@ import { isTypeScriptProject } from "../../../lib/project.js";
9
10
  const handler = async ({ force, skipExamples }) => {
10
11
  const projectIsTypescript = isTypeScriptProject();
11
12
  const pkgJsonPath = path.join(getPaths().base, "package.json");
12
- const { default: pkgJson } = await import(pkgJsonPath, {
13
+ const { default: pkgJson } = await import(pathToFileURL(pkgJsonPath), {
13
14
  with: { type: "json" }
14
15
  });
15
16
  const cedarVersion = pkgJson.devDependencies["@cedarjs/core"] ?? "latest";
17
+ const extension = projectIsTypescript ? "ts" : "js";
16
18
  const tasks = new Listr(
17
19
  [
18
20
  {
19
- title: `Adding api/src/lib/mailer.${projectIsTypescript ? "ts" : "js"}...`,
21
+ title: `Adding api/src/lib/mailer.${extension}...`,
20
22
  task: async () => {
21
23
  const templatePath = path.resolve(
22
24
  import.meta.dirname,
@@ -29,7 +31,7 @@ const handler = async ({ force, skipExamples }) => {
29
31
  });
30
32
  const mailerPath = path.join(
31
33
  getPaths().api.lib,
32
- `mailer.${projectIsTypescript ? "ts" : "js"}`
34
+ `mailer.${extension}`
33
35
  );
34
36
  const mailerContent = projectIsTypescript ? templateContent : await transformTSToJS(mailerPath, templateContent);
35
37
  return writeFile(mailerPath, mailerContent, {