@windrun-huaiin/dev-scripts 6.7.0 → 6.8.1

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/cli.js CHANGED
@@ -926,7 +926,7 @@ async function generateBlogIndex(config, cwd2 = typeof process !== "undefined" ?
926
926
  `;
927
927
  }
928
928
  if (featuredArticles.length === 0 && pastArticles.length === 0 && !iocArticle) {
929
- mdxContent += "No blog posts found yet. Stay tuned!\n";
929
+ mdxContent += "## Ooops\nNo blog posts found yet. Stay tuned!\n";
930
930
  }
931
931
  fs.writeFileSync(indexFile, mdxContent);
932
932
  logger.success(`Successfully generated ${indexFile}`);
@@ -1212,18 +1212,9 @@ async function createDiaomaoApp(targetDir) {
1212
1212
  const hasPkgJson = await fsExtra.pathExists(cwdPackageJson);
1213
1213
  const hasWorkspace = await fsExtra.pathExists(cwdWorkspaceYaml);
1214
1214
  let destDir;
1215
- let isMonorepo = false;
1216
- let skipInstallAndGit = false;
1217
1215
  if (hasPkgJson && hasWorkspace) {
1218
- console.log("Detected monorepo environment, creating project under apps/");
1219
- destDir = path2__default.default.resolve(cwd2, "apps", targetDir);
1220
- isMonorepo = true;
1221
- skipInstallAndGit = true;
1222
- if (await fsExtra.pathExists(destDir)) {
1223
- console.error(`Error: Project 'apps/${targetDir}' already exists in this monorepo!`);
1224
- console.error(`Please choose a different name or remove the existing project first.`);
1225
- process.exit(1);
1226
- }
1216
+ console.error("Detected monorepo environment, NextJS DO NOT SUPPORT MONOREPO WELL!");
1217
+ process.exit(1);
1227
1218
  } else if (hasPkgJson && !hasWorkspace) {
1228
1219
  console.error("Warning: You are in a directory that already contains package.json");
1229
1220
  console.error("This might create a nested project structure which is usually not intended.");
@@ -1253,106 +1244,73 @@ async function createDiaomaoApp(targetDir) {
1253
1244
  await fsExtra.rename(envTxtPath, envPath);
1254
1245
  console.log("Renamed .env.local.txt to .env.local");
1255
1246
  }
1256
- if (isMonorepo) {
1257
- const changesetDir = path2__default.default.join(destDir, ".changeset");
1258
- if (await fsExtra.pathExists(changesetDir)) {
1259
- await fsExtra.remove(changesetDir);
1260
- console.log("Removed .changeset folder (managed by monorepo root)");
1261
- }
1247
+ const changesetDir = path2__default.default.join(destDir, ".changeset");
1248
+ if (await fsExtra.pathExists(changesetDir)) {
1249
+ const templateFile = path2__default.default.join(changesetDir, "d8-template.mdx");
1250
+ const changesetContent = `---
1251
+ "${path2__default.default.basename(targetDir)}": major
1252
+ ---
1253
+
1254
+ feat(init): app created by @windrun-huaiin/diaomao`;
1255
+ await fsExtra.writeFile(templateFile, changesetContent, "utf8");
1256
+ console.log("Created changeset template file: d8-template.mdx");
1262
1257
  }
1263
1258
  const pkgPath = path2__default.default.join(destDir, "package.json");
1264
1259
  const pkg = await fsExtra.readJson(pkgPath);
1265
1260
  pkg.name = path2__default.default.basename(targetDir);
1266
1261
  pkg.version = "1.0.0";
1267
1262
  pkg.private = true;
1268
- if (isMonorepo) {
1269
- if (pkg.dependencies) {
1270
- Object.keys(pkg.dependencies).forEach((key) => {
1271
- if (key.startsWith("@windrun-huaiin/")) {
1272
- pkg.dependencies[key] = "workspace:^";
1273
- }
1274
- });
1275
- }
1276
- if (pkg.devDependencies) {
1277
- Object.keys(pkg.devDependencies).forEach((key) => {
1278
- if (key.startsWith("@windrun-huaiin/")) {
1279
- pkg.devDependencies[key] = "workspace:^";
1280
- }
1281
- });
1282
- }
1283
- delete pkg.pnpm;
1284
- if (pkg.scripts) {
1285
- delete pkg.scripts["deep-clean"];
1286
- delete pkg.scripts["d8"];
1287
- delete pkg.scripts["easy-changeset"];
1288
- delete pkg.scripts["dj"];
1289
- delete pkg.scripts["djv"];
1290
- delete pkg.scripts["djvp"];
1291
- }
1292
- } else {
1293
- pkg.pnpm = {
1294
- "onlyBuiltDependencies": [
1295
- "@clerk/shared",
1296
- "@parcel/watcher",
1297
- "@tailwindcss/oxide",
1298
- "core-js",
1299
- "esbuild",
1300
- "sharp",
1301
- "unrs-resolver"
1302
- ],
1303
- "overrides": {
1304
- "@types/react": "19.1.2",
1305
- "@types/react-dom": "19.1.3"
1306
- },
1307
- "patchedDependencies": {
1308
- "fumadocs-ui@15.3.3": "patches/fumadocs-ui@15.3.3.patch"
1309
- }
1310
- };
1311
- if (pkg.scripts) {
1312
- delete pkg.scripts["djvp"];
1263
+ pkg.pnpm = {
1264
+ "onlyBuiltDependencies": [
1265
+ "@clerk/shared",
1266
+ "@parcel/watcher",
1267
+ "@tailwindcss/oxide",
1268
+ "core-js",
1269
+ "esbuild",
1270
+ "sharp",
1271
+ "unrs-resolver"
1272
+ ],
1273
+ "overrides": {
1274
+ "@types/react": "19.1.2",
1275
+ "@types/react-dom": "19.1.3"
1276
+ },
1277
+ "patchedDependencies": {
1278
+ "fumadocs-ui@15.3.3": "patches/fumadocs-ui@15.3.3.patch"
1313
1279
  }
1280
+ };
1281
+ if (pkg.scripts) {
1282
+ delete pkg.scripts["djvp"];
1314
1283
  }
1315
1284
  delete pkg.publishConfig;
1316
1285
  delete pkg.files;
1317
1286
  await fsExtra.writeJson(pkgPath, pkg, { spaces: 2 });
1318
- if (!skipInstallAndGit) {
1319
- console.log("Installing dependencies...");
1287
+ console.log("Installing dependencies...");
1288
+ try {
1289
+ child_process.execSync("pnpm install", { cwd: destDir, stdio: "inherit" });
1290
+ } catch (error) {
1291
+ console.warn("pnpm failed, trying npm...");
1320
1292
  try {
1321
- child_process.execSync("pnpm install", { cwd: destDir, stdio: "inherit" });
1322
- } catch (error) {
1323
- console.warn("pnpm failed, trying npm...");
1324
- try {
1325
- child_process.execSync("npm install", { cwd: destDir, stdio: "inherit" });
1326
- } catch (npmError) {
1327
- console.error("Failed to install dependencies. Please run npm install or pnpm install manually.");
1328
- }
1293
+ child_process.execSync("npm install", { cwd: destDir, stdio: "inherit" });
1294
+ } catch (npmError) {
1295
+ console.error("Failed to install dependencies. Please run npm install or pnpm install manually.");
1329
1296
  }
1330
- console.log("Initializing Git repository...");
1331
- try {
1332
- child_process.execSync("git init", { cwd: destDir, stdio: "inherit" });
1333
- child_process.execSync("git add .", { cwd: destDir, stdio: "inherit" });
1334
- child_process.execSync('git commit -m "feat: initial commit from diaomao template"', { cwd: destDir, stdio: "inherit" });
1335
- } catch (error) {
1336
- console.warn("Failed to initialize Git repository. Please initialize manually.");
1337
- }
1338
- } else {
1339
- console.log("Skipping dependency installation and Git initialization (managed by monorepo)");
1297
+ }
1298
+ console.log("Initializing Git repository...");
1299
+ try {
1300
+ child_process.execSync("git init", { cwd: destDir, stdio: "inherit" });
1301
+ child_process.execSync("git add .", { cwd: destDir, stdio: "inherit" });
1302
+ child_process.execSync('git commit -m "feat: initial commit from diaomao template"', { cwd: destDir, stdio: "inherit" });
1303
+ } catch (error) {
1304
+ console.warn("Failed to initialize Git repository. Please initialize manually.");
1340
1305
  }
1341
1306
  console.log(`
1342
1307
  \u2705 Project created: ${destDir}`);
1343
1308
  console.log(`
1344
1309
  Next steps:`);
1345
- if (isMonorepo) {
1346
- console.log(` Config pnpm-workspace.yaml, add your packages: -apps/${targetDir} for your monorepo`);
1347
- console.log(` Config .changeset/d8-template.mdx for CHANGELOG`);
1348
- console.log(` # Run 'pnpm install' from monorepo root if needed`);
1349
- console.log(` pnpm build`);
1350
- console.log(` pnpm dev`);
1351
- } else {
1352
- console.log(` cd ${targetDir}`);
1353
- console.log(` pnpm build`);
1354
- console.log(` pnpm dev`);
1355
- }
1310
+ console.log(` cd ${targetDir}`);
1311
+ console.log(` pnpm build`);
1312
+ console.log(` pnpm dev`);
1313
+ console.log(` NOTE: if you want to update @windrun-huaiin packages, please run pnpm windrun`);
1356
1314
  console.log(` NOTE: please check .env.local file and set your own env!`);
1357
1315
  } catch (error) {
1358
1316
  console.error("Failed to create project:", error);