create-stardrive 1.2.2 → 1.3.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/bin/index.js +85 -4
- package/package.json +2 -2
package/bin/index.js
CHANGED
|
@@ -180,7 +180,8 @@ function removeFaq(targetDir2) {
|
|
|
180
180
|
removePaths(targetDir2, [
|
|
181
181
|
"src/content/faq-answers",
|
|
182
182
|
"src/pages/faq.astro",
|
|
183
|
-
"src/pages/[lang]/faq.astro"
|
|
183
|
+
"src/pages/[lang]/faq.astro",
|
|
184
|
+
"src/components/faq"
|
|
184
185
|
]);
|
|
185
186
|
editFile(targetDir2, "src/content.config.ts", (content) => {
|
|
186
187
|
const withoutDecl = removeBraceBlock(content, /const faq_answers = defineCollection\(/);
|
|
@@ -198,7 +199,7 @@ function removeIntegration(targetDir2) {
|
|
|
198
199
|
"src/content/integration-options",
|
|
199
200
|
"src/pages/integration",
|
|
200
201
|
"src/pages/[lang]/integration",
|
|
201
|
-
"src/components/integration
|
|
202
|
+
"src/components/integration"
|
|
202
203
|
]);
|
|
203
204
|
editFile(targetDir2, "src/content.config.ts", (content) => {
|
|
204
205
|
const withoutDecl = removeBraceBlock(
|
|
@@ -208,11 +209,36 @@ function removeIntegration(targetDir2) {
|
|
|
208
209
|
return removeCollectionFromExport(withoutDecl, "integration_options");
|
|
209
210
|
});
|
|
210
211
|
}
|
|
212
|
+
function removeEvents(targetDir2) {
|
|
213
|
+
removePaths(targetDir2, [
|
|
214
|
+
"src/styles/events.css",
|
|
215
|
+
"src/pages/events",
|
|
216
|
+
"src/pages/[lang]/events",
|
|
217
|
+
"src/pages/dynamic-events-sitemap.xml.ts",
|
|
218
|
+
"src/components/events",
|
|
219
|
+
"src/content/events",
|
|
220
|
+
"src/images/content/events",
|
|
221
|
+
"src/utils/event-bridge.ts"
|
|
222
|
+
]);
|
|
223
|
+
editFile(targetDir2, "src/content.config.ts", (content) => {
|
|
224
|
+
const withoutDecl = removeBraceBlock(content, /const events = defineCollection\(/);
|
|
225
|
+
return removeCollectionFromExport(withoutDecl, "events");
|
|
226
|
+
});
|
|
227
|
+
editFile(targetDir2, "theme.config.ts", (content) => {
|
|
228
|
+
const withoutSection = removeBraceBlock(content, /^[ \t]*dynamicEvents:\s*\{/m);
|
|
229
|
+
const withoutComment = removeLines(withoutSection, /^\s*\/\/ you can also dynamically integrate events.*$/m);
|
|
230
|
+
return removeLines(withoutComment, /^\s*addEvents:/);
|
|
231
|
+
});
|
|
232
|
+
editFile(targetDir2, "astro.config.ts", (content) => {
|
|
233
|
+
return removeLines(content, /^\s*customSitemaps:\s.*$/m);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
211
236
|
function cleanupNav(targetDir2, removed) {
|
|
212
237
|
const routes = [
|
|
213
238
|
removed.blog ? "blog" : null,
|
|
214
239
|
removed.faq ? "faq" : null,
|
|
215
|
-
removed.integration ? "integration" : null
|
|
240
|
+
removed.integration ? "integration" : null,
|
|
241
|
+
removed.events ? "events" : null
|
|
216
242
|
].filter((route) => route !== null);
|
|
217
243
|
if (routes.length === 0) return;
|
|
218
244
|
const pattern = new RegExp(
|
|
@@ -285,10 +311,16 @@ async function configureFeatures(targetDir2) {
|
|
|
285
311
|
removeIntegration(targetDir2);
|
|
286
312
|
ok("Removed the integration catalog");
|
|
287
313
|
}
|
|
314
|
+
const keepEvents = await confirm(rl, "Keep the events feature?");
|
|
315
|
+
if (!keepEvents) {
|
|
316
|
+
removeEvents(targetDir2);
|
|
317
|
+
ok("Removed the events feature");
|
|
318
|
+
}
|
|
288
319
|
cleanupNav(targetDir2, {
|
|
289
320
|
blog: !keepBlog,
|
|
290
321
|
faq: !keepFaq,
|
|
291
|
-
integration: !keepIntegration
|
|
322
|
+
integration: !keepIntegration,
|
|
323
|
+
events: !keepEvents
|
|
292
324
|
});
|
|
293
325
|
const useCloudflare = await confirm(
|
|
294
326
|
rl,
|
|
@@ -449,6 +481,12 @@ function calibratePackageJson(targetDir2, projectName2, pm2) {
|
|
|
449
481
|
if (pkg.scripts) {
|
|
450
482
|
delete pkg.scripts["sync-version"];
|
|
451
483
|
delete pkg.scripts["prebuild"];
|
|
484
|
+
if (pkg.scripts["fix"]) {
|
|
485
|
+
pkg.scripts["fix"] = pkg.scripts["fix"].replace(
|
|
486
|
+
"npm run sync-version && ",
|
|
487
|
+
""
|
|
488
|
+
);
|
|
489
|
+
}
|
|
452
490
|
}
|
|
453
491
|
if (pm2 === "pnpm") {
|
|
454
492
|
pkg.packageManager = `pnpm@${execSync2("pnpm --version").toString().trim()}`;
|
|
@@ -459,6 +497,47 @@ function calibratePackageJson(targetDir2, projectName2, pm2) {
|
|
|
459
497
|
fs3.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2));
|
|
460
498
|
ok(`Named your ship ${c.bold(projectName2)}`);
|
|
461
499
|
}
|
|
500
|
+
var LOCKFILE_RULES = {
|
|
501
|
+
npm: "package-lock.json",
|
|
502
|
+
pnpm: "pnpm-lock.yaml",
|
|
503
|
+
yarn: "yarn.lock",
|
|
504
|
+
bun: "bun.lockb"
|
|
505
|
+
};
|
|
506
|
+
function calibrateGitignore(targetDir2, pm2) {
|
|
507
|
+
step("Calibrating .gitignore lockfile rules");
|
|
508
|
+
const gitignorePath = path3.join(targetDir2, ".gitignore");
|
|
509
|
+
if (!fs3.existsSync(gitignorePath)) {
|
|
510
|
+
info("No .gitignore found, skipping lockfile calibration");
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
const lines = fs3.readFileSync(gitignorePath, "utf8").split(/\r?\n/);
|
|
514
|
+
const activeRule = LOCKFILE_RULES[pm2];
|
|
515
|
+
const inactiveRules = Object.values(LOCKFILE_RULES).filter(
|
|
516
|
+
(rule) => rule !== activeRule
|
|
517
|
+
);
|
|
518
|
+
const rewritten = lines.map((line) => {
|
|
519
|
+
const trimmed = line.trim();
|
|
520
|
+
const match = trimmed.match(/^#?\s*(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb)$/);
|
|
521
|
+
if (!match) return line;
|
|
522
|
+
const rule = match[1];
|
|
523
|
+
if (rule === activeRule) {
|
|
524
|
+
return `#${rule}`;
|
|
525
|
+
}
|
|
526
|
+
if (inactiveRules.includes(rule)) {
|
|
527
|
+
return rule;
|
|
528
|
+
}
|
|
529
|
+
return line;
|
|
530
|
+
});
|
|
531
|
+
fs3.writeFileSync(gitignorePath, rewritten.join("\n"));
|
|
532
|
+
ok(`Enabled ${activeRule} for ${pm2}, ignored others`);
|
|
533
|
+
}
|
|
534
|
+
function setAgentMode(targetDir2) {
|
|
535
|
+
step("Specifying AI agent mode in the project");
|
|
536
|
+
const aiDir = path3.join(targetDir2, ".ai");
|
|
537
|
+
fs3.mkdirSync(aiDir, { recursive: true });
|
|
538
|
+
fs3.writeFileSync(path3.join(aiDir, "STARDRIVE_AGENT_MODE"), "project");
|
|
539
|
+
ok("Created .ai/STARDRIVE_AGENT_MODE");
|
|
540
|
+
}
|
|
462
541
|
function installDependencies(targetDir2, projectName2, pm2, skipInstall2) {
|
|
463
542
|
if (skipInstall2) {
|
|
464
543
|
step("Skipping dependency install");
|
|
@@ -489,8 +568,10 @@ ok(`Selected ${c.bold(tag)}`);
|
|
|
489
568
|
cloneRepo(tag, targetDir, projectName);
|
|
490
569
|
trimProject(targetDir);
|
|
491
570
|
calibratePackageJson(targetDir, projectName, pm);
|
|
571
|
+
calibrateGitignore(targetDir, pm);
|
|
492
572
|
await configureFeatures(targetDir);
|
|
493
573
|
installDependencies(targetDir, projectName, pm, skipInstall);
|
|
574
|
+
setAgentMode(targetDir);
|
|
494
575
|
console.log(`
|
|
495
576
|
${c.green("All systems go.")} ${c.dim("Pre-flight checklist complete.")}
|
|
496
577
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-stardrive",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "This is the launchpad application to create the Astro Stardrive boilerplate.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-stardrive": "bin/index.js"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"typecheck": "tsc --noEmit"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@types/node": "^26.
|
|
54
|
+
"@types/node": "^26.1.0",
|
|
55
55
|
"esbuild": "^0.28.1",
|
|
56
56
|
"typescript": "^6.0.3"
|
|
57
57
|
}
|