@cedarjs/cli 1.0.0-canary.13052 → 1.0.0-canary.13054

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 (64) 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 +3 -3
  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/devHandler.js +1 -1
  10. package/dist/commands/experimental/setupOpentelemetryHandler.js +2 -2
  11. package/dist/commands/experimental/setupReactCompilerHandler.js +6 -3
  12. package/dist/commands/experimental/setupRscHandler.js +2 -2
  13. package/dist/commands/experimental/setupStreamingSsrHandler.js +3 -3
  14. package/dist/commands/experimental/util.js +2 -2
  15. package/dist/commands/generate/dataMigration/dataMigration.js +2 -2
  16. package/dist/commands/generate/dbAuth/dbAuthHandler.js +2 -2
  17. package/dist/commands/generate/scaffold/scaffoldHandler.js +1 -1
  18. package/dist/commands/generate/script/scriptHandler.js +15 -14
  19. package/dist/commands/generate/yargsHandlerHelpers.js +2 -1
  20. package/dist/commands/prerenderHandler.js +1 -1
  21. package/dist/commands/prismaHandler.js +1 -1
  22. package/dist/commands/serve.js +1 -1
  23. package/dist/commands/setup/auth/auth.js +4 -4
  24. package/dist/commands/setup/cache/cacheHandler.js +1 -1
  25. package/dist/commands/setup/deploy/helpers/index.js +1 -1
  26. package/dist/commands/setup/deploy/providers/coherenceHandler.js +1 -1
  27. package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +1 -1
  28. package/dist/commands/setup/deploy/providers/renderHandler.js +1 -1
  29. package/dist/commands/setup/deploy/providers/serverlessHandler.js +3 -4
  30. package/dist/commands/setup/deploy/templates/serverless/api.js +1 -1
  31. package/dist/commands/setup/docker/dockerHandler.js +12 -6
  32. package/dist/commands/setup/generator/generator.js +2 -8
  33. package/dist/commands/setup/generator/generatorHandler.js +9 -5
  34. package/dist/commands/setup/i18n/i18nHandler.js +1 -1
  35. package/dist/commands/setup/mailer/mailerHandler.js +1 -1
  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 +20 -15
  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 +1 -1
  53. package/dist/lib/packages.js +3 -3
  54. package/dist/lib/plugin.js +1 -1
  55. package/dist/lib/project.js +1 -1
  56. package/dist/lib/rollback.js +1 -1
  57. package/dist/lib/test.js +2 -3
  58. package/dist/lib/updateCheck.js +1 -1
  59. package/dist/telemetry/exporter.js +2 -2
  60. package/dist/telemetry/resource.js +3 -2
  61. package/dist/telemetry/send.js +7 -4
  62. package/dist/testLib/cells.js +1 -1
  63. package/dist/testLib/getRootPackageJSON.js +1 -1
  64. package/package.json +11 -12
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 ({
@@ -46,7 +46,7 @@ const handler = async ({
46
46
  return;
47
47
  }
48
48
  const serverFilePath = path.join(cedarPaths.api.dist, "server.js");
49
- const hasServerFile = fs.pathExistsSync(serverFilePath);
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";
@@ -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";
@@ -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 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 { errorTelemetry } from "@cedarjs/telemetry";
@@ -11,26 +11,27 @@ import {
11
11
  } from "../../../lib/index.js";
12
12
  import { prepareForRollback } from "../../../lib/rollback.js";
13
13
  import { validateName } from "../helpers.js";
14
- const TEMPLATE_PATH = path.resolve(
15
- import.meta.dirname,
16
- "templates",
17
- "script.ts.template"
18
- );
19
- const TSCONFIG_TEMPLATE = path.resolve(
20
- import.meta.dirname,
21
- "templates",
22
- "tsconfig.json.template"
23
- );
14
+ import { customOrDefaultTemplatePath } from "../yargsHandlerHelpers.js";
24
15
  const files = async ({ name, typescript = false }) => {
25
16
  const outputFilename = `${name}.${typescript ? "ts" : "js"}`;
26
17
  const outputPath = path.join(getPaths().scripts, outputFilename);
27
18
  const scriptTsConfigPath = path.join(getPaths().scripts, "tsconfig.json");
28
- const template = fs.readFileSync(TEMPLATE_PATH, "utf-8");
19
+ const templatePath = customOrDefaultTemplatePath({
20
+ side: "scripts",
21
+ generator: "script",
22
+ templatePath: "script.ts.template"
23
+ });
24
+ const template = fs.readFileSync(templatePath, "utf-8");
25
+ const tsconfigTemplatePath = customOrDefaultTemplatePath({
26
+ side: "scripts",
27
+ generator: "script",
28
+ templatePath: "tsconfig.json.template"
29
+ });
29
30
  return {
30
31
  [outputPath]: typescript ? template : await transformTSToJS(outputPath, template),
31
32
  // Add tsconfig for type and cmd+click support if project is TS
32
33
  ...typescript && !fs.existsSync(scriptTsConfigPath) && {
33
- [scriptTsConfigPath]: fs.readFileSync(TSCONFIG_TEMPLATE, "utf-8")
34
+ [scriptTsConfigPath]: fs.readFileSync(tsconfigTemplatePath, "utf-8")
34
35
  }
35
36
  };
36
37
  };
@@ -26,7 +26,8 @@ const customOrDefaultTemplatePath = ({
26
26
  templatePath
27
27
  );
28
28
  const customPath = path.join(
29
- getPaths()[side].generators,
29
+ getPaths().generatorTemplates,
30
+ side,
30
31
  generator,
31
32
  templatePath
32
33
  );
@@ -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,16 +1,10 @@
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>";
6
6
  const description = "Copies generator templates locally for customization";
7
- const EXCLUDE_GENERATORS = [
8
- "dataMigration",
9
- "dbAuth",
10
- "generator",
11
- "script",
12
- "secret"
13
- ];
7
+ const EXCLUDE_GENERATORS = ["dataMigration", "dbAuth", "generator", "secret"];
14
8
  const builder = (yargs) => {
15
9
  const availableGenerators = fs.readdirSync(path.join(import.meta.dirname, "../../generate"), {
16
10
  withFileTypes: true
@@ -1,22 +1,26 @@
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";
6
6
  const SIDE_MAP = {
7
7
  web: ["cell", "component", "layout", "page", "scaffold"],
8
- api: ["function", "sdl", "service"]
8
+ api: ["function", "sdl", "service"],
9
+ scripts: ["script"]
9
10
  };
10
11
  const copyGenerator = (name, { force }) => {
11
- const side = SIDE_MAP["web"].includes(name) ? "web" : "api";
12
+ const side = Object.keys(SIDE_MAP).find((key) => SIDE_MAP[key].includes(name));
13
+ if (!side) {
14
+ throw new Error(`Invalid generator name: ${name}`);
15
+ }
12
16
  const from = path.join(
13
17
  import.meta.dirname,
14
18
  "../../generate",
15
19
  name,
16
20
  "templates"
17
21
  );
18
- const to = path.join(getPaths()[side].generators, name);
19
- fse.copySync(from, to, { overwrite: force, errorOnExist: true });
22
+ const to = path.join(getPaths().generatorTemplates, side, name);
23
+ fs.cpSync(from, to, { recursive: true, force });
20
24
  return to;
21
25
  };
22
26
  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
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
3
  import { pathToFileURL } from "node:url";
3
- import fs from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { addApiPackages } from "@cedarjs/cli-helpers";
6
6
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
- import fs from "fs-extra";
3
3
  import { Listr } from "listr2";
4
4
  import { format } from "prettier";
5
5
  import { addWebPackages, getPrettierOptions } from "@cedarjs/cli-helpers";
@@ -7,7 +7,9 @@ import { getConfig, getPaths } from "@cedarjs/project-config";
7
7
  import { runTransform } from "../../../../lib/runTransform.js";
8
8
  async function handler({ force }) {
9
9
  const rwPaths = getPaths();
10
- const rootPkgJson = fs.readJSONSync(path.join(rwPaths.base, "package.json"));
10
+ const rootPkgJson = JSON.parse(
11
+ fs.readFileSync(path.join(rwPaths.base, "package.json"), "utf8")
12
+ );
11
13
  const currentProjectVersion = rootPkgJson.devDependencies["@cedarjs/core"];
12
14
  const notes = [""];
13
15
  const tasks = new Listr(
@@ -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 {
5
5
  addApiPackages,
@@ -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 { addApiPackages } from "@cedarjs/cli-helpers";
5
5
  import { generate as generateTypes } from "@cedarjs/internal/dist/generate/generate";
@@ -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 { addApiPackages } from "@cedarjs/cli-helpers";
5
5
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -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 fse from "fs-extra";
4
4
  import { Listr } from "listr2";
5
5
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
6
6
  import c from "../../../../lib/colors.js";
@@ -38,8 +38,8 @@ async function handler({ force, install, packages }) {
38
38
  install,
39
39
  packages
40
40
  });
41
- const rwPaths = getPaths();
42
- const configFilePath = path.join(rwPaths.web.config, "mantine.config.js");
41
+ const cedarPaths = getPaths();
42
+ const configFilePath = path.join(cedarPaths.web.config, "mantine.config.js");
43
43
  const installPackages = (packages.includes(ALL_KEYWORD) ? ALL_MANTINE_PACKAGES : packages).map((pack) => `@mantine/${pack}`).concat("postcss", "postcss-preset-mantine", "postcss-simple-vars");
44
44
  const tasks = new Listr(
45
45
  [
@@ -69,8 +69,8 @@ async function handler({ force, install, packages }) {
69
69
  },
70
70
  {
71
71
  title: "Setting up Mantine...",
72
- skip: () => fileIncludes(rwPaths.web.app, "MantineProvider"),
73
- task: () => extendJSXFile(rwPaths.web.app, {
72
+ skip: () => fileIncludes(cedarPaths.web.app, "MantineProvider"),
73
+ task: () => extendJSXFile(cedarPaths.web.app, {
74
74
  insertComponent: {
75
75
  name: "MantineProvider",
76
76
  props: { theme: "theme" },
@@ -86,20 +86,21 @@ async function handler({ force, install, packages }) {
86
86
  {
87
87
  title: "Configuring PostCSS...",
88
88
  task: () => {
89
- const postCSSConfigPath = rwPaths.web.postcss;
90
- if (!force && fse.existsSync(postCSSConfigPath)) {
89
+ const postCSSConfigPath = cedarPaths.web.postcss;
90
+ if (!force && fs.existsSync(postCSSConfigPath)) {
91
91
  throw new Error(
92
92
  "PostCSS config already exists.\nUse --force to override existing config."
93
93
  );
94
94
  } else {
95
- const postCSSConfig = fse.readFileSync(
95
+ const postCSSConfig = fs.readFileSync(
96
96
  path.join(
97
97
  import.meta.dirname,
98
98
  "../templates/mantine-postcss.config.cjs.template"
99
99
  ),
100
100
  "utf-8"
101
101
  );
102
- return fse.outputFileSync(postCSSConfigPath, postCSSConfig);
102
+ fs.mkdirSync(path.dirname(postCSSConfigPath), { recursive: true });
103
+ return fs.writeFileSync(postCSSConfigPath, postCSSConfig);
103
104
  }
104
105
  }
105
106
  },
@@ -113,7 +114,7 @@ async function handler({ force, install, packages }) {
113
114
  },
114
115
  {
115
116
  title: "Configure Storybook...",
116
- skip: () => fileIncludes(rwPaths.web.storybookPreviewConfig, "withMantine"),
117
+ skip: () => fileIncludes(cedarPaths.web.storybookPreviewConfig, "withMantine"),
117
118
  task: async () => await extendStorybookConfiguration(
118
119
  path.join(
119
120
  import.meta.dirname,
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
- import fs from "fs-extra";
3
3
  import { Listr } from "listr2";
4
4
  import { format } from "prettier";
5
5
  import { addApiPackages, getPrettierOptions } from "@cedarjs/cli-helpers";
@@ -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 { addWebPackages } from "@cedarjs/cli-helpers";
5
5
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
- import fs from "fs-extra";
3
3
  import semver from "semver";
4
4
  import { getPaths } from "@cedarjs/project-config";
5
5
  import { isModuleInstalled, installModule } from "../lib/packages.js";
@@ -50,8 +50,8 @@ function assertRedwoodVersion(minVersions) {
50
50
  process.exit(1);
51
51
  }
52
52
  function getProjectRedwoodVersion() {
53
- const { devDependencies } = fs.readJSONSync(
54
- path.join(getPaths().base, "package.json")
53
+ const { devDependencies } = JSON.parse(
54
+ fs.readFileSync(path.join(getPaths().base, "package.json"), "utf-8")
55
55
  );
56
56
  return devDependencies["@cedarjs/core"];
57
57
  }
@@ -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 { ensurePosixPath } from "@cedarjs/project-config";
6
6
  import { errorTelemetry, timedTelemetry } from "@cedarjs/telemetry";
@@ -1,9 +1,9 @@
1
+ import fs from "node:fs";
1
2
  import { builtinModules } from "node:module";
2
3
  import os from "node:os";
3
4
  import path from "node:path";
4
5
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
5
6
  import execa from "execa";
6
- import fs from "fs-extra";
7
7
  import latestVersion from "latest-version";
8
8
  import { Listr } from "listr2";
9
9
  import semver from "semver";
@@ -274,7 +274,7 @@ async function removeCliCache(ctx, { dryRun, verbose }) {
274
274
  console.log("Removing CLI cache at: ", cliCacheDir);
275
275
  }
276
276
  if (!dryRun) {
277
- fs.removeSync(cliCacheDir);
277
+ fs.rmSync(cliCacheDir, { recursive: true, force: true });
278
278
  }
279
279
  }
280
280
  async function setLatestVersionToContext(ctx, tag) {
@@ -466,7 +466,7 @@ async function downloadYarnPatches(ctx, { dryRun, verbose }) {
466
466
  console.log("Writing patch", patchPath);
467
467
  }
468
468
  if (!dryRun) {
469
- await fs.writeFile(patchPath, patchMeta.content, "base64");
469
+ await fs.promises.writeFile(patchPath, patchMeta.content, "base64");
470
470
  }
471
471
  }
472
472
  };
@@ -570,7 +570,9 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
570
570
  ctx.preUpgradeError = "";
571
571
  for (const scriptName of scriptsToRun) {
572
572
  task.output = `Found upgrade check script: ${scriptName}. Downloading...`;
573
- const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "cedar-upgrade-"));
573
+ const tempDir = await fs.promises.mkdtemp(
574
+ path.join(os.tmpdir(), "cedar-upgrade-")
575
+ );
574
576
  const scriptPath = path.join(tempDir, "script.ts");
575
577
  const isDirectoryScript = scriptName.includes("/");
576
578
  if (isDirectoryScript) {
@@ -597,9 +599,9 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
597
599
  }
598
600
  const fileContent = await fileRes.text();
599
601
  const filePath = path.join(tempDir, file.name);
600
- await fs.writeFile(filePath, fileContent);
602
+ await fs.promises.writeFile(filePath, fileContent);
601
603
  if (file.name === "index.ts") {
602
- await fs.rename(filePath, scriptPath);
604
+ await fs.promises.rename(filePath, scriptPath);
603
605
  }
604
606
  }
605
607
  }
@@ -619,7 +621,7 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
619
621
  throw new Error(`Failed to download script: ${res.statusText}`);
620
622
  }
621
623
  const scriptContent2 = await res.text();
622
- await fs.writeFile(scriptPath, scriptContent2);
624
+ await fs.promises.writeFile(scriptPath, scriptContent2);
623
625
  } catch (e) {
624
626
  if (verbose) {
625
627
  console.error(e);
@@ -627,16 +629,19 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
627
629
  throw new Error(`Failed to download upgrade script from ${scriptUrl}`);
628
630
  }
629
631
  }
630
- const scriptContent = await fs.readFile(scriptPath, "utf8");
632
+ const scriptContent = await fs.promises.readFile(scriptPath, "utf8");
631
633
  const deps = extractDependencies(scriptContent);
632
634
  if (deps.length > 0) {
633
635
  const depList = deps.join(", ");
634
636
  task.output = `Installing dependencies for ${scriptName}: ${depList}...`;
635
- await fs.writeJson(path.join(tempDir, "package.json"), {
636
- name: "pre-upgrade-script",
637
- version: "0.0.0",
638
- dependencies: {}
639
- });
637
+ await fs.promises.writeFile(
638
+ path.join(tempDir, "package.json"),
639
+ JSON.stringify({
640
+ name: "pre-upgrade-script",
641
+ version: "0.0.0",
642
+ dependencies: {}
643
+ })
644
+ );
640
645
  await execa("yarn", ["add", ...deps], { cwd: tempDir });
641
646
  }
642
647
  task.output = `Running pre-upgrade script: ${scriptName}...`;
@@ -663,13 +668,13 @@ ${errorOutput}`;
663
668
  }
664
669
  ctx.preUpgradeError += errorMessage;
665
670
  if (!force) {
666
- await fs.remove(tempDir);
671
+ await fs.promises.rmdir(tempDir, { recursive: true });
667
672
  shouldCleanup = false;
668
673
  return;
669
674
  }
670
675
  } finally {
671
676
  if (shouldCleanup) {
672
- await fs.remove(tempDir);
677
+ await fs.promises.rmdir(tempDir, { recursive: true });
673
678
  }
674
679
  }
675
680
  }
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import fs from "node:fs";
2
3
  import path from "path";
3
4
  import { trace, SpanStatusCode } from "@opentelemetry/api";
4
- import fs from "fs-extra";
5
5
  import { hideBin, Parser } from "yargs/helpers";
6
6
  import yargs from "yargs/yargs";
7
7
  import { loadEnvFiles, recordTelemetryAttributes } from "@cedarjs/cli-helpers";
@@ -1,11 +1,11 @@
1
1
  import { spawn } from "child_process";
2
+ import fs from "node:fs";
2
3
  import os from "os";
3
4
  import path from "path";
4
- import fs from "fs-extra";
5
5
  import { getPaths } from "@cedarjs/project-config";
6
6
  function spawnBackgroundProcess(name, cmd, args) {
7
7
  const logDirectory = path.join(getPaths().generated.base, "logs");
8
- fs.ensureDirSync(logDirectory);
8
+ fs.mkdirSync(logDirectory, { recursive: true });
9
9
  const safeName = name.replace(/[^a-z0-9]/gi, "_").toLowerCase();
10
10
  const logHeader = [
11
11
  `Starting log:`,
@@ -1,5 +1,5 @@
1
+ import fse from "node:fs";
1
2
  import path from "path";
2
- import fse from "fs-extra";
3
3
  import prettier from "prettier";
4
4
  import { merge } from "./merge/index.js";
5
5
  import {
@@ -1,4 +1,4 @@
1
- import fs from "fs-extra";
1
+ import fs from "node:fs";
2
2
  function fileIncludes(path, str) {
3
3
  return fs.existsSync(path) && fs.readFileSync(path).toString().includes(str);
4
4
  }
@@ -1,6 +1,6 @@
1
+ import fs from "node:fs";
1
2
  import { createRequire } from "node:module";
2
3
  import path from "node:path";
3
- import fs from "fs-extra";
4
4
  import { runCommandTask, getPaths } from "../lib/index.js";
5
5
  const generatePrismaCommand = async () => {
6
6
  const createdRequire = createRequire(import.meta.url);
package/dist/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import https from "https";
2
+ import fs from "node:fs";
2
3
  import path from "path";
3
4
  import * as babel from "@babel/core";
4
5
  import boxen from "boxen";
@@ -6,7 +7,6 @@ import camelcase from "camelcase";
6
7
  import { paramCase } from "change-case";
7
8
  import decamelize from "decamelize";
8
9
  import execa from "execa";
9
- import fs from "fs-extra";
10
10
  import { Listr } from "listr2";
11
11
  import lodash from "lodash";
12
12
  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 { getPaths } from "./index.js";
4
4
  function ensureLockDirectoryExists() {
5
5
  const locksPath = path.join(getPaths().generated.base, "locks");
@@ -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 { getPaths } from "./index.js";
6
6
  async function installModule(name, version = void 0) {
7
7
  if (isModuleInstalled(name)) {
@@ -55,8 +55,8 @@ async function installRedwoodModule(module) {
55
55
  return false;
56
56
  }
57
57
  function isModuleInstalled(module) {
58
- const { dependencies, devDependencies } = fs.readJSONSync(
59
- path.join(getPaths().base, "package.json")
58
+ const { dependencies, devDependencies } = JSON.parse(
59
+ fs.readFileSync(path.join(getPaths().base, "package.json"), "utf-8")
60
60
  );
61
61
  const deps = {
62
62
  ...dependencies,
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import ansis from "ansis";
3
4
  import enquirer from "enquirer";
4
- import fs from "fs-extra";
5
5
  import { getCompatibilityData } from "@cedarjs/cli-helpers";
6
6
  import { installModule, isModuleInstalled } from "./packages.js";
7
7
  import { getPaths } from "./index.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 { getPaths } from "./index.js";
4
4
  const isTypeScriptProject = () => {
5
5
  const paths = getPaths();
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
- import fs from "fs-extra";
3
3
  let rollback = [];
4
4
  function addFunctionToRollback(func, atEnd = false) {
5
5
  const step = { type: "func", func };
package/dist/lib/test.js CHANGED
@@ -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 { vi } from "vitest";
4
4
  import "./mockTelemetry.js";
5
5
  vi.mock("@cedarjs/internal/dist/generate/generate", () => {
@@ -25,7 +25,6 @@ vi.mock("@cedarjs/project-config", async (importOriginal) => {
25
25
  "prisma.config.cjs"
26
26
  ),
27
27
  dataMigrations: path.join(BASE_PATH, "./api/dataMigrations"),
28
- generators: path.join(BASE_PATH, "./api/generators"),
29
28
  src: path.join(BASE_PATH, "./api/src"),
30
29
  jobs: path.join(BASE_PATH, "./api/src/jobs"),
31
30
  services: path.join(BASE_PATH, "./api/src/services"),
@@ -37,7 +36,6 @@ vi.mock("@cedarjs/project-config", async (importOriginal) => {
37
36
  base: path.join(BASE_PATH, "./web"),
38
37
  config: path.join(BASE_PATH, "./web/config"),
39
38
  src: path.join(BASE_PATH, "./web/src"),
40
- generators: path.join(BASE_PATH, "./web/generators"),
41
39
  routes: path.join(BASE_PATH, "web/src/Routes.js"),
42
40
  components: path.join(BASE_PATH, "/web/src/components"),
43
41
  layouts: path.join(BASE_PATH, "/web/src/layouts"),
@@ -45,6 +43,7 @@ vi.mock("@cedarjs/project-config", async (importOriginal) => {
45
43
  app: path.join(BASE_PATH, "/web/src/App.js")
46
44
  },
47
45
  scripts: path.join(BASE_PATH, "scripts"),
46
+ generatorTemplates: path.join(BASE_PATH, "generatorTemplates"),
48
47
  generated: {
49
48
  base: path.join(BASE_PATH, ".redwood"),
50
49
  schema: path.join(BASE_PATH, ".redwood/schema.graphql"),
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import ansis from "ansis";
3
4
  import boxen from "boxen";
4
- import fs from "fs-extra";
5
5
  import latestVersion from "latest-version";
6
6
  import semver from "semver";
7
7
  import { getConfig } from "@cedarjs/project-config";
@@ -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 "@cedarjs/project-config";
4
4
  class CustomFileExporter {
5
5
  /**
@@ -24,7 +24,7 @@ class CustomFileExporter {
24
24
  "telemetry",
25
25
  this.#storageFileName
26
26
  );
27
- fs.ensureDirSync(path.dirname(this.#storageFilePath));
27
+ fs.mkdirSync(path.dirname(this.#storageFilePath), { recursive: true });
28
28
  fs.writeFileSync(this.#storageFilePath, "[");
29
29
  }
30
30
  /**
@@ -1,8 +1,8 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
3
4
  import ci from "ci-info";
4
5
  import envinfo from "envinfo";
5
- import fs from "fs-extra";
6
6
  import system from "systeminformation";
7
7
  import { v4 as uuidv4, validate as validateUUID } from "uuid";
8
8
  import { getPaths, getRawConfig } from "@cedarjs/project-config";
@@ -17,7 +17,8 @@ async function getResources() {
17
17
  try {
18
18
  const telemetryFile = path.join(getPaths().generated.base, "telemetry.txt");
19
19
  if (!fs.existsSync(telemetryFile)) {
20
- fs.ensureFileSync(telemetryFile);
20
+ fs.mkdirSync(path.dirname(telemetryFile), { recursive: true });
21
+ fs.writeFileSync(telemetryFile, "");
21
22
  }
22
23
  if (fs.statSync(telemetryFile).mtimeMs < Date.now() - 864e5) {
23
24
  fs.writeFileSync(telemetryFile, UID);
@@ -1,7 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import path from "path";
2
3
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
3
4
  import { Resource } from "@opentelemetry/resources";
4
- import fs from "fs-extra";
5
5
  import { getPaths } from "@cedarjs/project-config";
6
6
  import { getResources } from "./resource.js";
7
7
  async function main() {
@@ -12,7 +12,7 @@ async function main() {
12
12
  "Information about Redwood telemetry can be found at:\n - https://telemetry.redwoodjs.com\n"
13
13
  );
14
14
  const telemetryDir = path.join(getPaths().generated.base, "telemetry");
15
- fs.ensureDirSync(telemetryDir);
15
+ fs.mkdirSync(telemetryDir, { recursive: true });
16
16
  const telemetryFiles = fs.readdirSync(
17
17
  path.join(getPaths().generated.base, "telemetry")
18
18
  );
@@ -32,7 +32,7 @@ async function main() {
32
32
  console.log(`Sending data from telemetry file '${file}'`);
33
33
  let spans = [];
34
34
  try {
35
- spans = fs.readJSONSync(path.join(telemetryDir, file));
35
+ spans = JSON.parse(fs.readFileSync(path.join(telemetryDir, file), "utf8"));
36
36
  } catch (error) {
37
37
  console.error(`Error reading telemetry file '${file}'`);
38
38
  console.error(error);
@@ -61,7 +61,10 @@ async function main() {
61
61
  console.error(spans);
62
62
  }
63
63
  });
64
- fs.writeJSONSync(path.join(telemetryDir, `_${file}`), spans, { spaces: 2 });
64
+ fs.writeFileSync(
65
+ path.join(telemetryDir, `_${file}`),
66
+ JSON.stringify(spans, null, 2)
67
+ );
65
68
  fs.unlinkSync(path.join(telemetryDir, file));
66
69
  telemetryFiles[index] = `_${file}`;
67
70
  }
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import { types } from "@babel/core";
4
4
  import { parse as babelParse } from "@babel/parser";
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import { getPaths } from "@cedarjs/project-config";
4
4
  const getRootPackageJSON = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "1.0.0-canary.13052+3928e8a04",
3
+ "version": "1.0.0-canary.13054+69c966db3",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,15 +31,15 @@
31
31
  "dependencies": {
32
32
  "@babel/preset-typescript": "7.28.5",
33
33
  "@babel/runtime-corejs3": "7.28.4",
34
- "@cedarjs/api-server": "1.0.0-canary.13052",
35
- "@cedarjs/cli-helpers": "1.0.0-canary.13052",
36
- "@cedarjs/fastify-web": "1.0.0-canary.13052",
37
- "@cedarjs/internal": "1.0.0-canary.13052",
38
- "@cedarjs/prerender": "1.0.0-canary.13052",
39
- "@cedarjs/project-config": "1.0.0-canary.13052",
40
- "@cedarjs/structure": "1.0.0-canary.13052",
41
- "@cedarjs/telemetry": "1.0.0-canary.13052",
42
- "@cedarjs/web-server": "1.0.0-canary.13052",
34
+ "@cedarjs/api-server": "1.0.0-canary.13054",
35
+ "@cedarjs/cli-helpers": "1.0.0-canary.13054",
36
+ "@cedarjs/fastify-web": "1.0.0-canary.13054",
37
+ "@cedarjs/internal": "1.0.0-canary.13054",
38
+ "@cedarjs/prerender": "1.0.0-canary.13054",
39
+ "@cedarjs/project-config": "1.0.0-canary.13054",
40
+ "@cedarjs/structure": "1.0.0-canary.13054",
41
+ "@cedarjs/telemetry": "1.0.0-canary.13054",
42
+ "@cedarjs/web-server": "1.0.0-canary.13054",
43
43
  "@listr2/prompt-adapter-enquirer": "2.0.16",
44
44
  "@opentelemetry/api": "1.8.0",
45
45
  "@opentelemetry/core": "1.22.0",
@@ -64,7 +64,6 @@
64
64
  "envinfo": "7.21.0",
65
65
  "execa": "5.1.1",
66
66
  "fast-glob": "3.3.3",
67
- "fs-extra": "11.3.3",
68
67
  "humanize-string": "2.1.0",
69
68
  "jscodeshift": "17.0.0",
70
69
  "latest-version": "9.0.0",
@@ -102,5 +101,5 @@
102
101
  "publishConfig": {
103
102
  "access": "public"
104
103
  },
105
- "gitHead": "3928e8a0411cedd6395520af3c2a5e17fbcb9de8"
104
+ "gitHead": "69c966db38863525fdb690d41153b4dcdb3d418d"
106
105
  }