@ghentcdh/create-crouton 0.0.1-alpha.25 → 0.0.1-alpha.26
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 +261 -146
- package/dist/index.js.map +1 -1
- package/dist/templates/nx/root/pnpm-workspace.yaml.tmpl +6 -0
- package/dist/templates/nx/{tsconfig.base.json.tmpl → root/tsconfig.base.json.tmpl} +1 -1
- package/dist/templates/nx/workspace/.env.tmpl +1 -0
- package/dist/templates/nx/{apps → workspace/apps}/backend/package.json.tmpl +0 -1
- package/dist/templates/nx/workspace/apps/backend/project.json.tmpl +7 -0
- package/dist/templates/nx/workspace/apps/frontend/project.json.tmpl +7 -0
- package/dist/templates/regular/.env.tmpl +1 -1
- package/dist/templates/regular/package.json.tmpl +0 -1
- package/package.json +2 -2
- package/dist/templates/nx/.env.tmpl +0 -1
- package/dist/templates/nx/apps/backend/project.json.tmpl +0 -7
- package/dist/templates/nx/apps/frontend/project.json.tmpl +0 -7
- package/dist/templates/nx/pnpm-workspace.yaml.tmpl +0 -4
- /package/dist/templates/nx/{.gitignore.tmpl → root/.gitignore.tmpl} +0 -0
- /package/dist/templates/nx/{.nvmrc.tmpl → root/.nvmrc.tmpl} +0 -0
- /package/dist/templates/nx/{nx.json.tmpl → root/nx.json.tmpl} +0 -0
- /package/dist/templates/nx/{package.json.tmpl → root/package.json.tmpl} +0 -0
- /package/dist/templates/nx/{.env.example.tmpl → workspace/.env.example.tmpl} +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/backend/nest-cli.json.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/backend/src/app/app.module.ts.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/backend/src/main.ts.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/backend/tsconfig.json.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/frontend/index.html.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/frontend/package.json.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/frontend/src/App.vue.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/frontend/src/api.ts.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/frontend/src/main.ts.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/frontend/tsconfig.json.tmpl +0 -0
- /package/dist/templates/nx/{apps → workspace/apps}/frontend/vite.config.ts.tmpl +0 -0
- /package/dist/templates/nx/{crouton.enums.json.tmpl → workspace/crouton.enums.json.tmpl} +0 -0
- /package/dist/templates/nx/{crouton.json.tmpl → workspace/crouton.json.tmpl} +0 -0
- /package/dist/templates/nx/{generated → workspace/generated}/types/package.json.tmpl +0 -0
package/dist/index.js
CHANGED
|
@@ -2416,8 +2416,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2416
2416
|
if (index < this.args.length) {
|
|
2417
2417
|
value = this.args.slice(index);
|
|
2418
2418
|
if (declaredArg.parseArg) {
|
|
2419
|
-
value = value.reduce((processed,
|
|
2420
|
-
return myParseArg(declaredArg,
|
|
2419
|
+
value = value.reduce((processed, v2) => {
|
|
2420
|
+
return myParseArg(declaredArg, v2, processed);
|
|
2421
2421
|
}, declaredArg.defaultValue);
|
|
2422
2422
|
}
|
|
2423
2423
|
} else if (value === void 0) {
|
|
@@ -3621,6 +3621,7 @@ import { stripVTControlCharacters as S2 } from "util";
|
|
|
3621
3621
|
|
|
3622
3622
|
// ../../node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
|
|
3623
3623
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
3624
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
3624
3625
|
import { stdin as j, stdout as M } from "process";
|
|
3625
3626
|
import * as g from "readline";
|
|
3626
3627
|
import O from "readline";
|
|
@@ -3993,9 +3994,25 @@ var LD = class extends x {
|
|
|
3993
3994
|
this.value = this._value.value;
|
|
3994
3995
|
}
|
|
3995
3996
|
};
|
|
3997
|
+
var RD = class extends x {
|
|
3998
|
+
get valueWithCursor() {
|
|
3999
|
+
if (this.state === "submit") return this.value;
|
|
4000
|
+
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
|
|
4001
|
+
const u2 = this.value.slice(0, this.cursor), [t, ...F2] = this.value.slice(this.cursor);
|
|
4002
|
+
return `${u2}${import_picocolors.default.inverse(t)}${F2.join("")}`;
|
|
4003
|
+
}
|
|
4004
|
+
get cursor() {
|
|
4005
|
+
return this._cursor;
|
|
4006
|
+
}
|
|
4007
|
+
constructor(u2) {
|
|
4008
|
+
super(u2), this.on("finalize", () => {
|
|
4009
|
+
this.value || (this.value = u2.defaultValue);
|
|
4010
|
+
});
|
|
4011
|
+
}
|
|
4012
|
+
};
|
|
3996
4013
|
|
|
3997
4014
|
// ../../node_modules/.pnpm/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
|
|
3998
|
-
var
|
|
4015
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
3999
4016
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
4000
4017
|
import y2 from "process";
|
|
4001
4018
|
function ce() {
|
|
@@ -4028,13 +4045,13 @@ var b2 = (t) => {
|
|
|
4028
4045
|
switch (t) {
|
|
4029
4046
|
case "initial":
|
|
4030
4047
|
case "active":
|
|
4031
|
-
return
|
|
4048
|
+
return import_picocolors2.default.cyan(le);
|
|
4032
4049
|
case "cancel":
|
|
4033
|
-
return
|
|
4050
|
+
return import_picocolors2.default.red(L2);
|
|
4034
4051
|
case "error":
|
|
4035
|
-
return
|
|
4052
|
+
return import_picocolors2.default.yellow(W2);
|
|
4036
4053
|
case "submit":
|
|
4037
|
-
return
|
|
4054
|
+
return import_picocolors2.default.green(C);
|
|
4038
4055
|
}
|
|
4039
4056
|
};
|
|
4040
4057
|
var G2 = (t) => {
|
|
@@ -4042,26 +4059,47 @@ var G2 = (t) => {
|
|
|
4042
4059
|
let l2 = 0;
|
|
4043
4060
|
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
4044
4061
|
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
4045
|
-
return r2.slice(l2, l2 + a).map((p2,
|
|
4046
|
-
const j2 =
|
|
4047
|
-
return j2 || E ?
|
|
4062
|
+
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
4063
|
+
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
4064
|
+
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
4048
4065
|
});
|
|
4049
4066
|
};
|
|
4067
|
+
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
4068
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
4069
|
+
${b2(this.state)} ${t.message}
|
|
4070
|
+
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
4071
|
+
switch (this.state) {
|
|
4072
|
+
case "error":
|
|
4073
|
+
return `${n.trim()}
|
|
4074
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
4075
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
4076
|
+
`;
|
|
4077
|
+
case "submit":
|
|
4078
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
4079
|
+
case "cancel":
|
|
4080
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
4081
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
4082
|
+
default:
|
|
4083
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
4084
|
+
${import_picocolors2.default.cyan(d2)}
|
|
4085
|
+
`;
|
|
4086
|
+
}
|
|
4087
|
+
} }).prompt();
|
|
4050
4088
|
var ye = (t) => {
|
|
4051
4089
|
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
4052
4090
|
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
4053
|
-
const i = `${
|
|
4091
|
+
const i = `${import_picocolors2.default.gray(o)}
|
|
4054
4092
|
${b2(this.state)} ${t.message}
|
|
4055
4093
|
`, s = this.value ? n : r2;
|
|
4056
4094
|
switch (this.state) {
|
|
4057
4095
|
case "submit":
|
|
4058
|
-
return `${i}${
|
|
4096
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
4059
4097
|
case "cancel":
|
|
4060
|
-
return `${i}${
|
|
4061
|
-
${
|
|
4098
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
4099
|
+
${import_picocolors2.default.gray(o)}`;
|
|
4062
4100
|
default:
|
|
4063
|
-
return `${i}${
|
|
4064
|
-
${
|
|
4101
|
+
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
4102
|
+
${import_picocolors2.default.cyan(d2)}
|
|
4065
4103
|
`;
|
|
4066
4104
|
}
|
|
4067
4105
|
} }).prompt();
|
|
@@ -4071,29 +4109,29 @@ var ve = (t) => {
|
|
|
4071
4109
|
const s = r2.label ?? String(r2.value);
|
|
4072
4110
|
switch (i) {
|
|
4073
4111
|
case "selected":
|
|
4074
|
-
return `${
|
|
4112
|
+
return `${import_picocolors2.default.dim(s)}`;
|
|
4075
4113
|
case "active":
|
|
4076
|
-
return `${
|
|
4114
|
+
return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
4077
4115
|
case "cancelled":
|
|
4078
|
-
return `${
|
|
4116
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
4079
4117
|
default:
|
|
4080
|
-
return `${
|
|
4118
|
+
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
4081
4119
|
}
|
|
4082
4120
|
};
|
|
4083
4121
|
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
4084
|
-
const r2 = `${
|
|
4122
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
4085
4123
|
${b2(this.state)} ${t.message}
|
|
4086
4124
|
`;
|
|
4087
4125
|
switch (this.state) {
|
|
4088
4126
|
case "submit":
|
|
4089
|
-
return `${r2}${
|
|
4127
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
4090
4128
|
case "cancel":
|
|
4091
|
-
return `${r2}${
|
|
4092
|
-
${
|
|
4129
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
4130
|
+
${import_picocolors2.default.gray(o)}`;
|
|
4093
4131
|
default:
|
|
4094
|
-
return `${r2}${
|
|
4095
|
-
${
|
|
4096
|
-
${
|
|
4132
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
4133
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
4134
|
+
${import_picocolors2.default.cyan(d2)}
|
|
4097
4135
|
`;
|
|
4098
4136
|
}
|
|
4099
4137
|
} }).prompt();
|
|
@@ -4105,63 +4143,63 @@ ${t}
|
|
|
4105
4143
|
`), i = S2(n).length, s = Math.max(r2.reduce((a, l2) => {
|
|
4106
4144
|
const $2 = S2(l2);
|
|
4107
4145
|
return $2.length > a ? $2.length : a;
|
|
4108
|
-
}, 0), i) + 2, c = r2.map((a) => `${
|
|
4146
|
+
}, 0), i) + 2, c = r2.map((a) => `${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(a)}${" ".repeat(s - S2(a).length)}${import_picocolors2.default.gray(o)}`).join(`
|
|
4109
4147
|
`);
|
|
4110
|
-
process.stdout.write(`${
|
|
4111
|
-
${
|
|
4148
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
4149
|
+
${import_picocolors2.default.green(C)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(_2.repeat(Math.max(s - i - 1, 1)) + me)}
|
|
4112
4150
|
${c}
|
|
4113
|
-
${
|
|
4151
|
+
${import_picocolors2.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
4114
4152
|
`);
|
|
4115
4153
|
};
|
|
4116
4154
|
var xe = (t = "") => {
|
|
4117
|
-
process.stdout.write(`${
|
|
4155
|
+
process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(t)}
|
|
4118
4156
|
|
|
4119
4157
|
`);
|
|
4120
4158
|
};
|
|
4121
4159
|
var Ie = (t = "") => {
|
|
4122
|
-
process.stdout.write(`${
|
|
4160
|
+
process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
|
|
4123
4161
|
`);
|
|
4124
4162
|
};
|
|
4125
4163
|
var Se = (t = "") => {
|
|
4126
|
-
process.stdout.write(`${
|
|
4127
|
-
${
|
|
4164
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
4165
|
+
${import_picocolors2.default.gray(d2)} ${t}
|
|
4128
4166
|
|
|
4129
4167
|
`);
|
|
4130
4168
|
};
|
|
4131
|
-
var M2 = { message: (t = "", { symbol: n =
|
|
4132
|
-
const r2 = [`${
|
|
4169
|
+
var M2 = { message: (t = "", { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
|
|
4170
|
+
const r2 = [`${import_picocolors2.default.gray(o)}`];
|
|
4133
4171
|
if (t) {
|
|
4134
4172
|
const [i, ...s] = t.split(`
|
|
4135
4173
|
`);
|
|
4136
|
-
r2.push(`${n} ${i}`, ...s.map((c) => `${
|
|
4174
|
+
r2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors2.default.gray(o)} ${c}`));
|
|
4137
4175
|
}
|
|
4138
4176
|
process.stdout.write(`${r2.join(`
|
|
4139
4177
|
`)}
|
|
4140
4178
|
`);
|
|
4141
4179
|
}, info: (t) => {
|
|
4142
|
-
M2.message(t, { symbol:
|
|
4180
|
+
M2.message(t, { symbol: import_picocolors2.default.blue(q) });
|
|
4143
4181
|
}, success: (t) => {
|
|
4144
|
-
M2.message(t, { symbol:
|
|
4182
|
+
M2.message(t, { symbol: import_picocolors2.default.green(D) });
|
|
4145
4183
|
}, step: (t) => {
|
|
4146
|
-
M2.message(t, { symbol:
|
|
4184
|
+
M2.message(t, { symbol: import_picocolors2.default.green(C) });
|
|
4147
4185
|
}, warn: (t) => {
|
|
4148
|
-
M2.message(t, { symbol:
|
|
4186
|
+
M2.message(t, { symbol: import_picocolors2.default.yellow(U) });
|
|
4149
4187
|
}, warning: (t) => {
|
|
4150
4188
|
M2.warn(t);
|
|
4151
4189
|
}, error: (t) => {
|
|
4152
|
-
M2.message(t, { symbol:
|
|
4190
|
+
M2.message(t, { symbol: import_picocolors2.default.red(K2) });
|
|
4153
4191
|
} };
|
|
4154
|
-
var J2 = `${
|
|
4192
|
+
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
4155
4193
|
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
4156
4194
|
const n = V2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
4157
4195
|
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
4158
4196
|
const p2 = (m2) => {
|
|
4159
4197
|
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
4160
4198
|
a && N2(h2, m2);
|
|
4161
|
-
},
|
|
4162
|
-
process.on("uncaughtExceptionMonitor",
|
|
4199
|
+
}, v2 = () => p2(2), f = () => p2(1), j2 = () => {
|
|
4200
|
+
process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
|
|
4163
4201
|
}, E = () => {
|
|
4164
|
-
process.removeListener("uncaughtExceptionMonitor",
|
|
4202
|
+
process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
|
|
4165
4203
|
}, B2 = () => {
|
|
4166
4204
|
if ($2 === void 0) return;
|
|
4167
4205
|
i && process.stdout.write(`
|
|
@@ -4173,13 +4211,13 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
4173
4211
|
const h2 = (performance.now() - m2) / 1e3, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
|
|
4174
4212
|
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
|
|
4175
4213
|
}, H = (m2 = "") => {
|
|
4176
|
-
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${
|
|
4214
|
+
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
4177
4215
|
`);
|
|
4178
4216
|
let h2 = 0, w2 = 0;
|
|
4179
4217
|
j2(), c = setInterval(() => {
|
|
4180
4218
|
if (i && l2 === $2) return;
|
|
4181
4219
|
B2(), $2 = l2;
|
|
4182
|
-
const I2 =
|
|
4220
|
+
const I2 = import_picocolors2.default.magenta(n[h2]);
|
|
4183
4221
|
if (i) process.stdout.write(`${I2} ${l2}...`);
|
|
4184
4222
|
else if (t === "timer") process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
4185
4223
|
else {
|
|
@@ -4190,7 +4228,7 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
4190
4228
|
}, r2);
|
|
4191
4229
|
}, N2 = (m2 = "", h2 = 0) => {
|
|
4192
4230
|
a = false, clearInterval(c), B2();
|
|
4193
|
-
const w2 = h2 === 0 ?
|
|
4231
|
+
const w2 = h2 === 0 ? import_picocolors2.default.green(C) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
|
|
4194
4232
|
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
4195
4233
|
`) : process.stdout.write(`${w2} ${l2}
|
|
4196
4234
|
`), E(), s();
|
|
@@ -4201,7 +4239,7 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
4201
4239
|
};
|
|
4202
4240
|
|
|
4203
4241
|
// src/runner.ts
|
|
4204
|
-
var
|
|
4242
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
4205
4243
|
|
|
4206
4244
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
4207
4245
|
var external_exports = {};
|
|
@@ -4883,8 +4921,8 @@ function assertNever(_x) {
|
|
|
4883
4921
|
function assert(_3) {
|
|
4884
4922
|
}
|
|
4885
4923
|
function getEnumValues(entries) {
|
|
4886
|
-
const numericValues = Object.values(entries).filter((
|
|
4887
|
-
const values = Object.entries(entries).filter(([k3, _3]) => numericValues.indexOf(+k3) === -1).map(([_3,
|
|
4924
|
+
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
4925
|
+
const values = Object.entries(entries).filter(([k3, _3]) => numericValues.indexOf(+k3) === -1).map(([_3, v2]) => v2);
|
|
4888
4926
|
return values;
|
|
4889
4927
|
}
|
|
4890
4928
|
function joinValues(array2, separator = "|") {
|
|
@@ -4938,9 +4976,9 @@ function defineLazy(object2, key, getter) {
|
|
|
4938
4976
|
}
|
|
4939
4977
|
return value;
|
|
4940
4978
|
},
|
|
4941
|
-
set(
|
|
4979
|
+
set(v2) {
|
|
4942
4980
|
Object.defineProperty(object2, key, {
|
|
4943
|
-
value:
|
|
4981
|
+
value: v2
|
|
4944
4982
|
// configurable: true,
|
|
4945
4983
|
});
|
|
4946
4984
|
},
|
|
@@ -6627,10 +6665,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
6627
6665
|
v7: 7,
|
|
6628
6666
|
v8: 8
|
|
6629
6667
|
};
|
|
6630
|
-
const
|
|
6631
|
-
if (
|
|
6668
|
+
const v2 = versionMap[def.version];
|
|
6669
|
+
if (v2 === void 0)
|
|
6632
6670
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
6633
|
-
def.pattern ?? (def.pattern = uuid(
|
|
6671
|
+
def.pattern ?? (def.pattern = uuid(v2));
|
|
6634
6672
|
} else
|
|
6635
6673
|
def.pattern ?? (def.pattern = uuid());
|
|
6636
6674
|
$ZodStringFormat.init(inst, def);
|
|
@@ -7235,8 +7273,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
7235
7273
|
const field = shape[key]._zod;
|
|
7236
7274
|
if (field.values) {
|
|
7237
7275
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
7238
|
-
for (const
|
|
7239
|
-
propValues[key].add(
|
|
7276
|
+
for (const v2 of field.values)
|
|
7277
|
+
propValues[key].add(v2);
|
|
7240
7278
|
}
|
|
7241
7279
|
}
|
|
7242
7280
|
return propValues;
|
|
@@ -7531,10 +7569,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
7531
7569
|
const pv = option._zod.propValues;
|
|
7532
7570
|
if (!pv || Object.keys(pv).length === 0)
|
|
7533
7571
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
7534
|
-
for (const [k3,
|
|
7572
|
+
for (const [k3, v2] of Object.entries(pv)) {
|
|
7535
7573
|
if (!propValues[k3])
|
|
7536
7574
|
propValues[k3] = /* @__PURE__ */ new Set();
|
|
7537
|
-
for (const val of
|
|
7575
|
+
for (const val of v2) {
|
|
7538
7576
|
propValues[k3].add(val);
|
|
7539
7577
|
}
|
|
7540
7578
|
}
|
|
@@ -7548,11 +7586,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
7548
7586
|
const values = o2._zod.propValues?.[def.discriminator];
|
|
7549
7587
|
if (!values || values.size === 0)
|
|
7550
7588
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);
|
|
7551
|
-
for (const
|
|
7552
|
-
if (map2.has(
|
|
7553
|
-
throw new Error(`Duplicate discriminator value "${String(
|
|
7589
|
+
for (const v2 of values) {
|
|
7590
|
+
if (map2.has(v2)) {
|
|
7591
|
+
throw new Error(`Duplicate discriminator value "${String(v2)}"`);
|
|
7554
7592
|
}
|
|
7555
|
-
map2.set(
|
|
7593
|
+
map2.set(v2, o2);
|
|
7556
7594
|
}
|
|
7557
7595
|
}
|
|
7558
7596
|
return map2;
|
|
@@ -8191,8 +8229,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
8191
8229
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
8192
8230
|
$ZodType.init(inst, def);
|
|
8193
8231
|
defineLazy(inst._zod, "values", () => {
|
|
8194
|
-
const
|
|
8195
|
-
return
|
|
8232
|
+
const v2 = def.innerType._zod.values;
|
|
8233
|
+
return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
|
|
8196
8234
|
});
|
|
8197
8235
|
inst._zod.parse = (payload, ctx) => {
|
|
8198
8236
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -10589,7 +10627,7 @@ var error17 = () => {
|
|
|
10589
10627
|
if (issue2.values.length === 1) {
|
|
10590
10628
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`;
|
|
10591
10629
|
}
|
|
10592
|
-
const stringified = issue2.values.map((
|
|
10630
|
+
const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
|
|
10593
10631
|
if (issue2.values.length === 2) {
|
|
10594
10632
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`;
|
|
10595
10633
|
}
|
|
@@ -15344,7 +15382,7 @@ function _set(Class2, valueType, params) {
|
|
|
15344
15382
|
}
|
|
15345
15383
|
// @__NO_SIDE_EFFECTS__
|
|
15346
15384
|
function _enum(Class2, values, params) {
|
|
15347
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
15385
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
15348
15386
|
return new Class2({
|
|
15349
15387
|
type: "enum",
|
|
15350
15388
|
entries,
|
|
@@ -15549,8 +15587,8 @@ function _stringbool(Classes, _params) {
|
|
|
15549
15587
|
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
|
|
15550
15588
|
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
|
|
15551
15589
|
if (params.case !== "sensitive") {
|
|
15552
|
-
truthyArray = truthyArray.map((
|
|
15553
|
-
falsyArray = falsyArray.map((
|
|
15590
|
+
truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
15591
|
+
falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
15554
15592
|
}
|
|
15555
15593
|
const truthySet = new Set(truthyArray);
|
|
15556
15594
|
const falsySet = new Set(falsyArray);
|
|
@@ -16092,9 +16130,9 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
16092
16130
|
var enumProcessor = (schema, _ctx, json2, _params) => {
|
|
16093
16131
|
const def = schema._zod.def;
|
|
16094
16132
|
const values = getEnumValues(def.entries);
|
|
16095
|
-
if (values.every((
|
|
16133
|
+
if (values.every((v2) => typeof v2 === "number"))
|
|
16096
16134
|
json2.type = "number";
|
|
16097
|
-
if (values.every((
|
|
16135
|
+
if (values.every((v2) => typeof v2 === "string"))
|
|
16098
16136
|
json2.type = "string";
|
|
16099
16137
|
json2.enum = values;
|
|
16100
16138
|
};
|
|
@@ -16127,13 +16165,13 @@ var literalProcessor = (schema, ctx, json2, _params) => {
|
|
|
16127
16165
|
json2.const = val;
|
|
16128
16166
|
}
|
|
16129
16167
|
} else {
|
|
16130
|
-
if (vals.every((
|
|
16168
|
+
if (vals.every((v2) => typeof v2 === "number"))
|
|
16131
16169
|
json2.type = "number";
|
|
16132
|
-
if (vals.every((
|
|
16170
|
+
if (vals.every((v2) => typeof v2 === "string"))
|
|
16133
16171
|
json2.type = "string";
|
|
16134
|
-
if (vals.every((
|
|
16172
|
+
if (vals.every((v2) => typeof v2 === "boolean"))
|
|
16135
16173
|
json2.type = "boolean";
|
|
16136
|
-
if (vals.every((
|
|
16174
|
+
if (vals.every((v2) => v2 === null))
|
|
16137
16175
|
json2.type = "null";
|
|
16138
16176
|
json2.enum = vals;
|
|
16139
16177
|
}
|
|
@@ -16231,11 +16269,11 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
16231
16269
|
}
|
|
16232
16270
|
const allKeys = new Set(Object.keys(shape));
|
|
16233
16271
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
16234
|
-
const
|
|
16272
|
+
const v2 = def.shape[key]._zod;
|
|
16235
16273
|
if (ctx.io === "input") {
|
|
16236
|
-
return
|
|
16274
|
+
return v2.optin === void 0;
|
|
16237
16275
|
} else {
|
|
16238
|
-
return
|
|
16276
|
+
return v2.optout === void 0;
|
|
16239
16277
|
}
|
|
16240
16278
|
}));
|
|
16241
16279
|
if (requiredKeys.size > 0) {
|
|
@@ -16355,7 +16393,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
16355
16393
|
}
|
|
16356
16394
|
const keyValues = keyType._zod.values;
|
|
16357
16395
|
if (keyValues) {
|
|
16358
|
-
const validKeyValues = [...keyValues].filter((
|
|
16396
|
+
const validKeyValues = [...keyValues].filter((v2) => typeof v2 === "string" || typeof v2 === "number");
|
|
16359
16397
|
if (validKeyValues.length > 0) {
|
|
16360
16398
|
json2.required = validKeyValues;
|
|
16361
16399
|
}
|
|
@@ -16920,12 +16958,12 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
16920
16958
|
});
|
|
16921
16959
|
return bound;
|
|
16922
16960
|
},
|
|
16923
|
-
set(
|
|
16961
|
+
set(v2) {
|
|
16924
16962
|
Object.defineProperty(this, key, {
|
|
16925
16963
|
configurable: true,
|
|
16926
16964
|
writable: true,
|
|
16927
16965
|
enumerable: true,
|
|
16928
|
-
value:
|
|
16966
|
+
value: v2
|
|
16929
16967
|
});
|
|
16930
16968
|
}
|
|
16931
16969
|
});
|
|
@@ -17813,7 +17851,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
17813
17851
|
};
|
|
17814
17852
|
});
|
|
17815
17853
|
function _enum2(values, params) {
|
|
17816
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
17854
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
17817
17855
|
return new ZodEnum({
|
|
17818
17856
|
type: "enum",
|
|
17819
17857
|
entries,
|
|
@@ -18367,10 +18405,10 @@ function convertBaseSchema(schema, ctx) {
|
|
|
18367
18405
|
if (enumValues.length === 1) {
|
|
18368
18406
|
return z2.literal(enumValues[0]);
|
|
18369
18407
|
}
|
|
18370
|
-
if (enumValues.every((
|
|
18408
|
+
if (enumValues.every((v2) => typeof v2 === "string")) {
|
|
18371
18409
|
return z2.enum(enumValues);
|
|
18372
18410
|
}
|
|
18373
|
-
const literalSchemas = enumValues.map((
|
|
18411
|
+
const literalSchemas = enumValues.map((v2) => z2.literal(v2));
|
|
18374
18412
|
if (literalSchemas.length < 2) {
|
|
18375
18413
|
return literalSchemas[0];
|
|
18376
18414
|
}
|
|
@@ -19445,7 +19483,7 @@ var resolveTemplateDir = () => {
|
|
|
19445
19483
|
var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
19446
19484
|
var toTitle = (name) => name.replace(/[-_]+/g, " ").split(" ").map(capitalize).join(" ");
|
|
19447
19485
|
var runCreate = async (name, opts) => {
|
|
19448
|
-
Ie(
|
|
19486
|
+
Ie(import_picocolors3.default.bold(`create-crouton ${import_picocolors3.default.cyan(name)}`));
|
|
19449
19487
|
try {
|
|
19450
19488
|
const targetDir = resolve2(process.cwd(), name);
|
|
19451
19489
|
if (existsSync(targetDir) && !opts.force) {
|
|
@@ -19457,82 +19495,94 @@ var runCreate = async (name, opts) => {
|
|
|
19457
19495
|
}
|
|
19458
19496
|
const layout = await resolveLayout(opts);
|
|
19459
19497
|
const frontend = await resolveFrontend(opts, layout);
|
|
19498
|
+
const prefix = layout === "nx" ? await resolvePrefix(opts) : void 0;
|
|
19460
19499
|
const pm = await resolvePm(opts);
|
|
19500
|
+
const dbUrl = await resolveDbUrl(opts);
|
|
19501
|
+
const dbName = name.replace(/[^a-zA-Z0-9]/g, "_");
|
|
19461
19502
|
const tokens = {
|
|
19462
19503
|
name,
|
|
19463
19504
|
Name: toTitle(name),
|
|
19464
19505
|
year: String((/* @__PURE__ */ new Date()).getFullYear()),
|
|
19465
19506
|
pmRun: pm === "npm" ? "npm run" : pm,
|
|
19466
19507
|
urlEnv: "DATABASE_URL",
|
|
19467
|
-
|
|
19508
|
+
dbUrl: dbUrl || `postgresql://crouton:crouton@localhost:5432/${dbName}?schema=public`,
|
|
19509
|
+
dbName
|
|
19468
19510
|
};
|
|
19469
19511
|
if (layout === "nx") {
|
|
19470
19512
|
tokens["nx"] = "true";
|
|
19471
19513
|
tokens["backendApp"] = "backend";
|
|
19472
19514
|
tokens["frontendApp"] = "frontend";
|
|
19515
|
+
if (prefix) {
|
|
19516
|
+
tokens["prefix"] = prefix;
|
|
19517
|
+
tokens["appsRoot"] = `${prefix}/apps`;
|
|
19518
|
+
tokens["schemaPath"] = "../../../node_modules/nx/schemas/project-schema.json";
|
|
19519
|
+
tokens["generatedTypesPath"] = `${prefix}/generated/types/src`;
|
|
19520
|
+
} else {
|
|
19521
|
+
tokens["noPrefix"] = "true";
|
|
19522
|
+
tokens["appsRoot"] = "apps";
|
|
19523
|
+
tokens["schemaPath"] = "../../node_modules/nx/schemas/project-schema.json";
|
|
19524
|
+
tokens["generatedTypesPath"] = "generated/types/src";
|
|
19525
|
+
}
|
|
19473
19526
|
}
|
|
19474
19527
|
if (frontend) {
|
|
19475
19528
|
tokens["frontend"] = "true";
|
|
19476
19529
|
}
|
|
19477
19530
|
const templateRoot = resolveTemplateDir();
|
|
19478
|
-
const templateDir = layout === "nx" ? resolve2(templateRoot, "nx") : resolve2(templateRoot, "regular");
|
|
19479
19531
|
const skipPaths = !frontend ? ["apps/frontend"] : [];
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
const
|
|
19483
|
-
|
|
19484
|
-
const
|
|
19485
|
-
const
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
s.start("Initializing git repository");
|
|
19506
|
-
try {
|
|
19507
|
-
execSync('git init && git add -A && git commit -m "Initial commit"', {
|
|
19508
|
-
cwd: targetDir,
|
|
19509
|
-
stdio: "pipe"
|
|
19510
|
-
});
|
|
19511
|
-
s.stop("Git repository initialized");
|
|
19512
|
-
} catch {
|
|
19513
|
-
s.stop("Git init failed (non-fatal)");
|
|
19514
|
-
}
|
|
19515
|
-
}
|
|
19516
|
-
if (opts.install !== false) {
|
|
19517
|
-
const s = Y2();
|
|
19518
|
-
s.start(`Installing dependencies with ${pm}`);
|
|
19519
|
-
try {
|
|
19520
|
-
await installDeps(pm, targetDir);
|
|
19521
|
-
s.stop("Dependencies installed");
|
|
19522
|
-
} catch {
|
|
19523
|
-
s.stop("Install failed \u2014 run manually");
|
|
19532
|
+
if (layout === "nx") {
|
|
19533
|
+
const rootTemplateDir = resolve2(templateRoot, "nx", "root");
|
|
19534
|
+
const rootFiles = await loadAndRenderTemplates(rootTemplateDir, "", tokens, targetDir);
|
|
19535
|
+
const files = [...rootFiles];
|
|
19536
|
+
const workspaceTemplateDir = resolve2(templateRoot, "nx", "workspace");
|
|
19537
|
+
const workspaceTarget = prefix ? resolve2(targetDir, prefix) : targetDir;
|
|
19538
|
+
const workspaceFiles = await loadAndRenderTemplates(workspaceTemplateDir, "", tokens, workspaceTarget, skipPaths);
|
|
19539
|
+
files.push(...workspaceFiles);
|
|
19540
|
+
if (opts.docker !== false) {
|
|
19541
|
+
const dockerDir = resolve2(templateRoot, "docker");
|
|
19542
|
+
const dockerFiles = await loadAndRenderTemplates(dockerDir, "", tokens, targetDir);
|
|
19543
|
+
files.push(...dockerFiles);
|
|
19544
|
+
}
|
|
19545
|
+
const dataSourcesDir = "apps/backend/src/app/data-sources";
|
|
19546
|
+
const generatedImport = `@${name}/generated/default`;
|
|
19547
|
+
const { files: dsFiles } = buildDatasourceFiles({
|
|
19548
|
+
name: "default",
|
|
19549
|
+
dataSourcesDir,
|
|
19550
|
+
urlEnv: "DATABASE_URL",
|
|
19551
|
+
generatedTypesImport: generatedImport,
|
|
19552
|
+
type: "postgres",
|
|
19553
|
+
default: true
|
|
19554
|
+
});
|
|
19555
|
+
for (const f of dsFiles) {
|
|
19556
|
+
files.push({ path: resolve2(workspaceTarget, f.path), contents: f.contents });
|
|
19524
19557
|
}
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
|
|
19558
|
+
const written = await writeFiles(files, { force: opts.force });
|
|
19559
|
+
M2.success(`Wrote ${written} file(s) to ${import_picocolors3.default.cyan(name)}/`);
|
|
19560
|
+
await postScaffold(opts, targetDir, pm, dbUrl, prefix);
|
|
19561
|
+
} else {
|
|
19562
|
+
const templateDir = resolve2(templateRoot, "regular");
|
|
19563
|
+
const files = await loadAndRenderTemplates(templateDir, "", tokens, targetDir, skipPaths);
|
|
19564
|
+
if (opts.docker !== false) {
|
|
19565
|
+
const dockerTokens = { ...tokens, regular: "true" };
|
|
19566
|
+
const dockerDir = resolve2(templateRoot, "docker");
|
|
19567
|
+
const dockerFiles = await loadAndRenderTemplates(dockerDir, "", dockerTokens, targetDir);
|
|
19568
|
+
files.push(...dockerFiles);
|
|
19569
|
+
}
|
|
19570
|
+
const dataSourcesDir = "src/data-sources";
|
|
19571
|
+
const generatedImport = "@app/generated/default";
|
|
19572
|
+
const { files: dsFiles } = buildDatasourceFiles({
|
|
19573
|
+
name: "default",
|
|
19574
|
+
dataSourcesDir,
|
|
19575
|
+
urlEnv: "DATABASE_URL",
|
|
19576
|
+
generatedTypesImport: generatedImport,
|
|
19577
|
+
type: "postgres",
|
|
19578
|
+
default: true
|
|
19579
|
+
});
|
|
19580
|
+
for (const f of dsFiles) {
|
|
19581
|
+
files.push({ path: resolve2(targetDir, f.path), contents: f.contents });
|
|
19535
19582
|
}
|
|
19583
|
+
const written = await writeFiles(files, { force: opts.force });
|
|
19584
|
+
M2.success(`Wrote ${written} file(s) to ${import_picocolors3.default.cyan(name)}/`);
|
|
19585
|
+
await postScaffold(opts, targetDir, pm, dbUrl);
|
|
19536
19586
|
}
|
|
19537
19587
|
const pmRun = pm === "npm" ? "npm run" : pm;
|
|
19538
19588
|
Me(
|
|
@@ -19544,7 +19594,7 @@ var runCreate = async (name, opts) => {
|
|
|
19544
19594
|
].filter(Boolean).join("\n"),
|
|
19545
19595
|
"Next steps"
|
|
19546
19596
|
);
|
|
19547
|
-
Se(
|
|
19597
|
+
Se(import_picocolors3.default.green("Project scaffolded."));
|
|
19548
19598
|
} catch (err) {
|
|
19549
19599
|
if (err instanceof CancelledError) {
|
|
19550
19600
|
xe("Cancelled.");
|
|
@@ -19553,6 +19603,47 @@ var runCreate = async (name, opts) => {
|
|
|
19553
19603
|
throw err;
|
|
19554
19604
|
}
|
|
19555
19605
|
};
|
|
19606
|
+
var postScaffold = async (opts, targetDir, pm, dbUrl, prefix) => {
|
|
19607
|
+
if (opts.git !== false) {
|
|
19608
|
+
const s = Y2();
|
|
19609
|
+
s.start("Initializing git repository");
|
|
19610
|
+
try {
|
|
19611
|
+
execSync('git init && git add -A && git commit -m "Initial commit"', {
|
|
19612
|
+
cwd: targetDir,
|
|
19613
|
+
stdio: "pipe"
|
|
19614
|
+
});
|
|
19615
|
+
s.stop("Git repository initialized");
|
|
19616
|
+
} catch {
|
|
19617
|
+
s.stop("Git init failed (non-fatal)");
|
|
19618
|
+
}
|
|
19619
|
+
}
|
|
19620
|
+
if (opts.install !== false) {
|
|
19621
|
+
const s = Y2();
|
|
19622
|
+
s.start(`Installing dependencies with ${pm}`);
|
|
19623
|
+
try {
|
|
19624
|
+
await installDeps(pm, targetDir);
|
|
19625
|
+
s.stop("Dependencies installed");
|
|
19626
|
+
} catch {
|
|
19627
|
+
s.stop("Install failed \u2014 run manually");
|
|
19628
|
+
}
|
|
19629
|
+
if (dbUrl) {
|
|
19630
|
+
try {
|
|
19631
|
+
const s2 = Y2();
|
|
19632
|
+
s2.start("Running prisma generate");
|
|
19633
|
+
const prismaConfigPath = prefix ? `${prefix}/prisma/default/prisma.config.ts` : "prisma/default/prisma.config.ts";
|
|
19634
|
+
execSync(`npx prisma generate --config ${prismaConfigPath}`, {
|
|
19635
|
+
cwd: targetDir,
|
|
19636
|
+
stdio: "pipe"
|
|
19637
|
+
});
|
|
19638
|
+
s2.stop("Prisma client generated");
|
|
19639
|
+
} catch {
|
|
19640
|
+
M2.warn("prisma generate failed \u2014 run it manually after setting up your database.");
|
|
19641
|
+
}
|
|
19642
|
+
} else {
|
|
19643
|
+
M2.info("Skipping prisma generate \u2014 no database URL provided.");
|
|
19644
|
+
}
|
|
19645
|
+
}
|
|
19646
|
+
};
|
|
19556
19647
|
var resolveLayout = async (opts) => {
|
|
19557
19648
|
if (opts.yes) return opts.nx ? "nx" : "regular";
|
|
19558
19649
|
if (opts.nx) return "nx";
|
|
@@ -19578,6 +19669,18 @@ var resolveFrontend = async (opts, layout) => {
|
|
|
19578
19669
|
})
|
|
19579
19670
|
);
|
|
19580
19671
|
};
|
|
19672
|
+
var resolvePrefix = async (opts) => {
|
|
19673
|
+
if (opts.prefix) return opts.prefix;
|
|
19674
|
+
if (opts.yes) return void 0;
|
|
19675
|
+
const prefix = assertNotCancel(
|
|
19676
|
+
await he({
|
|
19677
|
+
message: "Subfolder prefix for apps/config (leave empty for flat layout)",
|
|
19678
|
+
placeholder: "e.g. split",
|
|
19679
|
+
defaultValue: ""
|
|
19680
|
+
})
|
|
19681
|
+
);
|
|
19682
|
+
return prefix.trim() || void 0;
|
|
19683
|
+
};
|
|
19581
19684
|
var resolvePm = async (opts) => {
|
|
19582
19685
|
if (opts.pm) return opts.pm;
|
|
19583
19686
|
if (opts.yes) return "pnpm";
|
|
@@ -19593,6 +19696,18 @@ var resolvePm = async (opts) => {
|
|
|
19593
19696
|
})
|
|
19594
19697
|
);
|
|
19595
19698
|
};
|
|
19699
|
+
var resolveDbUrl = async (opts) => {
|
|
19700
|
+
if (opts.dbUrl) return opts.dbUrl;
|
|
19701
|
+
if (opts.yes) return "";
|
|
19702
|
+
const url2 = assertNotCancel(
|
|
19703
|
+
await he({
|
|
19704
|
+
message: "Database URL (leave empty to skip prisma setup)",
|
|
19705
|
+
placeholder: "postgresql://user:pass@localhost:5432/mydb?schema=public",
|
|
19706
|
+
defaultValue: ""
|
|
19707
|
+
})
|
|
19708
|
+
);
|
|
19709
|
+
return url2.trim();
|
|
19710
|
+
};
|
|
19596
19711
|
var loadAndRenderTemplates = async (templateDir, subPath, tokens, targetDir, skipPaths = []) => {
|
|
19597
19712
|
const files = [];
|
|
19598
19713
|
const dir = subPath ? resolve2(templateDir, subPath) : templateDir;
|
|
@@ -19615,7 +19730,7 @@ var loadAndRenderTemplates = async (templateDir, subPath, tokens, targetDir, ski
|
|
|
19615
19730
|
};
|
|
19616
19731
|
|
|
19617
19732
|
// src/index.ts
|
|
19618
|
-
var program2 = new Command("create-crouton").description("Scaffold a new crouton project").version("0.0.1").argument("[name]", "project name", "my-crouton-app").option("--nx", "use Nx monorepo layout").option("--no-nx", "use regular (non-Nx) layout").option("--no-frontend", "skip frontend app generation").option("--sample", "include sample resource").option("--pm <manager>", "package manager (pnpm | npm | yarn | bun)").option("--no-install", "skip dependency installation").option("--no-git", "skip git init").option("--no-docker", "skip Docker file generation").option("-y, --yes", "accept all defaults (non-interactive)").option("--force", "overwrite existing files").action(async (name, opts) => {
|
|
19733
|
+
var program2 = new Command("create-crouton").description("Scaffold a new crouton project").version("0.0.1").argument("[name]", "project name", "my-crouton-app").option("--nx", "use Nx monorepo layout").option("--no-nx", "use regular (non-Nx) layout").option("--no-frontend", "skip frontend app generation").option("--sample", "include sample resource").option("--pm <manager>", "package manager (pnpm | npm | yarn | bun)").option("--no-install", "skip dependency installation").option("--no-git", "skip git init").option("--prefix <name>", "nest apps/config under a subfolder (Nx only)").option("--no-docker", "skip Docker file generation").option("-y, --yes", "accept all defaults (non-interactive)").option("--force", "overwrite existing files").option("--db-url <url>", "database connection URL (e.g. postgresql://user:pass@localhost:5432/db)").action(async (name, opts) => {
|
|
19619
19734
|
try {
|
|
19620
19735
|
await runCreate(name, opts);
|
|
19621
19736
|
} catch (err) {
|