adminforth 3.6.6 → 3.6.8
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/commands/createApp/utils.js +24 -38
- package/package.json +1 -1
|
@@ -487,44 +487,34 @@ async function writeTemplateFiles(dirname, cwd, useNpm, includePrismaMigrations,
|
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
async function
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
const nodeBinary = process.execPath;
|
|
494
|
-
const pnpmPath = path.join(path.dirname(nodeBinary), isWindows ? 'pnpm.cmd' : 'pnpm');
|
|
495
|
-
const customDir = ctx.customDir;
|
|
496
|
-
if (isWindows) {
|
|
497
|
-
const res = await Promise.all([
|
|
498
|
-
execAsync(`pnpm install`, { cwd, env: { PATH: process.env.PATH } }),
|
|
499
|
-
execAsync(`pnpm install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
|
|
500
|
-
]);
|
|
501
|
-
} else {
|
|
502
|
-
const res = await Promise.all([
|
|
503
|
-
execAsync(`${nodeBinary} ${pnpmPath} install`, { cwd, env: { PATH: process.env.PATH } }),
|
|
504
|
-
execAsync(`${nodeBinary} ${pnpmPath} install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
|
|
505
|
-
]);
|
|
490
|
+
async function resolvePackageManagerCommand(packageManager) {
|
|
491
|
+
if (packageManager !== 'pnpm') {
|
|
492
|
+
return packageManager;
|
|
506
493
|
}
|
|
507
|
-
}
|
|
508
494
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
]);
|
|
520
|
-
} else {
|
|
521
|
-
const res = await Promise.all([
|
|
522
|
-
execAsync(`${nodeBinary} ${npmPath} install`, { cwd, env: { PATH: process.env.PATH } }),
|
|
523
|
-
execAsync(`${nodeBinary} ${npmPath} install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
|
|
524
|
-
]);
|
|
495
|
+
try {
|
|
496
|
+
await execAsync('pnpm --version', { env: process.env });
|
|
497
|
+
return 'pnpm';
|
|
498
|
+
} catch {
|
|
499
|
+
try {
|
|
500
|
+
await execAsync('corepack pnpm --version', { env: process.env });
|
|
501
|
+
return 'corepack pnpm';
|
|
502
|
+
} catch {
|
|
503
|
+
throw new Error('pnpm is not available. Install pnpm globally or enable Corepack before creating a pnpm project.');
|
|
504
|
+
}
|
|
525
505
|
}
|
|
526
506
|
}
|
|
527
507
|
|
|
508
|
+
async function installDependencies(ctx, cwd, packageManager) {
|
|
509
|
+
const packageManagerCommand = await resolvePackageManagerCommand(packageManager);
|
|
510
|
+
const command = `${packageManagerCommand} install`;
|
|
511
|
+
|
|
512
|
+
await Promise.all([
|
|
513
|
+
execAsync(command, { cwd, env: process.env }),
|
|
514
|
+
execAsync(command, { cwd: ctx.customDir, env: process.env }),
|
|
515
|
+
]);
|
|
516
|
+
}
|
|
517
|
+
|
|
528
518
|
function generateFinalInstructionsPnpm(skipPrismaSetup, options) {
|
|
529
519
|
let instruction = '⏭️ Run the following commands to get started:\n';
|
|
530
520
|
if (!skipPrismaSetup)
|
|
@@ -596,11 +586,7 @@ export function prepareWorkflow(options) {
|
|
|
596
586
|
{
|
|
597
587
|
title: '📦 Installing dependencies...',
|
|
598
588
|
task: async (ctx) => {
|
|
599
|
-
|
|
600
|
-
await installDependenciesNpm(ctx, ctx.projectDir);
|
|
601
|
-
} else {
|
|
602
|
-
await installDependenciesPnpm(ctx, ctx.projectDir);
|
|
603
|
-
}
|
|
589
|
+
await installDependencies(ctx, ctx.projectDir, options.useNpm ? 'npm' : 'pnpm');
|
|
604
590
|
}
|
|
605
591
|
},
|
|
606
592
|
{
|