mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +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 pluginsDirPath = path.join(process.cwd(), 'plugins');
|
||||||
const adminDirPath = path.join(process.cwd(), 'admin');
|
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 */
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
// Install admin dependencies
|
// Install admin dependencies
|
||||||
@ -26,7 +35,7 @@ try {
|
|||||||
// Check if path is existing.
|
// Check if path is existing.
|
||||||
fs.accessSync(adminDirPath, fs.constants.R_OK | fs.constants.W_OK);
|
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
|
silent: true
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -62,7 +71,7 @@ try {
|
|||||||
console.log('📦 Installing packages...');
|
console.log('📦 Installing packages...');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const install = exec(`cd "${pluginPath}" && npm install --prod --ignore-scripts`, {
|
const install = exec(`cd "${pluginPath}" && ${installCmd}`, {
|
||||||
silent: true
|
silent: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user