@bobbykim/manguito-cms-cli 0.1.2 → 0.2.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/index.js +149 -263
- package/package.json +3 -3
- package/dist/templates/.env.example.template +0 -9
- package/dist/templates/.gitignore.template +0 -9
- package/dist/templates/README.md.template +0 -61
- package/dist/templates/manguito.config.ts.template +0 -32
- package/dist/templates/package.json.template +0 -26
- package/dist/templates/schemas/content-types/blog-post.json.template +0 -67
- package/dist/templates/schemas/roles.json.template +0 -60
- package/dist/templates/schemas/routes.json.template +0 -5
- package/dist/templates/schemas/taxonomy-types/tag.json.template +0 -19
- package/dist/templates/tsconfig.json.template +0 -15
package/dist/index.js
CHANGED
|
@@ -14475,207 +14475,10 @@ init_esm_shims();
|
|
|
14475
14475
|
import { createRequire as createRequire3 } from "module";
|
|
14476
14476
|
import { Command } from "commander";
|
|
14477
14477
|
|
|
14478
|
-
// src/commands/init.ts
|
|
14479
|
-
init_esm_shims();
|
|
14480
|
-
import { readdirSync, readFileSync, writeFileSync, mkdirSync, existsSync as existsSync2 } from "fs";
|
|
14481
|
-
import { join, dirname, basename, relative } from "path";
|
|
14482
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14483
|
-
|
|
14484
|
-
// src/utils/template.ts
|
|
14485
|
-
init_esm_shims();
|
|
14486
|
-
function renderTemplate(content, vars) {
|
|
14487
|
-
return content.replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] ?? `{{${key}}}`);
|
|
14488
|
-
}
|
|
14489
|
-
|
|
14490
|
-
// src/utils/error.ts
|
|
14491
|
-
init_esm_shims();
|
|
14492
|
-
function printGuidedError(message, hint) {
|
|
14493
|
-
process.stderr.write(`\u2716 ${message}
|
|
14494
|
-
`);
|
|
14495
|
-
if (hint !== void 0) {
|
|
14496
|
-
process.stderr.write(` ${hint}
|
|
14497
|
-
`);
|
|
14498
|
-
}
|
|
14499
|
-
}
|
|
14500
|
-
function printWarning(message, hint) {
|
|
14501
|
-
process.stdout.write(`\u26A0 ${message}
|
|
14502
|
-
`);
|
|
14503
|
-
if (hint !== void 0) {
|
|
14504
|
-
process.stdout.write(` ${hint}
|
|
14505
|
-
`);
|
|
14506
|
-
}
|
|
14507
|
-
}
|
|
14508
|
-
function printSuccess(message) {
|
|
14509
|
-
process.stdout.write(`\u2714 ${message}
|
|
14510
|
-
`);
|
|
14511
|
-
}
|
|
14512
|
-
function printValidationErrors(errors, title, command) {
|
|
14513
|
-
process.stderr.write(`\u2716 ${title}:
|
|
14514
|
-
|
|
14515
|
-
`);
|
|
14516
|
-
const byFile = /* @__PURE__ */ new Map();
|
|
14517
|
-
for (const error51 of errors) {
|
|
14518
|
-
const list = byFile.get(error51.file);
|
|
14519
|
-
if (list !== void 0) {
|
|
14520
|
-
list.push(error51.message);
|
|
14521
|
-
} else {
|
|
14522
|
-
byFile.set(error51.file, [error51.message]);
|
|
14523
|
-
}
|
|
14524
|
-
}
|
|
14525
|
-
for (const [file2, messages] of byFile) {
|
|
14526
|
-
process.stderr.write(` ${file2}
|
|
14527
|
-
`);
|
|
14528
|
-
for (const msg of messages) {
|
|
14529
|
-
process.stderr.write(` ${msg}
|
|
14530
|
-
`);
|
|
14531
|
-
}
|
|
14532
|
-
process.stderr.write("\n");
|
|
14533
|
-
}
|
|
14534
|
-
const noun = errors.length === 1 ? "error" : "errors";
|
|
14535
|
-
process.stderr.write(
|
|
14536
|
-
`${errors.length} ${noun} found. Fix the above and run \`${command}\` again.
|
|
14537
|
-
`
|
|
14538
|
-
);
|
|
14539
|
-
}
|
|
14540
|
-
|
|
14541
|
-
// src/utils/env.ts
|
|
14542
|
-
init_esm_shims();
|
|
14543
|
-
import { existsSync } from "fs";
|
|
14544
|
-
import { config } from "dotenv";
|
|
14545
|
-
function loadEnvFile(filePath) {
|
|
14546
|
-
if (filePath == null) return;
|
|
14547
|
-
if (!existsSync(filePath)) {
|
|
14548
|
-
printGuidedError(
|
|
14549
|
-
`Env file not found: ${filePath}`,
|
|
14550
|
-
"Check the file path and try again."
|
|
14551
|
-
);
|
|
14552
|
-
process.exit(1);
|
|
14553
|
-
}
|
|
14554
|
-
config({ path: filePath });
|
|
14555
|
-
}
|
|
14556
|
-
|
|
14557
|
-
// src/utils/prompt.ts
|
|
14558
|
-
init_esm_shims();
|
|
14559
|
-
import { input, password, confirm, select } from "@inquirer/prompts";
|
|
14560
|
-
function createPromptAdapter() {
|
|
14561
|
-
return {
|
|
14562
|
-
input: (message, defaultValue) => input({ message, ...defaultValue !== void 0 ? { default: defaultValue } : {} }),
|
|
14563
|
-
password: (message) => password({ message, mask: "\u2022" }),
|
|
14564
|
-
confirm: (message) => confirm({ message }),
|
|
14565
|
-
select: (message, choices) => select({
|
|
14566
|
-
message,
|
|
14567
|
-
choices: choices.map((c) => ({ value: c, name: c }))
|
|
14568
|
-
})
|
|
14569
|
-
};
|
|
14570
|
-
}
|
|
14571
|
-
|
|
14572
|
-
// src/commands/init.ts
|
|
14573
|
-
var _filename = fileURLToPath2(import.meta.url);
|
|
14574
|
-
var _dirname = dirname(_filename);
|
|
14575
|
-
var TEMPLATES_DIR = basename(_dirname) === "commands" ? join(_dirname, "..", "templates") : join(_dirname, "templates");
|
|
14576
|
-
var STORAGE_ADAPTERS = {
|
|
14577
|
-
"Local filesystem": {
|
|
14578
|
-
import: `import { createLocalAdapter } from '@bobbykim/manguito-cms-api/storage'`,
|
|
14579
|
-
factory: `createLocalAdapter({ upload_dir: process.env['STORAGE_LOCAL_UPLOAD_DIR'] })`,
|
|
14580
|
-
env: `# Local filesystem storage (files persist under this directory; defaults to ./uploads)
|
|
14581
|
-
# STORAGE_LOCAL_UPLOAD_DIR=./uploads`
|
|
14582
|
-
},
|
|
14583
|
-
"Amazon S3": {
|
|
14584
|
-
import: `import { createS3Adapter } from '@bobbykim/manguito-cms-api/storage'`,
|
|
14585
|
-
factory: `createS3Adapter({
|
|
14586
|
-
bucket: process.env['STORAGE_S3_BUCKET']!,
|
|
14587
|
-
region: process.env['STORAGE_S3_REGION']!,
|
|
14588
|
-
})`,
|
|
14589
|
-
env: `STORAGE_S3_BUCKET=
|
|
14590
|
-
STORAGE_S3_REGION=`
|
|
14591
|
-
},
|
|
14592
|
-
Cloudinary: {
|
|
14593
|
-
import: `import { createCloudinaryAdapter } from '@bobbykim/manguito-cms-api/storage'`,
|
|
14594
|
-
factory: `createCloudinaryAdapter({
|
|
14595
|
-
cloud_name: process.env['CLOUDINARY_CLOUD_NAME'],
|
|
14596
|
-
access_key_id: process.env['CLOUDINARY_API_KEY'],
|
|
14597
|
-
secret_access_key: process.env['CLOUDINARY_API_SECRET'],
|
|
14598
|
-
})`,
|
|
14599
|
-
env: `CLOUDINARY_CLOUD_NAME=
|
|
14600
|
-
CLOUDINARY_API_KEY=
|
|
14601
|
-
CLOUDINARY_API_SECRET=`
|
|
14602
|
-
}
|
|
14603
|
-
};
|
|
14604
|
-
function registerInit(program2) {
|
|
14605
|
-
program2.command("init [name]").description("Scaffold a new Manguito CMS project").option("--env <path>", "path to .env file to load").action(async (name, options) => {
|
|
14606
|
-
loadEnvFile(options.env);
|
|
14607
|
-
await runInit(name, { prompt: createPromptAdapter() });
|
|
14608
|
-
});
|
|
14609
|
-
}
|
|
14610
|
-
async function runInit(name, deps) {
|
|
14611
|
-
const cwd = deps.targetDir ?? process.cwd();
|
|
14612
|
-
const usesCwd = name === void 0 || name === ".";
|
|
14613
|
-
const targetDir = usesCwd ? cwd : join(cwd, name);
|
|
14614
|
-
const displayName = usesCwd ? "." : name;
|
|
14615
|
-
if (existsSync2(targetDir)) {
|
|
14616
|
-
const entries = readdirSync(targetDir);
|
|
14617
|
-
if (entries.length > 0) {
|
|
14618
|
-
printGuidedError(
|
|
14619
|
-
`Directory "${displayName}" already exists and is not empty.`,
|
|
14620
|
-
"Choose a different name, or run `manguito init` inside an empty directory."
|
|
14621
|
-
);
|
|
14622
|
-
return;
|
|
14623
|
-
}
|
|
14624
|
-
}
|
|
14625
|
-
process.stdout.write("Manguito CMS \u2014 New Project\n\n");
|
|
14626
|
-
const projectName = await deps.prompt.input("Project name:", name);
|
|
14627
|
-
const adapterChoice = await deps.prompt.select("Storage adapter:", [
|
|
14628
|
-
"Local filesystem",
|
|
14629
|
-
"Amazon S3",
|
|
14630
|
-
"Cloudinary"
|
|
14631
|
-
]);
|
|
14632
|
-
const storage = STORAGE_ADAPTERS[adapterChoice] ?? STORAGE_ADAPTERS["Local filesystem"];
|
|
14633
|
-
const vars = {
|
|
14634
|
-
projectName,
|
|
14635
|
-
storageImport: storage.import,
|
|
14636
|
-
storageAdapter: storage.factory,
|
|
14637
|
-
storageEnv: storage.env
|
|
14638
|
-
};
|
|
14639
|
-
const templateFiles = walkTemplates(TEMPLATES_DIR);
|
|
14640
|
-
for (const templatePath of templateFiles) {
|
|
14641
|
-
const relPath = relative(TEMPLATES_DIR, templatePath);
|
|
14642
|
-
const outputRelPath = relPath.replace(/\.template$/, "");
|
|
14643
|
-
const outputPath = join(targetDir, outputRelPath);
|
|
14644
|
-
mkdirSync(dirname(outputPath), { recursive: true });
|
|
14645
|
-
writeFileSync(outputPath, renderTemplate(readFileSync(templatePath, "utf8"), vars), "utf8");
|
|
14646
|
-
}
|
|
14647
|
-
const paragraphTypesDir = join(targetDir, "schemas", "paragraph-types");
|
|
14648
|
-
mkdirSync(paragraphTypesDir, { recursive: true });
|
|
14649
|
-
writeFileSync(join(paragraphTypesDir, ".gitkeep"), "", "utf8");
|
|
14650
|
-
printSuccess("Project scaffolded.");
|
|
14651
|
-
process.stdout.write("\nNext steps:\n");
|
|
14652
|
-
if (!usesCwd) {
|
|
14653
|
-
process.stdout.write(` cd ${name}
|
|
14654
|
-
`);
|
|
14655
|
-
}
|
|
14656
|
-
process.stdout.write(" cp .env.example .env\n");
|
|
14657
|
-
process.stdout.write(" # Fill in DB_URL in .env\n");
|
|
14658
|
-
process.stdout.write(" pnpm install\n");
|
|
14659
|
-
process.stdout.write(" manguito dev\n");
|
|
14660
|
-
}
|
|
14661
|
-
function walkTemplates(dir) {
|
|
14662
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
14663
|
-
const files = [];
|
|
14664
|
-
for (const entry of entries) {
|
|
14665
|
-
const fullPath = join(dir, entry.name);
|
|
14666
|
-
if (entry.isDirectory()) {
|
|
14667
|
-
files.push(...walkTemplates(fullPath));
|
|
14668
|
-
} else {
|
|
14669
|
-
files.push(fullPath);
|
|
14670
|
-
}
|
|
14671
|
-
}
|
|
14672
|
-
return files;
|
|
14673
|
-
}
|
|
14674
|
-
|
|
14675
14478
|
// src/commands/build.ts
|
|
14676
14479
|
init_esm_shims();
|
|
14677
|
-
import { mkdirSync
|
|
14678
|
-
import { resolve as resolve3, join as
|
|
14480
|
+
import { mkdirSync, statSync as statSync2, existsSync as existsSync3, readdirSync as readdirSync2, writeFileSync } from "fs";
|
|
14481
|
+
import { resolve as resolve3, join as join6, dirname } from "path";
|
|
14679
14482
|
import { createRequire } from "module";
|
|
14680
14483
|
import { build as viteBuild } from "vite";
|
|
14681
14484
|
import { build as tsupBuild } from "tsup";
|
|
@@ -14787,7 +14590,7 @@ __export(external_exports, {
|
|
|
14787
14590
|
clone: () => clone,
|
|
14788
14591
|
codec: () => codec,
|
|
14789
14592
|
coerce: () => coerce_exports,
|
|
14790
|
-
config: () =>
|
|
14593
|
+
config: () => config,
|
|
14791
14594
|
core: () => core_exports2,
|
|
14792
14595
|
cuid: () => cuid3,
|
|
14793
14596
|
cuid2: () => cuid22,
|
|
@@ -15170,7 +14973,7 @@ __export(core_exports2, {
|
|
|
15170
14973
|
_xid: () => _xid,
|
|
15171
14974
|
_xor: () => _xor,
|
|
15172
14975
|
clone: () => clone,
|
|
15173
|
-
config: () =>
|
|
14976
|
+
config: () => config,
|
|
15174
14977
|
createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
|
|
15175
14978
|
createToJSONSchemaMethod: () => createToJSONSchemaMethod,
|
|
15176
14979
|
decode: () => decode,
|
|
@@ -15282,7 +15085,7 @@ var $ZodEncodeError = class extends Error {
|
|
|
15282
15085
|
};
|
|
15283
15086
|
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
15284
15087
|
var globalConfig = globalThis.__zod_globalConfig;
|
|
15285
|
-
function
|
|
15088
|
+
function config(newConfig) {
|
|
15286
15089
|
if (newConfig)
|
|
15287
15090
|
Object.assign(globalConfig, newConfig);
|
|
15288
15091
|
return globalConfig;
|
|
@@ -16138,7 +15941,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
16138
15941
|
throw new $ZodAsyncError();
|
|
16139
15942
|
}
|
|
16140
15943
|
if (result.issues.length) {
|
|
16141
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
15944
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
16142
15945
|
captureStackTrace(e, _params?.callee);
|
|
16143
15946
|
throw e;
|
|
16144
15947
|
}
|
|
@@ -16151,7 +15954,7 @@ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
16151
15954
|
if (result instanceof Promise)
|
|
16152
15955
|
result = await result;
|
|
16153
15956
|
if (result.issues.length) {
|
|
16154
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
15957
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
16155
15958
|
captureStackTrace(e, params?.callee);
|
|
16156
15959
|
throw e;
|
|
16157
15960
|
}
|
|
@@ -16166,7 +15969,7 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
16166
15969
|
}
|
|
16167
15970
|
return result.issues.length ? {
|
|
16168
15971
|
success: false,
|
|
16169
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
15972
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
16170
15973
|
} : { success: true, data: result.value };
|
|
16171
15974
|
};
|
|
16172
15975
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
@@ -16177,7 +15980,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
16177
15980
|
result = await result;
|
|
16178
15981
|
return result.issues.length ? {
|
|
16179
15982
|
success: false,
|
|
16180
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
15983
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
16181
15984
|
} : { success: true, data: result.value };
|
|
16182
15985
|
};
|
|
16183
15986
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
@@ -17921,7 +17724,7 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
17921
17724
|
code: "invalid_union",
|
|
17922
17725
|
input: final.value,
|
|
17923
17726
|
inst,
|
|
17924
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
17727
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
17925
17728
|
});
|
|
17926
17729
|
return final;
|
|
17927
17730
|
}
|
|
@@ -17981,7 +17784,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
17981
17784
|
code: "invalid_union",
|
|
17982
17785
|
input: final.value,
|
|
17983
17786
|
inst,
|
|
17984
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
17787
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
17985
17788
|
});
|
|
17986
17789
|
} else {
|
|
17987
17790
|
final.issues.push({
|
|
@@ -18323,7 +18126,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
18323
18126
|
payload.issues.push({
|
|
18324
18127
|
code: "invalid_key",
|
|
18325
18128
|
origin: "record",
|
|
18326
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
18129
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
18327
18130
|
input: key,
|
|
18328
18131
|
path: [key],
|
|
18329
18132
|
inst
|
|
@@ -18390,7 +18193,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
18390
18193
|
payload.issues.push({
|
|
18391
18194
|
code: "invalid_key",
|
|
18392
18195
|
origin: "record",
|
|
18393
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
18196
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
18394
18197
|
input: key,
|
|
18395
18198
|
path: [key],
|
|
18396
18199
|
inst
|
|
@@ -18461,7 +18264,7 @@ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx)
|
|
|
18461
18264
|
origin: "map",
|
|
18462
18265
|
input: input2,
|
|
18463
18266
|
inst,
|
|
18464
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
18267
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
18465
18268
|
});
|
|
18466
18269
|
}
|
|
18467
18270
|
}
|
|
@@ -18475,7 +18278,7 @@ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx)
|
|
|
18475
18278
|
input: input2,
|
|
18476
18279
|
inst,
|
|
18477
18280
|
key,
|
|
18478
|
-
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
18281
|
+
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
18479
18282
|
});
|
|
18480
18283
|
}
|
|
18481
18284
|
}
|
|
@@ -18749,7 +18552,7 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
18749
18552
|
payload.value = def.catchValue({
|
|
18750
18553
|
...payload,
|
|
18751
18554
|
error: {
|
|
18752
|
-
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
18555
|
+
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
18753
18556
|
},
|
|
18754
18557
|
input: payload.value
|
|
18755
18558
|
});
|
|
@@ -18764,7 +18567,7 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
18764
18567
|
payload.value = def.catchValue({
|
|
18765
18568
|
...payload,
|
|
18766
18569
|
error: {
|
|
18767
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx,
|
|
18570
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
18768
18571
|
},
|
|
18769
18572
|
input: payload.value
|
|
18770
18573
|
});
|
|
@@ -28771,12 +28574,12 @@ var ZodIssueCode = {
|
|
|
28771
28574
|
custom: "custom"
|
|
28772
28575
|
};
|
|
28773
28576
|
function setErrorMap(map2) {
|
|
28774
|
-
|
|
28577
|
+
config({
|
|
28775
28578
|
customError: map2
|
|
28776
28579
|
});
|
|
28777
28580
|
}
|
|
28778
28581
|
function getErrorMap() {
|
|
28779
|
-
return
|
|
28582
|
+
return config().customError;
|
|
28780
28583
|
}
|
|
28781
28584
|
var ZodFirstPartyTypeKind;
|
|
28782
28585
|
/* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
|
|
@@ -29290,7 +29093,7 @@ function date4(params) {
|
|
|
29290
29093
|
}
|
|
29291
29094
|
|
|
29292
29095
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
29293
|
-
|
|
29096
|
+
config(en_default());
|
|
29294
29097
|
|
|
29295
29098
|
// ../core/dist/index.mjs
|
|
29296
29099
|
var import_yaml = __toESM(require_dist(), 1);
|
|
@@ -31417,7 +31220,7 @@ function sql(strings, ...params) {
|
|
|
31417
31220
|
return new SQL([new StringChunk(str2)]);
|
|
31418
31221
|
}
|
|
31419
31222
|
sql2.raw = raw2;
|
|
31420
|
-
function
|
|
31223
|
+
function join11(chunks, separator) {
|
|
31421
31224
|
const result = [];
|
|
31422
31225
|
for (const [i, chunk] of chunks.entries()) {
|
|
31423
31226
|
if (i > 0 && separator !== void 0) {
|
|
@@ -31427,7 +31230,7 @@ function sql(strings, ...params) {
|
|
|
31427
31230
|
}
|
|
31428
31231
|
return new SQL(result);
|
|
31429
31232
|
}
|
|
31430
|
-
sql2.join =
|
|
31233
|
+
sql2.join = join11;
|
|
31431
31234
|
function identifier(value) {
|
|
31432
31235
|
return new Name(value);
|
|
31433
31236
|
}
|
|
@@ -35109,7 +34912,7 @@ var PgSelectQueryBuilderBase = class extends TypedQueryBuilder {
|
|
|
35109
34912
|
const baseTableName = this.tableName;
|
|
35110
34913
|
const tableName = getTableLikeName(table);
|
|
35111
34914
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
35112
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
34915
|
+
if (typeof tableName === "string" && this.config.joins?.some((join11) => join11.alias === tableName)) {
|
|
35113
34916
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
35114
34917
|
}
|
|
35115
34918
|
if (!this.isPartialSelect) {
|
|
@@ -36333,7 +36136,7 @@ var PgUpdateBase = class extends QueryPromise {
|
|
|
36333
36136
|
createJoin(joinType) {
|
|
36334
36137
|
return (table, on) => {
|
|
36335
36138
|
const tableName = getTableLikeName(table);
|
|
36336
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
36139
|
+
if (typeof tableName === "string" && this.config.joins.some((join11) => join11.alias === tableName)) {
|
|
36337
36140
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
36338
36141
|
}
|
|
36339
36142
|
if (typeof on === "function") {
|
|
@@ -36429,10 +36232,10 @@ var PgUpdateBase = class extends QueryPromise {
|
|
|
36429
36232
|
const fromFields = this.getTableLikeFields(this.config.from);
|
|
36430
36233
|
fields[tableName] = fromFields;
|
|
36431
36234
|
}
|
|
36432
|
-
for (const
|
|
36433
|
-
const tableName2 = getTableLikeName(
|
|
36434
|
-
if (typeof tableName2 === "string" && !is(
|
|
36435
|
-
const fromFields = this.getTableLikeFields(
|
|
36235
|
+
for (const join11 of this.config.joins) {
|
|
36236
|
+
const tableName2 = getTableLikeName(join11.table);
|
|
36237
|
+
if (typeof tableName2 === "string" && !is(join11.table, SQL)) {
|
|
36238
|
+
const fromFields = this.getTableLikeFields(join11.table);
|
|
36436
36239
|
fields[tableName2] = fromFields;
|
|
36437
36240
|
}
|
|
36438
36241
|
}
|
|
@@ -42961,7 +42764,7 @@ import { execSync, spawnSync } from "child_process";
|
|
|
42961
42764
|
import crypto2 from "crypto";
|
|
42962
42765
|
import path3 from "path";
|
|
42963
42766
|
import fs2 from "fs/promises";
|
|
42964
|
-
import { readFileSync as
|
|
42767
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
42965
42768
|
import path22 from "path";
|
|
42966
42769
|
function createPostgresAdapter(options = {}) {
|
|
42967
42770
|
const url2 = options.url ?? process.env["DB_URL"];
|
|
@@ -43621,7 +43424,7 @@ function formatAlterColumnType(line2) {
|
|
|
43621
43424
|
function scanMigrationFiles(filePaths) {
|
|
43622
43425
|
const operations = [];
|
|
43623
43426
|
for (const filePath of filePaths) {
|
|
43624
|
-
const content =
|
|
43427
|
+
const content = readFileSync2(filePath, "utf-8");
|
|
43625
43428
|
const lines = content.split("\n");
|
|
43626
43429
|
const filename = path22.basename(filePath);
|
|
43627
43430
|
for (const line2 of lines) {
|
|
@@ -43656,17 +43459,17 @@ function scanMigrationFiles(filePaths) {
|
|
|
43656
43459
|
// src/codegen/registry.ts
|
|
43657
43460
|
init_esm_shims();
|
|
43658
43461
|
import { writeFile } from "fs/promises";
|
|
43659
|
-
import { join as
|
|
43462
|
+
import { join as join2 } from "path";
|
|
43660
43463
|
async function generateSchemaRegistry(registry2, targetDir) {
|
|
43661
43464
|
const content = `export const schemaRegistry = ${JSON.stringify(registry2, null, 2)} as const
|
|
43662
43465
|
`;
|
|
43663
|
-
await writeFile(
|
|
43466
|
+
await writeFile(join2(targetDir, "schema-registry.ts"), content, "utf8");
|
|
43664
43467
|
}
|
|
43665
43468
|
|
|
43666
43469
|
// src/codegen/routes.ts
|
|
43667
43470
|
init_esm_shims();
|
|
43668
43471
|
import { writeFile as writeFile2 } from "fs/promises";
|
|
43669
|
-
import { join as
|
|
43472
|
+
import { join as join3 } from "path";
|
|
43670
43473
|
|
|
43671
43474
|
// ../api/dist/codegen/index.mjs
|
|
43672
43475
|
init_esm_shims();
|
|
@@ -44339,13 +44142,13 @@ function generateRoutes(registry2) {
|
|
|
44339
44142
|
// src/codegen/routes.ts
|
|
44340
44143
|
async function generateRoutes2(registry2, targetDir) {
|
|
44341
44144
|
const content = generateRoutes(registry2);
|
|
44342
|
-
await writeFile2(
|
|
44145
|
+
await writeFile2(join3(targetDir, "routes.ts"), content, "utf8");
|
|
44343
44146
|
}
|
|
44344
44147
|
|
|
44345
44148
|
// src/codegen/forms.ts
|
|
44346
44149
|
init_esm_shims();
|
|
44347
44150
|
import { mkdir, writeFile as writeFile3 } from "fs/promises";
|
|
44348
|
-
import { join as
|
|
44151
|
+
import { join as join4 } from "path";
|
|
44349
44152
|
|
|
44350
44153
|
// ../admin/dist/codegen/index.js
|
|
44351
44154
|
init_esm_shims();
|
|
@@ -44506,19 +44309,19 @@ async function generateForms(registry2, formsDir) {
|
|
|
44506
44309
|
];
|
|
44507
44310
|
for (const schema of schemas) {
|
|
44508
44311
|
const content = generateFormComponent(schema);
|
|
44509
|
-
await writeFile3(
|
|
44312
|
+
await writeFile3(join4(formsDir, `${schema.name}.vue`), content, "utf8");
|
|
44510
44313
|
}
|
|
44511
44314
|
}
|
|
44512
44315
|
|
|
44513
44316
|
// src/codegen/server-entries.ts
|
|
44514
44317
|
init_esm_shims();
|
|
44515
44318
|
import { writeFile as writeFile4 } from "fs/promises";
|
|
44516
|
-
import { join as
|
|
44319
|
+
import { join as join5 } from "path";
|
|
44517
44320
|
async function generateServerEntries(options, targetDir) {
|
|
44518
44321
|
await Promise.all([
|
|
44519
|
-
writeFile4(
|
|
44520
|
-
writeFile4(
|
|
44521
|
-
writeFile4(
|
|
44322
|
+
writeFile4(join5(targetDir, "server.ts"), serverEntry(options), "utf8"),
|
|
44323
|
+
writeFile4(join5(targetDir, "handler.ts"), lambdaEntry(options), "utf8"),
|
|
44324
|
+
writeFile4(join5(targetDir, "vercel.ts"), vercelEntry(options), "utf8")
|
|
44522
44325
|
]);
|
|
44523
44326
|
}
|
|
44524
44327
|
function appSetup() {
|
|
@@ -44698,12 +44501,65 @@ export default handle(app)
|
|
|
44698
44501
|
|
|
44699
44502
|
// src/utils/config.ts
|
|
44700
44503
|
init_esm_shims();
|
|
44701
|
-
import { existsSync
|
|
44504
|
+
import { existsSync } from "fs";
|
|
44702
44505
|
import { resolve as resolve2 } from "path";
|
|
44703
44506
|
import { pathToFileURL } from "url";
|
|
44507
|
+
|
|
44508
|
+
// src/utils/error.ts
|
|
44509
|
+
init_esm_shims();
|
|
44510
|
+
function printGuidedError(message, hint) {
|
|
44511
|
+
process.stderr.write(`\u2716 ${message}
|
|
44512
|
+
`);
|
|
44513
|
+
if (hint !== void 0) {
|
|
44514
|
+
process.stderr.write(` ${hint}
|
|
44515
|
+
`);
|
|
44516
|
+
}
|
|
44517
|
+
}
|
|
44518
|
+
function printWarning(message, hint) {
|
|
44519
|
+
process.stdout.write(`\u26A0 ${message}
|
|
44520
|
+
`);
|
|
44521
|
+
if (hint !== void 0) {
|
|
44522
|
+
process.stdout.write(` ${hint}
|
|
44523
|
+
`);
|
|
44524
|
+
}
|
|
44525
|
+
}
|
|
44526
|
+
function printSuccess(message) {
|
|
44527
|
+
process.stdout.write(`\u2714 ${message}
|
|
44528
|
+
`);
|
|
44529
|
+
}
|
|
44530
|
+
function printValidationErrors(errors, title, command) {
|
|
44531
|
+
process.stderr.write(`\u2716 ${title}:
|
|
44532
|
+
|
|
44533
|
+
`);
|
|
44534
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
44535
|
+
for (const error51 of errors) {
|
|
44536
|
+
const list = byFile.get(error51.file);
|
|
44537
|
+
if (list !== void 0) {
|
|
44538
|
+
list.push(error51.message);
|
|
44539
|
+
} else {
|
|
44540
|
+
byFile.set(error51.file, [error51.message]);
|
|
44541
|
+
}
|
|
44542
|
+
}
|
|
44543
|
+
for (const [file2, messages] of byFile) {
|
|
44544
|
+
process.stderr.write(` ${file2}
|
|
44545
|
+
`);
|
|
44546
|
+
for (const msg of messages) {
|
|
44547
|
+
process.stderr.write(` ${msg}
|
|
44548
|
+
`);
|
|
44549
|
+
}
|
|
44550
|
+
process.stderr.write("\n");
|
|
44551
|
+
}
|
|
44552
|
+
const noun = errors.length === 1 ? "error" : "errors";
|
|
44553
|
+
process.stderr.write(
|
|
44554
|
+
`${errors.length} ${noun} found. Fix the above and run \`${command}\` again.
|
|
44555
|
+
`
|
|
44556
|
+
);
|
|
44557
|
+
}
|
|
44558
|
+
|
|
44559
|
+
// src/utils/config.ts
|
|
44704
44560
|
async function resolveConfig(cwd) {
|
|
44705
44561
|
const configPath = resolve2(cwd, "manguito.config.ts");
|
|
44706
|
-
if (!
|
|
44562
|
+
if (!existsSync(configPath)) {
|
|
44707
44563
|
printGuidedError(
|
|
44708
44564
|
"Config file not found: manguito.config.ts",
|
|
44709
44565
|
"Run this command from your project root, or create a manguito.config.ts file."
|
|
@@ -44733,6 +44589,22 @@ function isValidConfig(value) {
|
|
|
44733
44589
|
return value !== null && typeof value === "object" && "db" in value && "storage" in value && "server" in value && "api" in value && "admin" in value;
|
|
44734
44590
|
}
|
|
44735
44591
|
|
|
44592
|
+
// src/utils/env.ts
|
|
44593
|
+
init_esm_shims();
|
|
44594
|
+
import { existsSync as existsSync2 } from "fs";
|
|
44595
|
+
import { config as config2 } from "dotenv";
|
|
44596
|
+
function loadEnvFile(filePath) {
|
|
44597
|
+
if (filePath == null) return;
|
|
44598
|
+
if (!existsSync2(filePath)) {
|
|
44599
|
+
printGuidedError(
|
|
44600
|
+
`Env file not found: ${filePath}`,
|
|
44601
|
+
"Check the file path and try again."
|
|
44602
|
+
);
|
|
44603
|
+
process.exit(1);
|
|
44604
|
+
}
|
|
44605
|
+
config2({ path: filePath });
|
|
44606
|
+
}
|
|
44607
|
+
|
|
44736
44608
|
// src/commands/build.ts
|
|
44737
44609
|
function registerBuild(program2) {
|
|
44738
44610
|
program2.command("build").description("Run codegen and compile project to dist/").option("--env <path>", "path to .env file to load").action(async (options) => {
|
|
@@ -44803,11 +44675,11 @@ async function runBuild(options, deps) {
|
|
|
44803
44675
|
`Schemas parsed (${contentCount} content types, ${paragraphCount} paragraph types, ${taxonomyCount} taxonomy types${enumPart})`
|
|
44804
44676
|
);
|
|
44805
44677
|
const generatedDir = resolve3(cwd, "dist/generated");
|
|
44806
|
-
|
|
44807
|
-
|
|
44678
|
+
mkdirSync(generatedDir, { recursive: true });
|
|
44679
|
+
writeFileSync(join6(generatedDir, "schema.ts"), generateSchemaFile(registry2), "utf8");
|
|
44808
44680
|
await generateSchemaRegistry(registry2, generatedDir);
|
|
44809
44681
|
await generateRoutes2(registry2, generatedDir);
|
|
44810
|
-
await generateForms(registry2,
|
|
44682
|
+
await generateForms(registry2, join6(generatedDir, "forms"));
|
|
44811
44683
|
await generateServerEntries(
|
|
44812
44684
|
{ adminPrefix: config3.admin.prefix, apiPrefix: config3.api.prefix },
|
|
44813
44685
|
generatedDir
|
|
@@ -44862,23 +44734,23 @@ async function runBuild(options, deps) {
|
|
|
44862
44734
|
}
|
|
44863
44735
|
async function needsRebuild(cwd) {
|
|
44864
44736
|
const sentinel = resolve3(cwd, "dist/generated/schema.ts");
|
|
44865
|
-
if (!
|
|
44737
|
+
if (!existsSync3(sentinel)) return true;
|
|
44866
44738
|
const sentinelMtime = statSync2(sentinel).mtimeMs;
|
|
44867
44739
|
const schemasDir = resolve3(cwd, "schemas");
|
|
44868
|
-
if (!
|
|
44740
|
+
if (!existsSync3(schemasDir)) return false;
|
|
44869
44741
|
return walkFiles(schemasDir).some(
|
|
44870
44742
|
(file2) => statSync2(file2).mtimeMs > sentinelMtime
|
|
44871
44743
|
);
|
|
44872
44744
|
}
|
|
44873
44745
|
function resolveAdminRoot(cwd) {
|
|
44874
|
-
const cwdRequire = createRequire(
|
|
44746
|
+
const cwdRequire = createRequire(join6(cwd, "package.json"));
|
|
44875
44747
|
const adminPkgJson = cwdRequire.resolve("@bobbykim/manguito-cms-admin/package.json");
|
|
44876
|
-
return
|
|
44748
|
+
return dirname(adminPkgJson);
|
|
44877
44749
|
}
|
|
44878
44750
|
function walkFiles(dir) {
|
|
44879
44751
|
const files = [];
|
|
44880
|
-
for (const entry of
|
|
44881
|
-
const full =
|
|
44752
|
+
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
44753
|
+
const full = join6(dir, entry.name);
|
|
44882
44754
|
if (entry.isDirectory()) {
|
|
44883
44755
|
files.push(...walkFiles(full));
|
|
44884
44756
|
} else {
|
|
@@ -44891,7 +44763,7 @@ function walkFiles(dir) {
|
|
|
44891
44763
|
// src/commands/dev.ts
|
|
44892
44764
|
init_esm_shims();
|
|
44893
44765
|
import { createServer as createHttpServer } from "http";
|
|
44894
|
-
import { resolve as resolve5, join as
|
|
44766
|
+
import { resolve as resolve5, join as join9, dirname as dirname2, extname as extname2 } from "path";
|
|
44895
44767
|
import { mkdir as mkdir2, writeFile as writeFile7, watch, readFile } from "fs/promises";
|
|
44896
44768
|
import { createRequire as createRequire2 } from "module";
|
|
44897
44769
|
import { createServer as createViteServer } from "vite";
|
|
@@ -50879,11 +50751,11 @@ function createCmsApp(options) {
|
|
|
50879
50751
|
// src/codegen/drizzle-config.ts
|
|
50880
50752
|
init_esm_shims();
|
|
50881
50753
|
import { writeFile as writeFile5 } from "fs/promises";
|
|
50882
|
-
import { join as
|
|
50754
|
+
import { join as join7, relative, resolve as resolve4 } from "path";
|
|
50883
50755
|
async function generateDrizzleConfig(config3, targetDir) {
|
|
50884
50756
|
const migrationsFolder = config3.migrations?.folder ?? "./migrations";
|
|
50885
50757
|
const migrationsTable = config3.migrations?.table ?? "__manguito_migrations";
|
|
50886
|
-
const outPath =
|
|
50758
|
+
const outPath = relative(resolve4(targetDir), resolve4(migrationsFolder)).replace(/\\/g, "/");
|
|
50887
50759
|
const content = [
|
|
50888
50760
|
`import { defineConfig } from 'drizzle-kit'`,
|
|
50889
50761
|
``,
|
|
@@ -50901,13 +50773,13 @@ async function generateDrizzleConfig(config3, targetDir) {
|
|
|
50901
50773
|
` tablesFilter: ['!${migrationsTable}'],`,
|
|
50902
50774
|
`})`
|
|
50903
50775
|
].join("\n");
|
|
50904
|
-
await writeFile5(
|
|
50776
|
+
await writeFile5(join7(targetDir, "drizzle.config.ts"), content, "utf8");
|
|
50905
50777
|
}
|
|
50906
50778
|
|
|
50907
50779
|
// src/codegen/nav.ts
|
|
50908
50780
|
init_esm_shims();
|
|
50909
50781
|
import { writeFile as writeFile6 } from "fs/promises";
|
|
50910
|
-
import { join as
|
|
50782
|
+
import { join as join8 } from "path";
|
|
50911
50783
|
function schemaBasePath(name) {
|
|
50912
50784
|
const segment = name.includes("--") ? name.slice(name.indexOf("--") + 2) : name;
|
|
50913
50785
|
return segment.replace(/_/g, "-");
|
|
@@ -50925,7 +50797,7 @@ async function generateNav(registry2, targetDir) {
|
|
|
50925
50797
|
})).sort((a2, b2) => a2.label.localeCompare(b2.label));
|
|
50926
50798
|
const content = `export const nav = ${JSON.stringify({ contentTypes, taxonomyTypes }, null, 2)}
|
|
50927
50799
|
`;
|
|
50928
|
-
await writeFile6(
|
|
50800
|
+
await writeFile6(join8(targetDir, "nav.ts"), content, "utf8");
|
|
50929
50801
|
}
|
|
50930
50802
|
|
|
50931
50803
|
// src/utils/db.ts
|
|
@@ -50941,6 +50813,21 @@ async function connectDb(_config) {
|
|
|
50941
50813
|
return adapter;
|
|
50942
50814
|
}
|
|
50943
50815
|
|
|
50816
|
+
// src/utils/prompt.ts
|
|
50817
|
+
init_esm_shims();
|
|
50818
|
+
import { input, password, confirm, select } from "@inquirer/prompts";
|
|
50819
|
+
function createPromptAdapter() {
|
|
50820
|
+
return {
|
|
50821
|
+
input: (message, defaultValue) => input({ message, ...defaultValue !== void 0 ? { default: defaultValue } : {} }),
|
|
50822
|
+
password: (message) => password({ message, mask: "\u2022" }),
|
|
50823
|
+
confirm: (message) => confirm({ message }),
|
|
50824
|
+
select: (message, choices) => select({
|
|
50825
|
+
message,
|
|
50826
|
+
choices: choices.map((c) => ({ value: c, name: c }))
|
|
50827
|
+
})
|
|
50828
|
+
};
|
|
50829
|
+
}
|
|
50830
|
+
|
|
50944
50831
|
// src/commands/dev.ts
|
|
50945
50832
|
var UPLOAD_MIME_MAP = {
|
|
50946
50833
|
jpg: "image/jpeg",
|
|
@@ -50974,7 +50861,7 @@ async function runDev(options, deps) {
|
|
|
50974
50861
|
const needsSeed = !await db.tableExists("users");
|
|
50975
50862
|
const bootstrapRegistry = await parseAllSchemas(cwd, config3);
|
|
50976
50863
|
await generateDrizzleConfig(config3, manguitoDir);
|
|
50977
|
-
await writeFile7(
|
|
50864
|
+
await writeFile7(join9(manguitoDir, "schema.ts"), generateSchemaFile(bootstrapRegistry), "utf8");
|
|
50978
50865
|
await runDevMigration(drizzleConfigPath);
|
|
50979
50866
|
printSuccess(needsSeed ? "Schema tables created" : "Schema tables up to date");
|
|
50980
50867
|
if (needsSeed) {
|
|
@@ -51020,7 +50907,7 @@ async function runDev(options, deps) {
|
|
|
51020
50907
|
);
|
|
51021
50908
|
await generateSchemaRegistry(registry2, manguitoDir);
|
|
51022
50909
|
await generateRoutes2(registry2, manguitoDir);
|
|
51023
|
-
await generateForms(registry2,
|
|
50910
|
+
await generateForms(registry2, join9(manguitoDir, "forms"));
|
|
51024
50911
|
await generateNav(registry2, manguitoDir);
|
|
51025
50912
|
const adapter = createCmsApp({
|
|
51026
50913
|
name: config3.name,
|
|
@@ -51121,10 +51008,10 @@ async function onSchemaFileChange(args) {
|
|
|
51121
51008
|
return;
|
|
51122
51009
|
}
|
|
51123
51010
|
await generateDrizzleConfig(config3, manguitoDir);
|
|
51124
|
-
await writeFile7(
|
|
51011
|
+
await writeFile7(join9(manguitoDir, "schema.ts"), generateSchemaFile(registry2), "utf8");
|
|
51125
51012
|
await generateSchemaRegistry(registry2, manguitoDir);
|
|
51126
51013
|
await generateRoutes2(registry2, manguitoDir);
|
|
51127
|
-
await generateForms(registry2,
|
|
51014
|
+
await generateForms(registry2, join9(manguitoDir, "forms"));
|
|
51128
51015
|
await generateNav(registry2, manguitoDir);
|
|
51129
51016
|
try {
|
|
51130
51017
|
await runDevMigration(drizzleConfigPath);
|
|
@@ -51186,9 +51073,9 @@ async function parseAllSchemas(cwd, config3) {
|
|
|
51186
51073
|
return buildSchemaRegistry(parsedSchemas, routesResult.value, rolesResult.value);
|
|
51187
51074
|
}
|
|
51188
51075
|
function resolveAdminRoot2(cwd) {
|
|
51189
|
-
const cwdRequire = createRequire2(
|
|
51076
|
+
const cwdRequire = createRequire2(join9(cwd, "package.json"));
|
|
51190
51077
|
const adminPkgJson = cwdRequire.resolve("@bobbykim/manguito-cms-admin/package.json");
|
|
51191
|
-
return
|
|
51078
|
+
return dirname2(adminPkgJson);
|
|
51192
51079
|
}
|
|
51193
51080
|
async function bridgeToHono(req, res, honoFetch) {
|
|
51194
51081
|
const host = req.headers.host ?? "localhost";
|
|
@@ -51324,7 +51211,7 @@ async function runStart(options, deps) {
|
|
|
51324
51211
|
|
|
51325
51212
|
// src/commands/migrate.ts
|
|
51326
51213
|
init_esm_shims();
|
|
51327
|
-
import { resolve as resolve7, join as
|
|
51214
|
+
import { resolve as resolve7, join as join10 } from "path";
|
|
51328
51215
|
import { readFile as readFile2 } from "fs/promises";
|
|
51329
51216
|
function registerMigrate(program2) {
|
|
51330
51217
|
program2.command("migrate").description("Apply pending database migrations").option("--env <path>", "path to .env file to load").option("--status", "show migration state without applying").option("--dry-run", "preview migrations without writing").option("--force", "skip destructive-change confirmation prompt").action(async (options) => {
|
|
@@ -51413,7 +51300,7 @@ async function runMigrate(options, deps) {
|
|
|
51413
51300
|
const generatedDir = resolve7(cwd, "dist/generated");
|
|
51414
51301
|
await generateDrizzleConfig(config3, generatedDir);
|
|
51415
51302
|
const newFileNames = await generateMigration(deps.configPath, migrationsFolder);
|
|
51416
|
-
const newFilePaths = newFileNames.map((f) =>
|
|
51303
|
+
const newFilePaths = newFileNames.map((f) => join10(migrationsFolder, f));
|
|
51417
51304
|
printSuccess(
|
|
51418
51305
|
newFileNames.length === 0 ? "No new migration files generated" : `Generated ${newFileNames.length} migration file${newFileNames.length !== 1 ? "s" : ""}: ${newFileNames.join(", ")}`
|
|
51419
51306
|
);
|
|
@@ -51845,7 +51732,6 @@ async function runUsersDemote(options, deps) {
|
|
|
51845
51732
|
var require2 = createRequire3(import.meta.url);
|
|
51846
51733
|
var { version: version3 } = require2("../package.json");
|
|
51847
51734
|
var program = new Command().name("manguito").description("Manguito CMS \u2014 developer lifecycle CLI").version(version3);
|
|
51848
|
-
registerInit(program);
|
|
51849
51735
|
registerBuild(program);
|
|
51850
51736
|
registerDev(program);
|
|
51851
51737
|
registerStart(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobbykim/manguito-cms-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Bobby Kim <bobby.sihun.kim@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/bobbykim89/manguito-cms",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"typescript": "^6.0.3",
|
|
31
31
|
"vite": "^6.4.3",
|
|
32
32
|
"@bobbykim/manguito-cms-admin": "0.1.1",
|
|
33
|
+
"@bobbykim/manguito-cms-db": "0.1.1",
|
|
33
34
|
"@bobbykim/manguito-cms-api": "0.1.1",
|
|
34
|
-
"@bobbykim/manguito-cms-core": "0.1.1"
|
|
35
|
-
"@bobbykim/manguito-cms-db": "0.1.1"
|
|
35
|
+
"@bobbykim/manguito-cms-core": "0.1.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^25.9.5",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
A headless CMS project powered by [Manguito CMS](https://github.com/bobbykim89/manguito-cms).
|
|
4
|
-
|
|
5
|
-
## Getting started
|
|
6
|
-
|
|
7
|
-
1. Copy `.env.example` to `.env` and fill in your credentials:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
cp .env.example .env
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
At minimum, set `DB_URL` and `AUTH_SECRET`.
|
|
14
|
-
|
|
15
|
-
2. Install dependencies:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
pnpm install
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
3. Start the development server:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pnpm dev
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
The first run auto-migrates the database, seeds system roles, and prompts
|
|
28
|
-
you to create the first admin account.
|
|
29
|
-
|
|
30
|
-
Alternatively, run `pnpm migrate` then `pnpm exec manguito createsuperuser` to set up without starting the dev server.
|
|
31
|
-
|
|
32
|
-
## Commands
|
|
33
|
-
|
|
34
|
-
| Command | Description |
|
|
35
|
-
| ----------------- | ----------------------------------------------------- |
|
|
36
|
-
| `pnpm dev` | Start dev server with file watching and auto-migration |
|
|
37
|
-
| `pnpm build` | Run codegen and compile to `dist/` |
|
|
38
|
-
| `pnpm start` | Start production server from `dist/` |
|
|
39
|
-
| `pnpm migrate` | Apply pending database migrations |
|
|
40
|
-
| `pnpm validate` | Validate all schemas and config |
|
|
41
|
-
|
|
42
|
-
Other CLI commands (run via `pnpm exec manguito <command>`): `createsuperuser`, `users:promote`, `users:demote`, `migrate:status`.
|
|
43
|
-
|
|
44
|
-
## Project structure
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
schemas/
|
|
48
|
-
├── content-types/ ← Content type schema definitions
|
|
49
|
-
├── paragraph-types/ ← Reusable paragraph block definitions
|
|
50
|
-
├── taxonomy-types/ ← Taxonomy (tag/category) definitions
|
|
51
|
-
├── enum-types/ ← Enum type definitions
|
|
52
|
-
├── roles.json ← Role hierarchy and permissions
|
|
53
|
-
└── routes.json ← Public API route configuration
|
|
54
|
-
|
|
55
|
-
migrations/ ← Generated database migrations
|
|
56
|
-
|
|
57
|
-
.env.example ← Environment variable template
|
|
58
|
-
manguito.config.ts ← CMS configuration
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Full documentation: https://github.com/bobbykim89/manguito-cms#readme
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '@bobbykim/manguito-cms-core'
|
|
2
|
-
import { createPostgresAdapter } from '@bobbykim/manguito-cms-db'
|
|
3
|
-
{{storageImport}}
|
|
4
|
-
import { createServer, createAPIAdapter } from '@bobbykim/manguito-cms-api'
|
|
5
|
-
import { createAdminAdapter } from '@bobbykim/manguito-cms-admin'
|
|
6
|
-
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
name: '{{projectName}}',
|
|
9
|
-
|
|
10
|
-
schema: {
|
|
11
|
-
base_path: './schemas',
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
db: createPostgresAdapter(),
|
|
15
|
-
|
|
16
|
-
migrations: {
|
|
17
|
-
table: '__manguito_migrations',
|
|
18
|
-
folder: './migrations',
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
// Storage — configured for your chosen adapter. See docs/configuration.md to
|
|
22
|
-
// switch adapters or adjust options.
|
|
23
|
-
storage: {{storageAdapter}},
|
|
24
|
-
|
|
25
|
-
server: createServer({
|
|
26
|
-
cors: { origin: process.env['ALLOWED_ORIGIN'] ?? '*' },
|
|
27
|
-
}),
|
|
28
|
-
|
|
29
|
-
api: createAPIAdapter({ prefix: '/api' }),
|
|
30
|
-
|
|
31
|
-
admin: createAdminAdapter({ prefix: '/admin' }),
|
|
32
|
-
})
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{projectName}}",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "manguito dev",
|
|
8
|
-
"build": "manguito build",
|
|
9
|
-
"start": "manguito start",
|
|
10
|
-
"migrate": "manguito migrate",
|
|
11
|
-
"validate": "manguito validate"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@bobbykim/manguito-cms-admin": "latest",
|
|
15
|
-
"@bobbykim/manguito-cms-api": "latest",
|
|
16
|
-
"@bobbykim/manguito-cms-cli": "latest",
|
|
17
|
-
"@bobbykim/manguito-cms-core": "latest",
|
|
18
|
-
"@bobbykim/manguito-cms-db": "latest"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@types/node": "^22.0.0"
|
|
22
|
-
},
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=22.0.0"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "content--blog_post",
|
|
3
|
-
"label": "Blog Post",
|
|
4
|
-
"type": "content-type",
|
|
5
|
-
"default_base_path": "posts",
|
|
6
|
-
"only_one": false,
|
|
7
|
-
"fields": [
|
|
8
|
-
{
|
|
9
|
-
"tab": {
|
|
10
|
-
"name": "content",
|
|
11
|
-
"label": "Content",
|
|
12
|
-
"fields": [
|
|
13
|
-
{
|
|
14
|
-
"name": "blog_title",
|
|
15
|
-
"label": "Title",
|
|
16
|
-
"type": "text/plain",
|
|
17
|
-
"required": true
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"name": "blog_slug",
|
|
21
|
-
"label": "Slug",
|
|
22
|
-
"type": "text/plain",
|
|
23
|
-
"required": true
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"name": "blog_hero_image",
|
|
27
|
-
"label": "Hero Image",
|
|
28
|
-
"type": "image",
|
|
29
|
-
"required": false
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "blog_body",
|
|
33
|
-
"label": "Body",
|
|
34
|
-
"type": "text/rich",
|
|
35
|
-
"required": true
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "blog_published",
|
|
39
|
-
"label": "Published",
|
|
40
|
-
"type": "boolean",
|
|
41
|
-
"required": false
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"tab": {
|
|
48
|
-
"name": "seo",
|
|
49
|
-
"label": "SEO",
|
|
50
|
-
"fields": [
|
|
51
|
-
{
|
|
52
|
-
"name": "blog_meta_title",
|
|
53
|
-
"label": "Meta Title",
|
|
54
|
-
"type": "text/plain",
|
|
55
|
-
"required": false
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "blog_meta_desc",
|
|
59
|
-
"label": "Meta Description",
|
|
60
|
-
"type": "text/plain",
|
|
61
|
-
"required": false
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"roles": [
|
|
3
|
-
{
|
|
4
|
-
"name": "admin",
|
|
5
|
-
"label": "Administrator",
|
|
6
|
-
"is_system": true,
|
|
7
|
-
"hierarchy_level": 0,
|
|
8
|
-
"permissions": [
|
|
9
|
-
"content:read", "content:create", "content:edit", "content:delete",
|
|
10
|
-
"media:read", "media:create", "media:edit", "media:delete",
|
|
11
|
-
"taxonomy:read", "taxonomy:create", "taxonomy:edit", "taxonomy:delete",
|
|
12
|
-
"users:read", "users:create", "users:edit", "users:delete",
|
|
13
|
-
"roles:read"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"name": "manager",
|
|
18
|
-
"label": "Manager",
|
|
19
|
-
"is_system": true,
|
|
20
|
-
"hierarchy_level": 1,
|
|
21
|
-
"permissions": [
|
|
22
|
-
"content:read", "content:create", "content:edit", "content:delete",
|
|
23
|
-
"media:read", "media:create", "media:edit", "media:delete",
|
|
24
|
-
"taxonomy:read", "taxonomy:create", "taxonomy:edit", "taxonomy:delete",
|
|
25
|
-
"users:read"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"name": "editor",
|
|
30
|
-
"label": "Editor",
|
|
31
|
-
"is_system": true,
|
|
32
|
-
"hierarchy_level": 2,
|
|
33
|
-
"permissions": [
|
|
34
|
-
"content:read", "content:create", "content:edit", "content:delete",
|
|
35
|
-
"media:read", "media:create", "media:edit", "media:delete",
|
|
36
|
-
"taxonomy:read", "taxonomy:create", "taxonomy:edit", "taxonomy:delete"
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "writer",
|
|
41
|
-
"label": "Writer",
|
|
42
|
-
"is_system": true,
|
|
43
|
-
"hierarchy_level": 3,
|
|
44
|
-
"permissions": [
|
|
45
|
-
"content:read", "content:create",
|
|
46
|
-
"media:read", "media:create"
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"name": "viewer",
|
|
51
|
-
"label": "Viewer",
|
|
52
|
-
"is_system": true,
|
|
53
|
-
"hierarchy_level": 4,
|
|
54
|
-
"permissions": [
|
|
55
|
-
"content:read",
|
|
56
|
-
"media:read"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "taxonomy--tag",
|
|
3
|
-
"label": "Tag",
|
|
4
|
-
"type": "taxonomy-type",
|
|
5
|
-
"fields": [
|
|
6
|
-
{
|
|
7
|
-
"name": "tag_name",
|
|
8
|
-
"label": "Name",
|
|
9
|
-
"type": "text/plain",
|
|
10
|
-
"required": true
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"name": "tag_slug",
|
|
14
|
-
"label": "Slug",
|
|
15
|
-
"type": "text/plain",
|
|
16
|
-
"required": true
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "ES2022",
|
|
5
|
-
"module": "NodeNext",
|
|
6
|
-
"moduleResolution": "NodeNext",
|
|
7
|
-
"lib": ["ES2022"],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"noUncheckedIndexedAccess": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"types": ["node"]
|
|
13
|
-
},
|
|
14
|
-
"include": ["manguito.config.ts"]
|
|
15
|
-
}
|