@dartix-software-solutions/create-fullstack-app 2.0.10 → 2.0.12
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.
|
@@ -2969,7 +2969,12 @@ function resolveDependencies(plugins, packageJsonTargets, context) {
|
|
|
2969
2969
|
}
|
|
2970
2970
|
return result;
|
|
2971
2971
|
}
|
|
2972
|
-
function resolveTargetForPlugin(plugin, packageJsonTargets,
|
|
2972
|
+
function resolveTargetForPlugin(plugin, packageJsonTargets, context) {
|
|
2973
|
+
const inferredTarget = inferTargetFromPluginOutputs(plugin, context);
|
|
2974
|
+
if (inferredTarget) {
|
|
2975
|
+
const inferredPackage = packageJsonTargets.find((t) => t.target === inferredTarget);
|
|
2976
|
+
if (inferredPackage) return inferredPackage.path;
|
|
2977
|
+
}
|
|
2973
2978
|
const categoryTarget = CATEGORY_TARGET_MAP[plugin.meta.category];
|
|
2974
2979
|
if (!categoryTarget) {
|
|
2975
2980
|
const rootTarget2 = packageJsonTargets.find((t) => t.target === TARGETS.ROOT);
|
|
@@ -2990,6 +2995,23 @@ function resolveTargetForPlugin(plugin, packageJsonTargets, _context) {
|
|
|
2990
2995
|
const rootTarget = packageJsonTargets.find((t) => t.target === TARGETS.ROOT);
|
|
2991
2996
|
return rootTarget?.path || packageJsonTargets[0]?.path || null;
|
|
2992
2997
|
}
|
|
2998
|
+
function inferTargetFromPluginOutputs(plugin, context) {
|
|
2999
|
+
const targets = /* @__PURE__ */ new Set();
|
|
3000
|
+
for (const entry of plugin.fileMap.files) {
|
|
3001
|
+
if (!entry.when || entry.when(context)) {
|
|
3002
|
+
targets.add(entry.target);
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
for (const injection of plugin.fileMap.injections) {
|
|
3006
|
+
if (!injection.when || injection.when(context)) {
|
|
3007
|
+
targets.add(injection.target);
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
if (targets.size === 1) {
|
|
3011
|
+
return [...targets][0];
|
|
3012
|
+
}
|
|
3013
|
+
return null;
|
|
3014
|
+
}
|
|
2993
3015
|
|
|
2994
3016
|
// src/generator/script-builder.ts
|
|
2995
3017
|
function buildScripts2(plugins, packageJsonTargets, _context) {
|
|
@@ -3590,6 +3612,8 @@ function detectFileCollisions(activePlugins, context, pathResolver) {
|
|
|
3590
3612
|
|
|
3591
3613
|
// src/generator/post-generate.ts
|
|
3592
3614
|
import { execa } from "execa";
|
|
3615
|
+
import { readFile } from "fs/promises";
|
|
3616
|
+
import { join } from "path";
|
|
3593
3617
|
|
|
3594
3618
|
// src/cli/ui/spinner.ts
|
|
3595
3619
|
import ora from "ora";
|
|
@@ -3687,23 +3711,29 @@ async function runPostGenerate(outputDir, context, options) {
|
|
|
3687
3711
|
if (!options.skipInstall) {
|
|
3688
3712
|
const installCmd = getInstallCommand(context.packageManager);
|
|
3689
3713
|
const [cmd, ...args] = installCmd.split(" ");
|
|
3714
|
+
const installTargets = getInstallTargets(outputDir, context);
|
|
3690
3715
|
try {
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3716
|
+
for (const target of installTargets) {
|
|
3717
|
+
await withSpinner(
|
|
3718
|
+
`Installing ${target.label} dependencies with ${context.packageManager}...`,
|
|
3719
|
+
async () => {
|
|
3720
|
+
await execa(cmd, args, {
|
|
3721
|
+
cwd: target.cwd,
|
|
3722
|
+
stdio: "pipe"
|
|
3723
|
+
});
|
|
3724
|
+
},
|
|
3725
|
+
`${target.label} dependencies installed`
|
|
3726
|
+
);
|
|
3727
|
+
}
|
|
3701
3728
|
installed = true;
|
|
3702
3729
|
} catch (error) {
|
|
3703
3730
|
logger.warn(`Failed to install dependencies: ${error.message}`);
|
|
3704
3731
|
logger.info(`You can run "${installCmd}" manually`);
|
|
3705
3732
|
}
|
|
3706
3733
|
}
|
|
3734
|
+
if (installed) {
|
|
3735
|
+
await runBootstrapScripts(outputDir, context);
|
|
3736
|
+
}
|
|
3707
3737
|
const steps = buildNextSteps(context, installed);
|
|
3708
3738
|
printPostGeneration(context.projectName, outputDir, context.packageManager, steps);
|
|
3709
3739
|
return { installed, gitInitialized };
|
|
@@ -3722,7 +3752,11 @@ function buildNextSteps(context, installed) {
|
|
|
3722
3752
|
}
|
|
3723
3753
|
steps.push("Fill in your environment variable values");
|
|
3724
3754
|
if (context.hasDatabase && context.hasPrisma) {
|
|
3725
|
-
|
|
3755
|
+
if (context.isFullstack) {
|
|
3756
|
+
steps.push(`Set up database: cd server && ${pm} run db:migrate && ${pm} run db:seed`);
|
|
3757
|
+
} else {
|
|
3758
|
+
steps.push(`Set up database: ${pm} run db:migrate && ${pm} run db:seed`);
|
|
3759
|
+
}
|
|
3726
3760
|
}
|
|
3727
3761
|
steps.push(`Start development: ${pm} run dev`);
|
|
3728
3762
|
if (context.hasMobile) {
|
|
@@ -3730,6 +3764,46 @@ function buildNextSteps(context, installed) {
|
|
|
3730
3764
|
}
|
|
3731
3765
|
return steps;
|
|
3732
3766
|
}
|
|
3767
|
+
function getInstallTargets(outputDir, context) {
|
|
3768
|
+
if (context.isSingleApp && context.isFullstack) {
|
|
3769
|
+
const feDir = context.hasMobile ? "mobile" : "client";
|
|
3770
|
+
return [
|
|
3771
|
+
{ label: "root", cwd: outputDir },
|
|
3772
|
+
{ label: feDir, cwd: join(outputDir, feDir) },
|
|
3773
|
+
{ label: "server", cwd: join(outputDir, "server") }
|
|
3774
|
+
];
|
|
3775
|
+
}
|
|
3776
|
+
return [{ label: "project", cwd: outputDir }];
|
|
3777
|
+
}
|
|
3778
|
+
async function runBootstrapScripts(outputDir, context) {
|
|
3779
|
+
const pm = context.packageManager;
|
|
3780
|
+
const installTargets = getInstallTargets(outputDir, context);
|
|
3781
|
+
const safeBootstrapScripts = ["db:generate", "generate", "codegen", "graphql:codegen", "types:generate"];
|
|
3782
|
+
for (const target of installTargets) {
|
|
3783
|
+
try {
|
|
3784
|
+
const packageJsonPath = join(target.cwd, "package.json");
|
|
3785
|
+
const raw = await readFile(packageJsonPath, "utf8");
|
|
3786
|
+
const pkg = JSON.parse(raw);
|
|
3787
|
+
const scripts = pkg.scripts ?? {};
|
|
3788
|
+
for (const scriptName of safeBootstrapScripts) {
|
|
3789
|
+
if (!scripts[scriptName]) continue;
|
|
3790
|
+
const [cmd, ...args] = `${pm} run ${scriptName}`.split(" ");
|
|
3791
|
+
await withSpinner(
|
|
3792
|
+
`Running ${target.label}:${scriptName}...`,
|
|
3793
|
+
async () => {
|
|
3794
|
+
await execa(cmd, args, {
|
|
3795
|
+
cwd: target.cwd,
|
|
3796
|
+
stdio: "pipe"
|
|
3797
|
+
});
|
|
3798
|
+
},
|
|
3799
|
+
`${target.label}:${scriptName} completed`
|
|
3800
|
+
);
|
|
3801
|
+
}
|
|
3802
|
+
} catch (error) {
|
|
3803
|
+
logger.debug(`Bootstrap scripts skipped for ${target.label}: ${error.message}`);
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3733
3807
|
|
|
3734
3808
|
// src/generator/pipeline.ts
|
|
3735
3809
|
var TOTAL_STEPS = 16;
|
package/dist/index.js
CHANGED