@evcraddock/slug-cli 0.3.0 → 0.4.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.
- package/dist/commands.js +14 -6
- package/package.json +1 -1
package/dist/commands.js
CHANGED
|
@@ -298,17 +298,18 @@ async function assertDirectoryIsMissingOrEmpty(directory) {
|
|
|
298
298
|
throw createInvalidUsageError(`Cannot inspect target directory: ${directory}`);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
async function copyTemplateSite(source, destination) {
|
|
301
|
+
async function copyTemplateSite(source, destination, relativeDirectory = "") {
|
|
302
302
|
const entries = await readdir(source, { withFileTypes: true });
|
|
303
303
|
for (const entry of entries) {
|
|
304
|
-
|
|
304
|
+
const relativePath = relativeDirectory === "" ? entry.name : join(relativeDirectory, entry.name);
|
|
305
|
+
if (shouldExcludeTemplateEntry(relativePath, entry.name)) {
|
|
305
306
|
continue;
|
|
306
307
|
}
|
|
307
308
|
const sourcePath = join(source, entry.name);
|
|
308
309
|
const destinationPath = join(destination, entry.name);
|
|
309
310
|
if (entry.isDirectory()) {
|
|
310
311
|
await mkdir(destinationPath, { recursive: true });
|
|
311
|
-
await copyTemplateSite(sourcePath, destinationPath);
|
|
312
|
+
await copyTemplateSite(sourcePath, destinationPath, relativePath);
|
|
312
313
|
continue;
|
|
313
314
|
}
|
|
314
315
|
if (entry.isFile()) {
|
|
@@ -317,8 +318,15 @@ async function copyTemplateSite(source, destination) {
|
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
}
|
|
320
|
-
|
|
321
|
-
|
|
321
|
+
const GENERATED_SITE_TEST_EXCLUDES = new Set([
|
|
322
|
+
join("src", "__tests__", "dev-environment.test.ts"),
|
|
323
|
+
join("src", "federation", "__tests__", "follow.test.ts"),
|
|
324
|
+
]);
|
|
325
|
+
function shouldExcludeTemplateEntry(relativePath, name) {
|
|
326
|
+
return (GENERATED_SITE_TEST_EXCLUDES.has(relativePath) ||
|
|
327
|
+
TEMPLATE_COPY_EXCLUDES.has(name) ||
|
|
328
|
+
name.endsWith(".log") ||
|
|
329
|
+
name.endsWith(".tsbuildinfo"));
|
|
322
330
|
}
|
|
323
331
|
async function replaceGeneratedSitePlaceholders(directory, options) {
|
|
324
332
|
await updateJsonFile(join(directory, "package.json"), (value) => ({
|
|
@@ -344,7 +352,7 @@ async function replaceGeneratedSitePlaceholders(directory, options) {
|
|
|
344
352
|
],
|
|
345
353
|
[
|
|
346
354
|
"## 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.",
|
|
347
|
-
"## Local development\n\
|
|
355
|
+
"## 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.",
|
|
348
356
|
],
|
|
349
357
|
[
|
|
350
358
|
"## 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)",
|