create-nexu 1.1.2 → 1.1.3

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
@@ -105,6 +105,33 @@ function log(message, type = "info") {
105
105
  };
106
106
  console.log(`${colors[type](icons[type])} ${message}`);
107
107
  }
108
+ function detectPackageManager(projectDir = process.cwd()) {
109
+ if (fs.existsSync(path.join(projectDir, "pnpm-lock.yaml"))) {
110
+ return "pnpm";
111
+ }
112
+ if (fs.existsSync(path.join(projectDir, "yarn.lock"))) {
113
+ return "yarn";
114
+ }
115
+ if (fs.existsSync(path.join(projectDir, "package-lock.json"))) {
116
+ return "npm";
117
+ }
118
+ const packageJsonPath = path.join(projectDir, "package.json");
119
+ if (fs.existsSync(packageJsonPath)) {
120
+ try {
121
+ const pkg = fs.readJsonSync(packageJsonPath);
122
+ if (pkg.packageManager) {
123
+ if (pkg.packageManager.startsWith("pnpm")) return "pnpm";
124
+ if (pkg.packageManager.startsWith("yarn")) return "yarn";
125
+ if (pkg.packageManager.startsWith("npm")) return "npm";
126
+ }
127
+ } catch {
128
+ }
129
+ }
130
+ const userAgent = process.env.npm_config_user_agent || "";
131
+ if (userAgent.includes("pnpm")) return "pnpm";
132
+ if (userAgent.includes("yarn")) return "yarn";
133
+ return "npm";
134
+ }
108
135
  function getRunCommand(pm) {
109
136
  switch (pm) {
110
137
  case "pnpm":
@@ -542,7 +569,9 @@ function collectFileChanges(srcDir, destDir, category, basePath = "", checkDelet
542
569
  const destPath = path4.join(destDir, entry.name);
543
570
  const relativePath = basePath ? path4.join(basePath, entry.name) : entry.name;
544
571
  if (entry.isDirectory()) {
545
- changes.push(...collectFileChanges(srcPath, destPath, category, relativePath, checkDeleted));
572
+ changes.push(
573
+ ...collectFileChanges(srcPath, destPath, category, relativePath, checkDeleted)
574
+ );
546
575
  } else {
547
576
  if (!fs4.existsSync(destPath)) {
548
577
  changes.push({ type: "add", relativePath, srcPath, destPath, category });
@@ -1001,11 +1030,23 @@ ${change.relativePath}:`));
1001
1030
  if (appliedFiles > 0) summary.push(`${appliedFiles} files updated`);
1002
1031
  if (deletedFilesCount > 0) summary.push(`${deletedFilesCount} files deleted`);
1003
1032
  applySpinner.succeed(summary.join(", ") || "No file changes applied");
1004
- console.log("\n" + chalk4.green.bold("\u2728 Update complete!\n"));
1005
- if (selectedCategories.includes("dependencies")) {
1006
- console.log("Run your package manager install command to install any new dependencies.");
1033
+ if (selectedCategories.includes("dependencies") && dependencyChanges && hasChanges(dependencyChanges)) {
1034
+ const pm = detectPackageManager(projectDir);
1035
+ const installCmd = getInstallCommand(pm);
1036
+ console.log(chalk4.blue(`
1037
+ \u{1F4E6} Installing dependencies with ${pm}...
1038
+ `));
1039
+ try {
1040
+ execInherit(installCmd, projectDir);
1041
+ console.log(chalk4.green("\n\u2713 Dependencies installed"));
1042
+ } catch {
1043
+ console.log(
1044
+ chalk4.yellow(`
1045
+ ! Failed to install dependencies. Run "${installCmd}" manually.`)
1046
+ );
1047
+ }
1007
1048
  }
1008
- console.log("");
1049
+ console.log("\n" + chalk4.green.bold("\u2728 Update complete!\n"));
1009
1050
  }
1010
1051
  function cleanEmptyDirectories(dir) {
1011
1052
  if (!fs4.existsSync(dir)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nexu",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "CLI to create and update Nexu monorepo projects",
5
5
  "author": "Nexu Team",
6
6
  "license": "MIT",
@@ -18,6 +18,10 @@
18
18
  "docker:build": "docker-compose -f docker/docker-compose.prod.yml build",
19
19
  "docker:prod": "docker-compose -f docker/docker-compose.prod.yml up -d",
20
20
  "generate:app": "node scripts/generate-app.mjs",
21
+ "audit": "node scripts/audit.mjs",
22
+ "audit:security": "node scripts/audit.mjs --security",
23
+ "audit:quality": "node scripts/audit.mjs --quality",
24
+ "audit:fix": "node scripts/audit.mjs --quality --fix",
21
25
  "changeset": "changeset",
22
26
  "version-packages": "changeset version",
23
27
  "release": "changeset publish"