create-stardrive 1.3.3 → 1.3.4

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 (2) hide show
  1. package/bin/index.js +49 -4
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -175,6 +175,26 @@ function removeBlog(targetDir2) {
175
175
  const withoutComment = removeLines(withoutSection, /^\s*\/\/ content\/article settings\s*$/);
176
176
  return removeLines(withoutComment, /^\s*addArticles:/);
177
177
  });
178
+ const packageJsonPath = path.join(targetDir2, "package.json");
179
+ if (fs.existsSync(packageJsonPath)) {
180
+ const pkg = JSON.parse(
181
+ fs.readFileSync(packageJsonPath, "utf8")
182
+ );
183
+ if (pkg.dependencies) delete pkg.dependencies["reading-time"];
184
+ if (pkg.devDependencies) delete pkg.devDependencies["reading-time"];
185
+ fs.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2));
186
+ }
187
+ editFile(
188
+ targetDir2,
189
+ "astro.config.ts",
190
+ (content) => content.replace(
191
+ /(\binclude:\s*\[)([^\]]*)\]/,
192
+ (_full, prefix, body) => {
193
+ const items = body.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0 && entry !== "'reading-time'");
194
+ return `${prefix}${items.join(", ")}]`;
195
+ }
196
+ ).replace(/,\s*\]/, "]")
197
+ );
178
198
  }
179
199
  function removeFaq(targetDir2) {
180
200
  removePaths(targetDir2, [
@@ -208,6 +228,17 @@ function removeIntegration(targetDir2) {
208
228
  );
209
229
  return removeCollectionFromExport(withoutDecl, "integration_options");
210
230
  });
231
+ editFile(
232
+ targetDir2,
233
+ "theme.config.ts",
234
+ (content) => content.replace(
235
+ /onDemandRenderedCollections:\s*\[[^\]]*\]/,
236
+ "onDemandRenderedCollections: []"
237
+ ).replace(
238
+ /excludePagesPattern:\s*\[[^\]]*\]/,
239
+ "excludePagesPattern: []"
240
+ )
241
+ );
211
242
  }
212
243
  function removeEvents(targetDir2) {
213
244
  removePaths(targetDir2, [
@@ -233,6 +264,18 @@ function removeEvents(targetDir2) {
233
264
  return removeLines(content, /^\s*customSitemaps:\s.*$/m);
234
265
  });
235
266
  }
267
+ function cleanupContentConfig(targetDir2) {
268
+ const contentConfigPath = path.join(targetDir2, "src/content.config.ts");
269
+ if (!fs.existsSync(contentConfigPath)) return;
270
+ const content = fs.readFileSync(contentConfigPath, "utf8");
271
+ const match = content.match(
272
+ /export const collections\s*=\s*\{([^}]*)\}\s*;?/
273
+ );
274
+ if (match && match[1].trim() === "") {
275
+ fs.writeFileSync(contentConfigPath, "export const collections = {};\n");
276
+ ok("No content collections left; cleaned up content.config.ts");
277
+ }
278
+ }
236
279
  function cleanupNav(targetDir2, removed) {
237
280
  const routes = [
238
281
  removed.blog ? "blog" : null,
@@ -322,6 +365,7 @@ async function configureFeatures(targetDir2) {
322
365
  integration: !keepIntegration,
323
366
  events: !keepEvents
324
367
  });
368
+ cleanupContentConfig(targetDir2);
325
369
  const useCloudflare = await confirm(
326
370
  rl,
327
371
  "Will you host on Cloudflare Workers?"
@@ -533,10 +577,11 @@ function calibrateGitignore(targetDir2, pm2) {
533
577
  }
534
578
  function setAgentMode(targetDir2) {
535
579
  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");
580
+ fs3.writeFileSync(
581
+ path3.join(targetDir2, "STARDRIVE_AGENT_MODE.md"),
582
+ "project\n"
583
+ );
584
+ ok("Created STARDRIVE_AGENT_MODE.md");
540
585
  }
541
586
  function installDependencies(targetDir2, projectName2, pm2, skipInstall2) {
542
587
  if (skipInstall2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-stardrive",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "This is the launchpad application to create the Astro Stardrive boilerplate.",
5
5
  "bin": {
6
6
  "create-stardrive": "bin/index.js"