Merge pull request #1350 from strapi/fix/tests

Get right global root path
This commit is contained in:
Jim LAURIE 2018-06-12 11:30:26 +02:00 committed by GitHub
commit 62d62e99b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,7 @@
{
"private": true,
"version": "3.0.0-alpha.12.3",
"dependencies": {},
"devDependencies": {
"assert": "~1.3.0",
"axios": "^0.18.0",

View File

@ -12,7 +12,6 @@ const { execSync } = require('child_process');
const _ = require('lodash');
const fs = require('fs-extra');
const npm = require('enpeem');
const getInstalledPath = require('get-installed-path');
// Logger.
const logger = require('strapi-utils').logger;
@ -39,16 +38,17 @@ module.exports = (scope, cb) => {
const dependencies = _.get(packageJSON, 'dependencies');
const strapiDependencies = 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
_.forEach(strapiDependencies, (key) => {
try {
const isInstalled = getInstalledPath.sync(key);
fs.accessSync(path.resolve(_.trim(globalRootPath.toString()), key), fs.constants.R_OK | fs.constants.F_OK);
availableDependencies.push({
key,
global: true,
path: isInstalled
path: path.resolve(_.trim(globalRootPath.toString()), key)
});
} catch (e) {
othersDependencies.push(key);

View File

@ -15,7 +15,6 @@
"dependencies": {
"enpeem": "^2.2.0",
"fs-extra": "^4.0.0",
"get-installed-path": "^3.0.1",
"inquirer": "^4.0.2",
"lodash": "^4.17.4",
"strapi-utils": "3.0.0-alpha.12.3",