mirror of
https://github.com/strapi/strapi.git
synced 2025-08-17 21:28:23 +00:00
Improve find npm global strapi performance
This commit is contained in:
parent
d383a75154
commit
13013a40b4
@ -40,7 +40,7 @@ module.exports = (scope, cb) => {
|
|||||||
const strapiDependencies = Object.keys(dependencies).filter(key => key.indexOf('strapi') !== -1);
|
const strapiDependencies = Object.keys(dependencies).filter(key => key.indexOf('strapi') !== -1);
|
||||||
const othersDependencies = Object.keys(dependencies).filter(key => key.indexOf('strapi') === -1);
|
const othersDependencies = Object.keys(dependencies).filter(key => key.indexOf('strapi') === -1);
|
||||||
// Add this check to know if we are in development mode so the creation is faster.
|
// Add this check to know if we are in development mode so the creation is faster.
|
||||||
const isStrapiInstalledWithNPM = process.argv.indexOf('new') !== -1 && process.argv.indexOf('--dev') !== -1 || packageManager.isStrapiInstalledWithNPM();
|
const isStrapiInstalledWithNPM = packageManager.isStrapiInstalledWithNPM();
|
||||||
const globalRootPath = isStrapiInstalledWithNPM ? execSync('npm root -g') : execSync(packageManager.commands('root -g'));
|
const globalRootPath = isStrapiInstalledWithNPM ? execSync('npm root -g') : execSync(packageManager.commands('root -g'));
|
||||||
// const globalRootPath = execSync('npm root -g');
|
// const globalRootPath = execSync('npm root -g');
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ module.exports = (scope, cb) => {
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
const isStrapiInstalledWithNPM = process.argv.indexOf('new') !== -1 && process.argv.indexOf('--dev') !== -1 || packageManager.isStrapiInstalledWithNPM();
|
const isStrapiInstalledWithNPM = packageManager.isStrapiInstalledWithNPM();
|
||||||
let packageCmd = isStrapiInstalledWithNPM ? `npm install --prefix "${scope.tmpPath}" ${scope.client.connector}@alpha` : packageManager.commands('install --prefix', scope.tmpPath);
|
let packageCmd = isStrapiInstalledWithNPM ? `npm install --prefix "${scope.tmpPath}" ${scope.client.connector}@alpha` : packageManager.commands('install --prefix', scope.tmpPath);
|
||||||
// let cmd = `npm install --prefix "${scope.tmpPath}" ${scope.client.connector}@alpha`;
|
// let cmd = `npm install --prefix "${scope.tmpPath}" ${scope.client.connector}@alpha`;
|
||||||
// Manually create the temp directory for yarn
|
// Manually create the temp directory for yarn
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
const fs = require('fs');
|
||||||
const shell = require('shelljs');
|
const shell = require('shelljs');
|
||||||
const { includes } = require('lodash');
|
const { includes } = require('lodash');
|
||||||
|
|
||||||
@ -30,7 +31,10 @@ module.exports = {
|
|||||||
if (!skipCheck) {
|
if (!skipCheck) {
|
||||||
try {
|
try {
|
||||||
// Retrieve all the packages installed with NPM
|
// Retrieve all the packages installed with NPM
|
||||||
const data = watcher('npm -g ls');
|
const npmPath = watcher('npm root -g');
|
||||||
|
|
||||||
|
const data = fs.readdirSync(npmPath.trim());
|
||||||
|
|
||||||
// Check if strapi is installed with NPM
|
// Check if strapi is installed with NPM
|
||||||
isNPM = includes(data, 'strapi');
|
isNPM = includes(data, 'strapi');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user