@evcraddock/slug-cli 0.7.0 → 0.8.0

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/dist/commands.js +18 -19
  2. package/package.json +1 -1
package/dist/commands.js CHANGED
@@ -344,7 +344,7 @@ function shouldExcludeTemplateEntry(relativePath, name) {
344
344
  parts.includes("data") ||
345
345
  parts.includes("coverage") ||
346
346
  relativePath === "src/__tests__/dev-environment.test.ts" ||
347
- relativePath === "src/federation/__tests__/follow.test.ts" ||
347
+ relativePath === "src/federation/__tests__/follow.integration.test.ts" ||
348
348
  relativePath === ".env" ||
349
349
  name.endsWith(".log") ||
350
350
  name.endsWith(".tsbuildinfo"));
@@ -363,25 +363,24 @@ async function replaceGeneratedSitePlaceholders(directory, options) {
363
363
  `intro: ${JSON.stringify(`${options.siteTitle} is ready for posts, feeds, and federation.`)}`,
364
364
  ],
365
365
  ]);
366
- await replaceTextFile(join(directory, "README.md"), [
367
- ["# Slugkit Template Site", `# ${options.siteTitle}`],
368
- [
369
- "This is the in-repo Slugkit template website. It is toolkit source used for local CLI/API development and for `slug init`; it is not itself the deployable website you hand to a site owner. Generated sites should contain this website code without the `slug` CLI source code.\n\nInitialized sites are standalone Slugkit-compatible websites. After `slug init`, the generated site owns its code and may customize routes, templates, styles, assets, and deployment freely while preserving the Slugkit API contract that the `slug` CLI uses.",
370
- "This is a standalone Slugkit-compatible website generated from the Slugkit template. This site owns its code and can customize routes, templates, styles, assets, and deployment freely while preserving the Slugkit API contract that the `slug` CLI uses.",
371
- ],
372
- [
373
- "Local toolkit development can run `make garage-setup` from the Slugkit repository root after `make dev` starts Garage. Standalone initialized sites should configure these values for their own local or production S3-compatible service before uploading media.",
374
- "Configure these values for your own local or production S3-compatible service before uploading media.",
375
- ],
376
- [
377
- "## In-repository development\n\nWhen working inside the Slugkit toolkit repository, start the full local dev environment from the repository root:\n\n```bash\nmake dev\n```\n\nFrom `template/site`, you can also run the app and Tailwind watcher directly in separate terminals:\n\n```bash\nnpm run dev\nnpm run css:watch\n```\n\nRepository-root workspace commands are useful while developing the template itself:\n\n```bash\nnpm run db:migrate --workspace @slugkit/template-site\nnpm run db:status --workspace @slugkit/template-site\nnpm run test --workspace @slugkit/template-site\n```\n\nStandalone initialized sites should use the non-workspace commands shown in the quick start section.",
378
- "## Local development\n\nInstall Overmind if it is not already available, then run the app and Tailwind watcher together from this site directory:\n\n```bash\nmake dev\n```\n\nThe generated `Procfile.dev` runs `npm run dev` for the Hono app and `npm run css:watch` for Tailwind. Use the non-workspace commands shown in the quick start section for migrations and local checks.",
379
- ],
380
- [
381
- "## Related specs\n\n- [Web Spec 08: Template Setup Documentation](../../docs/web-specs/08-template-setup-documentation.md)\n- [CLI Spec 12: Site Init Command](../../docs/cli-specs/12-site-init-command.md)\n- [CLI Specs](../../docs/cli-specs/README.md)\n- [API Route Specs](../../docs/specs/README.md)",
382
- "## Related Slugkit references\n\n- Slugkit API documentation is available from a running site at `/api/v1/docs`.\n- The CLI compatibility check is `slug doctor`.\n- The generated site marker is `.slugkit-site.json`.",
383
- ],
366
+ await writeGeneratedSiteReadme(directory, options);
367
+ }
368
+ async function writeGeneratedSiteReadme(directory, options) {
369
+ const sourcePath = join(directory, "README.generated.md");
370
+ const source = await readFile(sourcePath, "utf8");
371
+ const replacements = new Map([
372
+ ["{{SITE_NAME}}", options.name],
373
+ ["{{SITE_TITLE}}", options.siteTitle],
384
374
  ]);
375
+ let content = source;
376
+ for (const [placeholder, value] of replacements) {
377
+ if (!content.includes(placeholder)) {
378
+ throw createInvalidUsageError(`Generated README is missing placeholder: ${placeholder}`);
379
+ }
380
+ content = content.replaceAll(placeholder, value);
381
+ }
382
+ await writeFile(join(directory, "README.md"), content, "utf8");
383
+ await rm(sourcePath);
385
384
  }
386
385
  function replaceGeneratedSiteWorkspaceDependencies(value) {
387
386
  if (!isRecord(value))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evcraddock/slug-cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Command-line tool for Slugkit sites.",
5
5
  "private": false,
6
6
  "type": "module",