@percepta/create 4.1.8 → 4.1.10
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 +94 -30
- package/dist/index.js.map +1 -1
- package/dist/{init-CsuO_mu2.js → init-CP3IzRa6.js} +2 -2
- package/dist/{init-CsuO_mu2.js.map → init-CP3IzRa6.js.map} +1 -1
- package/dist/{register-app-mNc1oYVK.js → register-app-Dmnocuuy.js} +88 -34
- package/dist/register-app-Dmnocuuy.js.map +1 -0
- package/dist/{register-os-blueprint-Gdyn0pN1.js → register-os-blueprint-Byf69wrl.js} +2 -2
- package/dist/{register-os-blueprint-Gdyn0pN1.js.map → register-os-blueprint-Byf69wrl.js.map} +1 -1
- package/dist/status-C8SBzB-K.js +27 -0
- package/dist/status-C8SBzB-K.js.map +1 -0
- package/dist/sync-Lsfz8ZH4.js +280 -0
- package/dist/sync-Lsfz8ZH4.js.map +1 -0
- package/dist/{upstream-PNL6DGtl.js → upstream-R8YDvUue.js} +6 -6
- package/dist/upstream-R8YDvUue.js.map +1 -0
- package/package.json +1 -1
- package/templates/infra/os.blueprint.yaml.template +13 -0
- package/templates/monorepo/README.md +13 -0
- package/templates/monorepo/auth/README.md +2 -2
- package/templates/monorepo/auth/package.json +1 -1
- package/templates/monorepo/pnpm-workspace.yaml +8 -0
- package/templates/webapp/.claude/commands/sync.md +11 -10
- package/templates/webapp/.claude/commands/upstream.md +2 -2
- package/templates/webapp/AGENTS.md +4 -4
- package/templates/webapp/README.md +2 -1
- package/templates/webapp/agent-skills/access-control.md +3 -3
- package/templates/webapp/agent-skills/database.md +2 -1
- package/templates/webapp/next.config.ts +1 -1
- package/templates/webapp/package.json.template +2 -2
- package/templates/webapp/scripts/seed.ts +3 -3
- package/templates/webapp/src/app/(settings)/settings/page.tsx +1 -1
- package/templates/webapp/src/drizzle/schema/index.ts +1 -1
- package/templates/webapp/src/lib/auth/index.ts +2 -2
- package/templates/webapp/src/startup-checks.ts +1 -1
- package/dist/register-app-mNc1oYVK.js.map +0 -1
- package/dist/status-BrK9v1yb.js +0 -48
- package/dist/status-BrK9v1yb.js.map +0 -1
- package/dist/sync-DC5DhIBT.js +0 -101
- package/dist/sync-DC5DhIBT.js.map +0 -1
- package/dist/upstream-PNL6DGtl.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -186,10 +186,9 @@ function derivePlaceholders(appName, appTitle, repoName = appName, customerSlug
|
|
|
186
186
|
__MOSAIC_DESIGN_THEME__: designTheme
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
if (options.
|
|
191
|
-
|
|
192
|
-
throw new Error("Mosaic repo path required. Use --mosaic-template-path or set MOSAIC_TEMPLATE_PATH.");
|
|
189
|
+
function resolveMosaicRepoPath(options) {
|
|
190
|
+
if (options.mosaicRepoPath) return path.resolve(options.mosaicRepoPath);
|
|
191
|
+
throw new Error("Mosaic repo path required. Use --mosaic-repo-path.");
|
|
193
192
|
}
|
|
194
193
|
//#endregion
|
|
195
194
|
//#region src/utils/package-metadata.ts
|
|
@@ -573,12 +572,14 @@ function getCompatibleTemplateVersion(manifest, templateType) {
|
|
|
573
572
|
//#endregion
|
|
574
573
|
//#region src/commands/create.ts
|
|
575
574
|
const PACKAGE_MANAGER = "pnpm";
|
|
576
|
-
const
|
|
577
|
-
const
|
|
575
|
+
const MAX_PACKAGE_MANAGER_OUTPUT_CHARS = 64e3;
|
|
576
|
+
const MAX_PACKAGE_MANAGER_OUTPUT_LINES = 80;
|
|
578
577
|
var PackageManagerCommandError = class extends Error {
|
|
578
|
+
command;
|
|
579
579
|
output;
|
|
580
|
-
constructor(message, output) {
|
|
580
|
+
constructor(message, command, output) {
|
|
581
581
|
super(message);
|
|
582
|
+
this.command = command;
|
|
582
583
|
this.output = output;
|
|
583
584
|
this.name = "PackageManagerCommandError";
|
|
584
585
|
}
|
|
@@ -587,13 +588,14 @@ var PackageManagerCommandError = class extends Error {
|
|
|
587
588
|
function shPath(p) {
|
|
588
589
|
return p.split(path.sep).join("/");
|
|
589
590
|
}
|
|
590
|
-
/** Non-blocking
|
|
591
|
-
function
|
|
591
|
+
/** Non-blocking package-manager command so ora can animate. */
|
|
592
|
+
function runPackageManagerCommand(packageManager, cwd, args) {
|
|
592
593
|
return new Promise((resolve, reject) => {
|
|
593
594
|
let output = "";
|
|
595
|
+
const command = `${packageManager} ${args.join(" ")}`;
|
|
594
596
|
const appendOutput = (chunk) => {
|
|
595
597
|
output += chunk.toString();
|
|
596
|
-
if (output.length >
|
|
598
|
+
if (output.length > MAX_PACKAGE_MANAGER_OUTPUT_CHARS) output = output.slice(-64e3);
|
|
597
599
|
};
|
|
598
600
|
const child = spawn(packageManager, args, {
|
|
599
601
|
cwd,
|
|
@@ -606,23 +608,27 @@ function runPackageManagerInstall(packageManager, cwd, args = ["install"]) {
|
|
|
606
608
|
child.stdout?.on("data", appendOutput);
|
|
607
609
|
child.stderr?.on("data", appendOutput);
|
|
608
610
|
child.on("error", (error) => {
|
|
609
|
-
reject(new PackageManagerCommandError(`${
|
|
611
|
+
reject(new PackageManagerCommandError(`${command} failed: ${error.message}`, command, output));
|
|
610
612
|
});
|
|
611
613
|
child.on("close", (code) => {
|
|
612
614
|
if (code === 0) resolve();
|
|
613
|
-
else reject(new PackageManagerCommandError(`${
|
|
615
|
+
else reject(new PackageManagerCommandError(`${command} exited with code ${code ?? "unknown"}`, command, output));
|
|
614
616
|
});
|
|
615
617
|
});
|
|
616
618
|
}
|
|
617
|
-
|
|
619
|
+
/** Non-blocking install so ora can animate (execSync would block timers). */
|
|
620
|
+
function runPackageManagerInstall(packageManager, cwd, args = ["install"]) {
|
|
621
|
+
return runPackageManagerCommand(packageManager, cwd, args);
|
|
622
|
+
}
|
|
623
|
+
function printPackageManagerFailureOutput(error) {
|
|
618
624
|
if (!(error instanceof PackageManagerCommandError)) return;
|
|
619
625
|
const output = error.output.trim();
|
|
620
626
|
if (!output) return;
|
|
621
627
|
const lines = output.split(/\r?\n/);
|
|
622
|
-
const omitted = Math.max(0, lines.length -
|
|
628
|
+
const omitted = Math.max(0, lines.length - MAX_PACKAGE_MANAGER_OUTPUT_LINES);
|
|
623
629
|
const visibleLines = lines.slice(-80);
|
|
624
630
|
console.log();
|
|
625
|
-
console.log(chalk.bold(`Last ${visibleLines.length} lines from
|
|
631
|
+
console.log(chalk.bold(`Last ${visibleLines.length} lines from ${error.command}:`));
|
|
626
632
|
if (omitted > 0) console.log(chalk.dim(`... omitted ${omitted} earlier lines ...`));
|
|
627
633
|
console.log(visibleLines.join("\n"));
|
|
628
634
|
}
|
|
@@ -880,7 +886,51 @@ async function installAtMonorepoRoot(monorepoRoot, installDeps) {
|
|
|
880
886
|
return true;
|
|
881
887
|
} catch (error) {
|
|
882
888
|
spinner.warn(`Failed to install dependencies. Run '${PACKAGE_MANAGER} install' from monorepo root.`);
|
|
883
|
-
|
|
889
|
+
printPackageManagerFailureOutput(error);
|
|
890
|
+
return false;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
async function collectGeneratedFormatTargets(args) {
|
|
894
|
+
const targets = [path.relative(args.monorepoRoot, args.packageDir) || "."];
|
|
895
|
+
if (args.projectType === "webapp") {
|
|
896
|
+
const workflowPath = path.join(args.monorepoRoot, ".github", "workflows", `${path.basename(args.packageDir)}-ryvn-release.yaml`);
|
|
897
|
+
if (await fs.pathExists(workflowPath)) targets.push(path.relative(args.monorepoRoot, workflowPath));
|
|
898
|
+
}
|
|
899
|
+
return targets.map(shPath);
|
|
900
|
+
}
|
|
901
|
+
async function runGeneratedProjectChecks(args) {
|
|
902
|
+
if (!args.installSucceeded) return false;
|
|
903
|
+
const formatArgs = args.scope === "workspace" || !args.packageDir ? ["run", "format"] : [
|
|
904
|
+
"exec",
|
|
905
|
+
"oxfmt",
|
|
906
|
+
...await collectGeneratedFormatTargets({
|
|
907
|
+
monorepoRoot: args.monorepoRoot,
|
|
908
|
+
packageDir: args.packageDir,
|
|
909
|
+
projectType: args.projectType
|
|
910
|
+
})
|
|
911
|
+
];
|
|
912
|
+
const lintArgs = args.scope === "workspace" || !args.packageDir ? ["run", "lint"] : [
|
|
913
|
+
"exec",
|
|
914
|
+
"oxlint",
|
|
915
|
+
shPath(path.relative(args.monorepoRoot, args.packageDir) || ".")
|
|
916
|
+
];
|
|
917
|
+
const formatSpinner = ora("Formatting generated files...").start();
|
|
918
|
+
try {
|
|
919
|
+
await runPackageManagerCommand(PACKAGE_MANAGER, args.monorepoRoot, formatArgs);
|
|
920
|
+
formatSpinner.succeed("Formatted generated files");
|
|
921
|
+
} catch (error) {
|
|
922
|
+
formatSpinner.warn("Generated formatting failed");
|
|
923
|
+
printPackageManagerFailureOutput(error);
|
|
924
|
+
return false;
|
|
925
|
+
}
|
|
926
|
+
const lintSpinner = ora("Linting generated files...").start();
|
|
927
|
+
try {
|
|
928
|
+
await runPackageManagerCommand(PACKAGE_MANAGER, args.monorepoRoot, lintArgs);
|
|
929
|
+
lintSpinner.succeed("Linted generated files");
|
|
930
|
+
return true;
|
|
931
|
+
} catch (error) {
|
|
932
|
+
lintSpinner.warn("Generated lint failed");
|
|
933
|
+
printPackageManagerFailureOutput(error);
|
|
884
934
|
return false;
|
|
885
935
|
}
|
|
886
936
|
}
|
|
@@ -1068,10 +1118,17 @@ async function createProject(options) {
|
|
|
1068
1118
|
});
|
|
1069
1119
|
await warnIfMissingRootNpmrc(monorepoRoot);
|
|
1070
1120
|
const installSucceeded = await installAtMonorepoRoot(monorepoRoot, answers.installDeps);
|
|
1121
|
+
const checksSucceeded = await runGeneratedProjectChecks({
|
|
1122
|
+
monorepoRoot,
|
|
1123
|
+
packageDir,
|
|
1124
|
+
projectType: answers.projectType,
|
|
1125
|
+
scope: "generated-package",
|
|
1126
|
+
installSucceeded
|
|
1127
|
+
});
|
|
1071
1128
|
console.log();
|
|
1072
1129
|
console.log(chalk.green("✔"), chalk.bold(`Created ${typeLabel} at`), chalk.cyan(path.relative(monorepoRoot, packageDir)));
|
|
1073
1130
|
console.log();
|
|
1074
|
-
if (await maybeAutoRunWebapp(packageDir, monorepoRoot, answers.projectType, installSucceeded)) return;
|
|
1131
|
+
if (await maybeAutoRunWebapp(packageDir, monorepoRoot, answers.projectType, installSucceeded && checksSucceeded)) return;
|
|
1075
1132
|
printNextStepsExisting(answers, packageDir, !installSucceeded);
|
|
1076
1133
|
} else {
|
|
1077
1134
|
const isBareMonorepo = answers.projectType === "monorepo";
|
|
@@ -1115,12 +1172,19 @@ async function createProject(options) {
|
|
|
1115
1172
|
templateCommit: getTemplateCommitSource(newWorkspaceManifest)
|
|
1116
1173
|
});
|
|
1117
1174
|
const installSucceeded = await installAtMonorepoRoot(monorepoRoot, answers.installDeps);
|
|
1175
|
+
const checksSucceeded = await runGeneratedProjectChecks({
|
|
1176
|
+
monorepoRoot,
|
|
1177
|
+
packageDir,
|
|
1178
|
+
projectType: answers.projectType,
|
|
1179
|
+
scope: "workspace",
|
|
1180
|
+
installSucceeded
|
|
1181
|
+
});
|
|
1118
1182
|
initGitRepo(monorepoRoot);
|
|
1119
1183
|
console.log();
|
|
1120
1184
|
console.log(chalk.green("✔"), chalk.bold(isBareMonorepo ? `Created ${typeLabel} at` : "Created monorepo at"), chalk.cyan(monorepoRoot));
|
|
1121
1185
|
if (!isBareMonorepo) console.log(chalk.green("✔"), chalk.bold(`Created ${typeLabel} at`), chalk.cyan(`packages/${answers.name}/`));
|
|
1122
1186
|
console.log();
|
|
1123
|
-
if (await maybeAutoRunWebapp(packageDir, monorepoRoot, answers.projectType, installSucceeded)) return;
|
|
1187
|
+
if (await maybeAutoRunWebapp(packageDir, monorepoRoot, answers.projectType, installSucceeded && checksSucceeded)) return;
|
|
1124
1188
|
printNextStepsNew(answers, monorepoRoot, !installSucceeded);
|
|
1125
1189
|
}
|
|
1126
1190
|
}
|
|
@@ -1299,31 +1363,31 @@ program.command("add").description("Add a Mosaic package to the current monorepo
|
|
|
1299
1363
|
});
|
|
1300
1364
|
const infra = program.command("infra").description("Manage Mosaic infra glue");
|
|
1301
1365
|
infra.command("register-os-blueprint").description("Register this customer monorepo's OS blueprint in infra").action(async () => {
|
|
1302
|
-
const { registerOsBlueprintCommand } = await import("./register-os-blueprint-
|
|
1366
|
+
const { registerOsBlueprintCommand } = await import("./register-os-blueprint-Byf69wrl.js");
|
|
1303
1367
|
await registerOsBlueprintCommand();
|
|
1304
1368
|
});
|
|
1305
1369
|
infra.command("register-app").description("Register a webapp database in this customer OS blueprint").argument("<app>", "Webapp package name").action(async (appName) => {
|
|
1306
|
-
const { registerAppCommand } = await import("./register-app-
|
|
1370
|
+
const { registerAppCommand } = await import("./register-app-Dmnocuuy.js");
|
|
1307
1371
|
await registerAppCommand(appName);
|
|
1308
1372
|
});
|
|
1309
|
-
program.command("status").description("Show template sync status for current app").
|
|
1310
|
-
const { statusCommand } = await import("./status-
|
|
1311
|
-
await statusCommand(
|
|
1373
|
+
program.command("status").description("Show template sync status for current app").action(async () => {
|
|
1374
|
+
const { statusCommand } = await import("./status-C8SBzB-K.js");
|
|
1375
|
+
await statusCommand();
|
|
1312
1376
|
});
|
|
1313
|
-
program.command("sync").description("Generate downstream sync context
|
|
1314
|
-
const { syncCommand } = await import("./sync-
|
|
1315
|
-
await syncCommand(
|
|
1377
|
+
program.command("sync").description("Generate downstream sync context for the current workspace").action(async () => {
|
|
1378
|
+
const { syncCommand } = await import("./sync-Lsfz8ZH4.js");
|
|
1379
|
+
await syncCommand();
|
|
1316
1380
|
});
|
|
1317
|
-
program.command("upstream").description("Generate upstream context (app → template)").option("--mosaic-
|
|
1318
|
-
const { upstreamCommand } = await import("./upstream-
|
|
1381
|
+
program.command("upstream").description("Generate upstream context (app → template)").option("--mosaic-repo-path <path>", "Path to local mosaic repo checkout").option("--files <patterns...>", "Specific files to propose upstream").action(async (options) => {
|
|
1382
|
+
const { upstreamCommand } = await import("./upstream-R8YDvUue.js");
|
|
1319
1383
|
await upstreamCommand(options);
|
|
1320
1384
|
});
|
|
1321
1385
|
program.command("init").description("Add .mosaic-template.json to an existing app").option("-t, --type <type>", "Template type (e.g., webapp, library)").option("--template-version <version>", "Template version to set").action(async (options) => {
|
|
1322
|
-
const { initCommand } = await import("./init-
|
|
1386
|
+
const { initCommand } = await import("./init-CP3IzRa6.js");
|
|
1323
1387
|
await initCommand(options);
|
|
1324
1388
|
});
|
|
1325
1389
|
program.parse();
|
|
1326
1390
|
//#endregion
|
|
1327
|
-
export {
|
|
1391
|
+
export { isValidProjectType as a, manifestExists as c, writeManifest as d, detectMonorepo as f, toTitleCase as h, VALID_PROJECT_TYPES as i, readManifest as l, toSnakeCase as m, readWorkspaceManifest as n, validateProjectName as o, toKebabCase as p, getTemplateVersion as r, derivePlaceholders as s, getWorkspaceManifestPath as t, resolveMosaicRepoPath as u };
|
|
1328
1392
|
|
|
1329
1393
|
//# sourceMappingURL=index.js.map
|