create-morax 2.0.1 → 2.0.2

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.
package/dist/index.js CHANGED
@@ -52,8 +52,8 @@ import { promisify } from "util";
52
52
  import pc2 from "picocolors";
53
53
  var execAsync = promisify(exec);
54
54
  async function runCommand(command, options = {}) {
55
- options.silent = true;
56
- if (!options.silent) {
55
+ const isSilent = options.silent ?? false;
56
+ if (!isSilent) {
57
57
  console.log(pc2.cyan(`> ${command}`));
58
58
  }
59
59
  try {
@@ -61,7 +61,7 @@ async function runCommand(command, options = {}) {
61
61
  cwd: options.cwd,
62
62
  env: { ...process.env, NODE_NO_WARNINGS: "1" }
63
63
  });
64
- if (!options.silent) {
64
+ if (!isSilent) {
65
65
  if (stdout && stdout.trim()) {
66
66
  console.log(stdout.trim());
67
67
  }
@@ -71,13 +71,16 @@ async function runCommand(command, options = {}) {
71
71
  }
72
72
  return { stdout, stderr };
73
73
  } catch (error) {
74
- if (!options.silent) {
74
+ if (!isSilent) {
75
75
  if (error.stdout && error.stdout.trim()) {
76
76
  console.log(error.stdout.trim());
77
77
  }
78
78
  if (error.stderr && error.stderr.trim()) {
79
79
  console.error(pc2.red(error.stderr.trim()));
80
80
  }
81
+ } else if (error.stderr && error.stderr.trim()) {
82
+ error.message = `${error.message}
83
+ ${error.stderr.trim()}`;
81
84
  }
82
85
  throw error;
83
86
  }
@@ -1121,19 +1124,20 @@ async function setupReact(projectPath, isMonorepo = true) {
1121
1124
  `Vite React application directory "apps/${createdDirName}" was not found. Please ensure you complete the Vite installation.`
1122
1125
  );
1123
1126
  }
1124
- if (isMonorepo) {
1125
- try {
1126
- const pkgPath = path2.join(webDir, "package.json");
1127
- const pkgRaw = await fsPromises3.readFile(pkgPath, "utf8");
1128
- const pkg = JSON.parse(pkgRaw);
1127
+ const pkgPath = path2.join(webDir, "package.json");
1128
+ try {
1129
+ const pkgRaw = await fsPromises3.readFile(pkgPath, "utf8");
1130
+ const pkg = JSON.parse(pkgRaw);
1131
+ if (isMonorepo) {
1129
1132
  pkg.name = "web";
1130
- await fsPromises3.writeFile(
1131
- pkgPath,
1132
- JSON.stringify(pkg, null, 2),
1133
- "utf8"
1134
- );
1135
- } catch {
1133
+ } else {
1134
+ pkg.pnpm = {
1135
+ ...pkg.pnpm || {},
1136
+ onlyBuiltDependencies: ["esbuild"]
1137
+ };
1136
1138
  }
1139
+ await fsPromises3.writeFile(pkgPath, JSON.stringify(pkg, null, 2), "utf8");
1140
+ } catch {
1137
1141
  }
1138
1142
  const aliasSpinner = spinner2();
1139
1143
  aliasSpinner.start("Configuring import aliases and Node types...");
@@ -1632,19 +1636,24 @@ async function setupNextjs(projectPath, isMonorepo = true) {
1632
1636
  } catch {
1633
1637
  }
1634
1638
  }
1635
- if (isMonorepo) {
1636
- const webPkgPath = path6.join(webDir, "package.json");
1637
- try {
1638
- const webPkgRaw = await fsPromises6.readFile(webPkgPath, "utf8");
1639
- const webPkg = JSON.parse(webPkgRaw);
1639
+ const webPkgPath = path6.join(webDir, "package.json");
1640
+ try {
1641
+ const webPkgRaw = await fsPromises6.readFile(webPkgPath, "utf8");
1642
+ const webPkg = JSON.parse(webPkgRaw);
1643
+ if (isMonorepo) {
1640
1644
  webPkg.name = "web";
1641
- await fsPromises6.writeFile(
1642
- webPkgPath,
1643
- JSON.stringify(webPkg, null, 2),
1644
- "utf8"
1645
- );
1646
- } catch {
1645
+ } else {
1646
+ webPkg.pnpm = {
1647
+ ...webPkg.pnpm || {},
1648
+ onlyBuiltDependencies: ["sharp"]
1649
+ };
1647
1650
  }
1651
+ await fsPromises6.writeFile(
1652
+ webPkgPath,
1653
+ JSON.stringify(webPkg, null, 2),
1654
+ "utf8"
1655
+ );
1656
+ } catch {
1648
1657
  }
1649
1658
  return webDir;
1650
1659
  }
@@ -1753,9 +1762,21 @@ import fsPromises8 from "fs/promises";
1753
1762
  import path9 from "path";
1754
1763
  async function generateWorkspaceConfig(name, directories, projectPath) {
1755
1764
  await fsPromises8.mkdir(projectPath, { recursive: true });
1765
+ const defaultOnlyBuiltDeps = [
1766
+ "esbuild",
1767
+ "@biomejs/biome",
1768
+ "oxlint",
1769
+ "lefthook",
1770
+ "sharp"
1771
+ ];
1756
1772
  const workspaceYamlContent = [
1757
1773
  "packages:",
1758
1774
  ...directories.map((dir) => ` - '${dir}/*'`),
1775
+ "",
1776
+ "onlyBuiltDependencies:",
1777
+ ...defaultOnlyBuiltDeps.map(
1778
+ (dep) => dep.startsWith("@") ? ` - '${dep}'` : ` - ${dep}`
1779
+ ),
1759
1780
  ""
1760
1781
  ].join("\n");
1761
1782
  await fsPromises8.writeFile(
@@ -1780,6 +1801,9 @@ async function generateWorkspaceConfig(name, directories, projectPath) {
1780
1801
  } catch {
1781
1802
  pkg.packageManager = "pnpm@latest";
1782
1803
  }
1804
+ pkg.pnpm = {
1805
+ onlyBuiltDependencies: defaultOnlyBuiltDeps
1806
+ };
1783
1807
  pkg.workspaces = directories.map((dir) => `${dir}/*`);
1784
1808
  pkg.scripts = {
1785
1809
  dev: "pnpm -r --parallel dev"