mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 08:19:07 +00:00
Handle yarn install in generated project
This commit is contained in:
parent
ed89c8404d
commit
d383a75154
@ -16,6 +16,15 @@ const _ = require('lodash');
|
||||
const pluginsDirPath = path.join(process.cwd(), 'plugins');
|
||||
const adminDirPath = path.join(process.cwd(), 'admin');
|
||||
|
||||
let packageManager;
|
||||
try {
|
||||
packageManager = require(path.resolve(process.cwd(), 'package')).strapi.packageManager;
|
||||
} catch (error) {
|
||||
packageManager = 'npm';
|
||||
}
|
||||
|
||||
const installCmd = packageManager === 'yarn' ? 'yarn install --production --ignore-scripts' : 'npm install --prod --ignore-scripts';
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
// Install admin dependencies
|
||||
@ -26,7 +35,7 @@ try {
|
||||
// Check if path is existing.
|
||||
fs.accessSync(adminDirPath, fs.constants.R_OK | fs.constants.W_OK);
|
||||
|
||||
const install = exec(`cd "${adminDirPath}" && npm install --prod --ignore-scripts`, {
|
||||
const install = exec(`cd "${adminDirPath}" && ${installCmd}`, {
|
||||
silent: true
|
||||
});
|
||||
|
||||
@ -62,7 +71,7 @@ try {
|
||||
console.log('📦 Installing packages...');
|
||||
|
||||
try {
|
||||
const install = exec(`cd "${pluginPath}" && npm install --prod --ignore-scripts`, {
|
||||
const install = exec(`cd "${pluginPath}" && ${installCmd}`, {
|
||||
silent: true
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user