create-fullstack-scaffold 0.4.16 → 0.4.18
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/cli/index.js +52 -10
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/template/src/server/module-admin/module.ts +2 -0
- package/template/src/server/module-captcha/module.ts +2 -0
- package/template/src/server/module-chat/module.ts +2 -0
- package/template/src/server/module-content/module.ts +2 -0
- package/template/src/server/module-dispute/module.ts +2 -0
- package/template/src/server/module-file/module.ts +2 -0
- package/template/src/server/module-merchant/module.ts +2 -0
- package/template/src/server/module-order/module.ts +2 -0
- package/template/src/server/module-permission/module.ts +2 -0
- package/template/src/server/module-tenant/module.ts +2 -0
- package/template/src/server/module-ticket/module.ts +2 -0
- package/template/vite.config.ts +3 -2
package/dist/cli/index.js
CHANGED
|
@@ -1690,7 +1690,11 @@ function generateSharedModulesIndex(resolved) {
|
|
|
1690
1690
|
"content",
|
|
1691
1691
|
"captcha"
|
|
1692
1692
|
];
|
|
1693
|
-
const
|
|
1693
|
+
const STANDALONE_SHARED_MODULES2 = {
|
|
1694
|
+
cart: ["CartPage.tsx"],
|
|
1695
|
+
community: ["TopicsPage.tsx"],
|
|
1696
|
+
dashboard: ["DashboardPage.tsx"]
|
|
1697
|
+
};
|
|
1694
1698
|
for (const moduleName of moduleOrder2) {
|
|
1695
1699
|
if (!resolved.modules.has(moduleName)) continue;
|
|
1696
1700
|
const manifest = resolved.modules.get(moduleName);
|
|
@@ -1717,14 +1721,16 @@ function generateSharedModulesIndex(resolved) {
|
|
|
1717
1721
|
}
|
|
1718
1722
|
}
|
|
1719
1723
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1724
|
+
for (const [moduleName, requiredPages] of Object.entries(STANDALONE_SHARED_MODULES2)) {
|
|
1725
|
+
const hasRelevantPage = [...resolved.modules.values()].some(
|
|
1726
|
+
(m) => m.clientPages?.some((p) => requiredPages.includes(p.name + ".tsx")) ?? false
|
|
1727
|
+
);
|
|
1728
|
+
if (!hasRelevantPage) continue;
|
|
1729
|
+
const exports = MODULE_EXPORTS[moduleName];
|
|
1730
|
+
if (!exports) continue;
|
|
1731
|
+
lines.push(`export {
|
|
1725
1732
|
${exports.namedExports.join(",\n ")},
|
|
1726
1733
|
} from './${moduleName}'`);
|
|
1727
|
-
}
|
|
1728
1734
|
}
|
|
1729
1735
|
return lines.join("\n") + "\n";
|
|
1730
1736
|
}
|
|
@@ -3584,17 +3590,20 @@ async function createProject(projectNameOrOptions, useCurrentDir = false, preset
|
|
|
3584
3590
|
let presetId;
|
|
3585
3591
|
let outputDir;
|
|
3586
3592
|
let dryRun;
|
|
3593
|
+
let install;
|
|
3587
3594
|
if (typeof projectNameOrOptions === "string") {
|
|
3588
3595
|
projectName = projectNameOrOptions;
|
|
3589
3596
|
currentDir = useCurrentDir;
|
|
3590
3597
|
presetId = preset;
|
|
3591
3598
|
dryRun = false;
|
|
3599
|
+
install = true;
|
|
3592
3600
|
} else {
|
|
3593
3601
|
projectName = projectNameOrOptions.projectName;
|
|
3594
3602
|
currentDir = projectNameOrOptions.currentDir;
|
|
3595
3603
|
presetId = projectNameOrOptions.preset;
|
|
3596
3604
|
outputDir = projectNameOrOptions.outputDir;
|
|
3597
3605
|
dryRun = projectNameOrOptions.dryRun ?? false;
|
|
3606
|
+
install = projectNameOrOptions.install ?? true;
|
|
3598
3607
|
}
|
|
3599
3608
|
if (!currentDir) {
|
|
3600
3609
|
validateProjectName(projectName);
|
|
@@ -3806,6 +3815,36 @@ async function createProject(projectNameOrOptions, useCurrentDir = false, preset
|
|
|
3806
3815
|
const readmeSpinner = ora("Configuring README.md...").start();
|
|
3807
3816
|
await updateReadme(targetDir, projectName);
|
|
3808
3817
|
readmeSpinner.succeed(chalk.green("README.md configured"));
|
|
3818
|
+
let installSucceeded = false;
|
|
3819
|
+
if (install && !dryRun) {
|
|
3820
|
+
const installSpinner = ora("Installing dependencies...").start();
|
|
3821
|
+
try {
|
|
3822
|
+
const { execSync } = await import('child_process');
|
|
3823
|
+
execSync("npm install --legacy-peer-deps", {
|
|
3824
|
+
cwd: targetDir,
|
|
3825
|
+
stdio: "pipe",
|
|
3826
|
+
timeout: 3e5
|
|
3827
|
+
});
|
|
3828
|
+
installSpinner.succeed(chalk.green("Dependencies installed"));
|
|
3829
|
+
installSucceeded = true;
|
|
3830
|
+
} catch {
|
|
3831
|
+
installSpinner.warn(chalk.yellow("Dependency installation failed (you can run npm install manually)"));
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
if (installSucceeded) {
|
|
3835
|
+
const patchesDir = path.join(targetDir, "patches");
|
|
3836
|
+
if (await fs.pathExists(patchesDir)) {
|
|
3837
|
+
try {
|
|
3838
|
+
const { execSync } = await import('child_process');
|
|
3839
|
+
execSync("npx patch-package", {
|
|
3840
|
+
cwd: targetDir,
|
|
3841
|
+
stdio: "pipe",
|
|
3842
|
+
timeout: 6e4
|
|
3843
|
+
});
|
|
3844
|
+
} catch {
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3809
3848
|
console.log("");
|
|
3810
3849
|
console.log(chalk.green(" \u2713 Project created successfully!"));
|
|
3811
3850
|
console.log(chalk.gray(` Preset: ${selectedPreset.name}`));
|
|
@@ -3815,7 +3854,9 @@ async function createProject(projectNameOrOptions, useCurrentDir = false, preset
|
|
|
3815
3854
|
if (!currentDir && !outputDir) {
|
|
3816
3855
|
console.log(chalk.white(` cd ${projectName}`));
|
|
3817
3856
|
}
|
|
3818
|
-
|
|
3857
|
+
if (!install || !installSucceeded) {
|
|
3858
|
+
console.log(chalk.white(" npm install"));
|
|
3859
|
+
}
|
|
3819
3860
|
if (resolved.hasClient) {
|
|
3820
3861
|
console.log(chalk.white(" npm run dev"));
|
|
3821
3862
|
console.log("");
|
|
@@ -3852,7 +3893,7 @@ var program = new Command();
|
|
|
3852
3893
|
program.name("create-fullstack-scaffold").description("Create a new full-stack scaffold app with Todo List example").version(packageJson.version).argument("[project-name]", "Name of your project").option("-c, --current-dir", "Create project in current directory").option(
|
|
3853
3894
|
"-p, --preset <preset>",
|
|
3854
3895
|
"Template preset to use (fullstack-admin, todo-app, ecommerce, xbrowser-marketplace, forum, cli-only, minimal, saas)"
|
|
3855
|
-
).option("-o, --output-dir <path>", "Output directory (defaults to project name)").option("--dry-run", "Show what would be generated without creating files").action(
|
|
3896
|
+
).option("-o, --output-dir <path>", "Output directory (defaults to project name)").option("--dry-run", "Show what would be generated without creating files").option("--no-install", "Skip automatic dependency installation").action(
|
|
3856
3897
|
async (projectName = "my-fullstack-app", options) => {
|
|
3857
3898
|
console.log("");
|
|
3858
3899
|
console.log(chalk.cyan.bold(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
@@ -3881,7 +3922,8 @@ program.name("create-fullstack-scaffold").description("Create a new full-stack s
|
|
|
3881
3922
|
currentDir: options.currentDir ?? false,
|
|
3882
3923
|
preset,
|
|
3883
3924
|
outputDir: options.outputDir,
|
|
3884
|
-
dryRun: options.dryRun ?? false
|
|
3925
|
+
dryRun: options.dryRun ?? false,
|
|
3926
|
+
install: options.install
|
|
3885
3927
|
});
|
|
3886
3928
|
} catch (error) {
|
|
3887
3929
|
if (error instanceof ScaffoldError) {
|