@ghentcdh/create-crouton 0.0.1-alpha.27 → 0.0.1-alpha.28
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/index.js +58 -16
- package/dist/index.js.map +1 -1
- package/dist/templates/nx/root/eslint.config.mjs.tmpl +45 -0
- package/dist/templates/nx/root/package.json.tmpl +9 -2
- package/dist/templates/nx/root/pnpm-workspace.yaml.tmpl +2 -0
- package/dist/templates/nx/root/tsconfig.base.json.tmpl +4 -2
- package/dist/templates/nx/workspace/apps/backend/eslint.config.mjs.tmpl +3 -0
- package/dist/templates/nx/workspace/apps/backend/nodemon.json.tmpl +6 -0
- package/dist/templates/nx/workspace/apps/backend/package.json.tmpl +4 -5
- package/dist/templates/nx/workspace/apps/backend/project.json.tmpl +20 -2
- package/dist/templates/nx/workspace/apps/backend/src/app/app.module.ts.tmpl +1 -1
- package/dist/templates/nx/workspace/apps/backend/tsconfig.json.tmpl +1 -0
- package/dist/templates/nx/workspace/apps/backend/tsup.config.ts.tmpl +31 -0
- package/dist/templates/nx/workspace/apps/frontend/eslint.config.mjs.tmpl +3 -0
- package/dist/templates/nx/workspace/apps/frontend/package.json.tmpl +3 -0
- package/dist/templates/nx/workspace/apps/frontend/project.json.tmpl +1 -1
- package/dist/templates/nx/workspace/apps/frontend/src/main.ts.tmpl +1 -1
- package/dist/templates/nx/workspace/apps/frontend/src/style.css.tmpl +38 -0
- package/dist/templates/nx/workspace/apps/frontend/vite.config.ts.tmpl +3 -1
- package/dist/templates/nx/workspace/generated/default/client/package.json.tmpl +5 -1
- package/dist/templates/nx/workspace/generated/default/types/package.json.tmpl +6 -1
- package/dist/templates/regular/.npmrc.tmpl +1 -0
- package/package.json +3 -3
- package/dist/templates/nx/workspace/apps/backend/nest-cli.json.tmpl +0 -8
package/dist/index.js
CHANGED
|
@@ -19069,7 +19069,7 @@ var SidebarGroupSchema = zod_default.object({
|
|
|
19069
19069
|
/** Human-readable heading shown in the sidebar. Defaults to a title-cased version of the slug. */
|
|
19070
19070
|
label: zod_default.string().optional(),
|
|
19071
19071
|
/** Controls the order of this group among top-level sidebar items. */
|
|
19072
|
-
position: zod_default.
|
|
19072
|
+
position: zod_default.number().optional()
|
|
19073
19073
|
});
|
|
19074
19074
|
var SidebarSchema = zod_default.object({
|
|
19075
19075
|
hide: zod_default.boolean().default(false),
|
|
@@ -19336,6 +19336,7 @@ var buildDatasourceFiles = (opts) => {
|
|
|
19336
19336
|
urlEnv: opts.urlEnv,
|
|
19337
19337
|
generatedTypesImport: opts.generatedTypesImport,
|
|
19338
19338
|
zodOutput,
|
|
19339
|
+
clientOutput,
|
|
19339
19340
|
prismaConfig
|
|
19340
19341
|
};
|
|
19341
19342
|
const clientImport = opts.generatedClientImport ?? relImport(dsDir, clientOutput);
|
|
@@ -19511,7 +19512,9 @@ var runCreate = async (name, opts) => {
|
|
|
19511
19512
|
if (existsSync(targetDir) && !opts.force) {
|
|
19512
19513
|
const entries = await readdir4(targetDir);
|
|
19513
19514
|
if (entries.length > 0) {
|
|
19514
|
-
M2.error(
|
|
19515
|
+
M2.error(
|
|
19516
|
+
`Directory "${name}" already exists and is not empty. Use --force to overwrite.`
|
|
19517
|
+
);
|
|
19515
19518
|
throw new CancelledError();
|
|
19516
19519
|
}
|
|
19517
19520
|
}
|
|
@@ -19544,14 +19547,14 @@ var runCreate = async (name, opts) => {
|
|
|
19544
19547
|
tokens["schemaPath"] = "../../../node_modules/nx/schemas/project-schema.json";
|
|
19545
19548
|
tokens["tsconfigBase"] = "../../../tsconfig.base.json";
|
|
19546
19549
|
tokens["generatedTypesPath"] = `${prefix}/generated/default/types/src`;
|
|
19547
|
-
tokens["generatedClientPath"] = `${prefix}/generated/default/client
|
|
19550
|
+
tokens["generatedClientPath"] = `${prefix}/generated/default/client`;
|
|
19548
19551
|
} else {
|
|
19549
19552
|
tokens["noPrefix"] = "true";
|
|
19550
19553
|
tokens["appsRoot"] = "apps";
|
|
19551
19554
|
tokens["schemaPath"] = "../../node_modules/nx/schemas/project-schema.json";
|
|
19552
19555
|
tokens["tsconfigBase"] = "../../tsconfig.base.json";
|
|
19553
19556
|
tokens["generatedTypesPath"] = "generated/default/types/src";
|
|
19554
|
-
tokens["generatedClientPath"] = "generated/default/client
|
|
19557
|
+
tokens["generatedClientPath"] = "generated/default/client";
|
|
19555
19558
|
}
|
|
19556
19559
|
}
|
|
19557
19560
|
if (frontend) {
|
|
@@ -19561,20 +19564,36 @@ var runCreate = async (name, opts) => {
|
|
|
19561
19564
|
const skipPaths = !frontend ? ["apps/frontend"] : [];
|
|
19562
19565
|
if (layout === "nx") {
|
|
19563
19566
|
const rootTemplateDir = resolve2(templateRoot, "nx", "root");
|
|
19564
|
-
const rootFiles = await loadAndRenderTemplates(
|
|
19567
|
+
const rootFiles = await loadAndRenderTemplates(
|
|
19568
|
+
rootTemplateDir,
|
|
19569
|
+
"",
|
|
19570
|
+
tokens,
|
|
19571
|
+
targetDir
|
|
19572
|
+
);
|
|
19565
19573
|
const files = [...rootFiles];
|
|
19566
19574
|
const workspaceTemplateDir = resolve2(templateRoot, "nx", "workspace");
|
|
19567
19575
|
const workspaceTarget = prefix ? resolve2(targetDir, prefix) : targetDir;
|
|
19568
|
-
const workspaceFiles = await loadAndRenderTemplates(
|
|
19576
|
+
const workspaceFiles = await loadAndRenderTemplates(
|
|
19577
|
+
workspaceTemplateDir,
|
|
19578
|
+
"",
|
|
19579
|
+
tokens,
|
|
19580
|
+
workspaceTarget,
|
|
19581
|
+
skipPaths
|
|
19582
|
+
);
|
|
19569
19583
|
files.push(...workspaceFiles);
|
|
19570
19584
|
if (opts.docker !== false) {
|
|
19571
19585
|
const dockerDir = resolve2(templateRoot, "docker");
|
|
19572
|
-
const dockerFiles = await loadAndRenderTemplates(
|
|
19586
|
+
const dockerFiles = await loadAndRenderTemplates(
|
|
19587
|
+
dockerDir,
|
|
19588
|
+
"",
|
|
19589
|
+
tokens,
|
|
19590
|
+
targetDir
|
|
19591
|
+
);
|
|
19573
19592
|
files.push(...dockerFiles);
|
|
19574
19593
|
}
|
|
19575
19594
|
const dataSourcesDir = "apps/backend/src/app/data-sources";
|
|
19576
|
-
const generatedImport = `@${name}/generated
|
|
19577
|
-
const generatedClientImport = `@${name}/generated
|
|
19595
|
+
const generatedImport = `@${name}/generated-default-types`;
|
|
19596
|
+
const generatedClientImport = `@${name}/generated-default-client`;
|
|
19578
19597
|
const { files: dsFiles } = buildDatasourceFiles({
|
|
19579
19598
|
name: "default",
|
|
19580
19599
|
dataSourcesDir,
|
|
@@ -19584,21 +19603,35 @@ var runCreate = async (name, opts) => {
|
|
|
19584
19603
|
type: "postgres",
|
|
19585
19604
|
default: true,
|
|
19586
19605
|
zodOutput: "generated/default/types/src",
|
|
19587
|
-
clientOutput: "generated/default/client
|
|
19606
|
+
clientOutput: "generated/default/client"
|
|
19588
19607
|
});
|
|
19589
19608
|
for (const f of dsFiles) {
|
|
19590
|
-
files.push({
|
|
19609
|
+
files.push({
|
|
19610
|
+
path: resolve2(workspaceTarget, f.path),
|
|
19611
|
+
contents: f.contents
|
|
19612
|
+
});
|
|
19591
19613
|
}
|
|
19592
19614
|
const written = await writeFiles(files, { force: opts.force });
|
|
19593
19615
|
M2.success(`Wrote ${written} file(s) to ${import_picocolors3.default.cyan(name)}/`);
|
|
19594
19616
|
await postScaffold(opts, targetDir, pm, dbUrl, prefix);
|
|
19595
19617
|
} else {
|
|
19596
19618
|
const templateDir = resolve2(templateRoot, "regular");
|
|
19597
|
-
const files = await loadAndRenderTemplates(
|
|
19619
|
+
const files = await loadAndRenderTemplates(
|
|
19620
|
+
templateDir,
|
|
19621
|
+
"",
|
|
19622
|
+
tokens,
|
|
19623
|
+
targetDir,
|
|
19624
|
+
skipPaths
|
|
19625
|
+
);
|
|
19598
19626
|
if (opts.docker !== false) {
|
|
19599
19627
|
const dockerTokens = { ...tokens, regular: "true" };
|
|
19600
19628
|
const dockerDir = resolve2(templateRoot, "docker");
|
|
19601
|
-
const dockerFiles = await loadAndRenderTemplates(
|
|
19629
|
+
const dockerFiles = await loadAndRenderTemplates(
|
|
19630
|
+
dockerDir,
|
|
19631
|
+
"",
|
|
19632
|
+
dockerTokens,
|
|
19633
|
+
targetDir
|
|
19634
|
+
);
|
|
19602
19635
|
files.push(...dockerFiles);
|
|
19603
19636
|
}
|
|
19604
19637
|
const dataSourcesDir = "src/data-sources";
|
|
@@ -19613,7 +19646,7 @@ var runCreate = async (name, opts) => {
|
|
|
19613
19646
|
type: "postgres",
|
|
19614
19647
|
default: true,
|
|
19615
19648
|
zodOutput: "generated/default/types/src",
|
|
19616
|
-
clientOutput: "generated/default/client
|
|
19649
|
+
clientOutput: "generated/default/client"
|
|
19617
19650
|
});
|
|
19618
19651
|
for (const f of dsFiles) {
|
|
19619
19652
|
files.push({ path: resolve2(targetDir, f.path), contents: f.contents });
|
|
@@ -19695,7 +19728,10 @@ var resolveLayout = async (opts) => {
|
|
|
19695
19728
|
message: "Project layout",
|
|
19696
19729
|
options: [
|
|
19697
19730
|
{ value: "regular", label: "Regular (single NestJS app)" },
|
|
19698
|
-
{
|
|
19731
|
+
{
|
|
19732
|
+
value: "nx",
|
|
19733
|
+
label: "Nx monorepo (backend + frontend + shared libs)"
|
|
19734
|
+
}
|
|
19699
19735
|
]
|
|
19700
19736
|
})
|
|
19701
19737
|
);
|
|
@@ -19760,7 +19796,13 @@ var loadAndRenderTemplates = async (templateDir, subPath, tokens, targetDir, ski
|
|
|
19760
19796
|
const relPath = subPath ? `${subPath}/${entry.name}` : entry.name;
|
|
19761
19797
|
if (skipPaths.some((sp) => relPath.startsWith(sp))) continue;
|
|
19762
19798
|
if (entry.isDirectory()) {
|
|
19763
|
-
const nested = await loadAndRenderTemplates(
|
|
19799
|
+
const nested = await loadAndRenderTemplates(
|
|
19800
|
+
templateDir,
|
|
19801
|
+
relPath,
|
|
19802
|
+
tokens,
|
|
19803
|
+
targetDir,
|
|
19804
|
+
skipPaths
|
|
19805
|
+
);
|
|
19764
19806
|
files.push(...nested);
|
|
19765
19807
|
} else if (entry.name.endsWith(".tmpl")) {
|
|
19766
19808
|
const raw = await loadTemplate(templateDir, relPath);
|