mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
Merge pull request #1350 from strapi/fix/tests
Get right global root path
This commit is contained in:
commit
62d62e99b3
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "3.0.0-alpha.12.3",
|
"version": "3.0.0-alpha.12.3",
|
||||||
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"assert": "~1.3.0",
|
"assert": "~1.3.0",
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
|
@ -12,7 +12,6 @@ const { execSync } = require('child_process');
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const npm = require('enpeem');
|
const npm = require('enpeem');
|
||||||
const getInstalledPath = require('get-installed-path');
|
|
||||||
|
|
||||||
// Logger.
|
// Logger.
|
||||||
const logger = require('strapi-utils').logger;
|
const logger = require('strapi-utils').logger;
|
||||||
@ -39,16 +38,17 @@ module.exports = (scope, cb) => {
|
|||||||
const dependencies = _.get(packageJSON, 'dependencies');
|
const dependencies = _.get(packageJSON, 'dependencies');
|
||||||
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);
|
||||||
|
const globalRootPath = execSync('npm root -g');
|
||||||
|
|
||||||
// Verify if the dependencies are available into the global
|
// Verify if the dependencies are available into the global
|
||||||
_.forEach(strapiDependencies, (key) => {
|
_.forEach(strapiDependencies, (key) => {
|
||||||
try {
|
try {
|
||||||
const isInstalled = getInstalledPath.sync(key);
|
fs.accessSync(path.resolve(_.trim(globalRootPath.toString()), key), fs.constants.R_OK | fs.constants.F_OK);
|
||||||
|
|
||||||
availableDependencies.push({
|
availableDependencies.push({
|
||||||
key,
|
key,
|
||||||
global: true,
|
global: true,
|
||||||
path: isInstalled
|
path: path.resolve(_.trim(globalRootPath.toString()), key)
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
othersDependencies.push(key);
|
othersDependencies.push(key);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"enpeem": "^2.2.0",
|
"enpeem": "^2.2.0",
|
||||||
"fs-extra": "^4.0.0",
|
"fs-extra": "^4.0.0",
|
||||||
"get-installed-path": "^3.0.1",
|
|
||||||
"inquirer": "^4.0.2",
|
"inquirer": "^4.0.2",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"strapi-utils": "3.0.0-alpha.12.3",
|
"strapi-utils": "3.0.0-alpha.12.3",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user