Install plugins dependencies postinstall

This commit is contained in:
Jim Laurie 2017-09-06 17:19:30 +02:00
parent 8586e1502f
commit 448a1dec27
5 changed files with 63 additions and 32 deletions

View File

@ -4,16 +4,6 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"JSONStream": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
"integrity": "sha1-kWV9/m/4V0gwZhMrRhi2Lo9Ih70=",
"dev": true,
"requires": {
"jsonparse": "0.0.5",
"through": "2.3.8"
}
},
"abab": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz",
@ -6165,6 +6155,15 @@
}
}
},
"string_decoder": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
@ -6176,15 +6175,6 @@
"strip-ansi": "3.0.1"
}
},
"string_decoder": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
@ -8623,6 +8613,16 @@
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
"dev": true
},
"JSONStream": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
"integrity": "sha1-kWV9/m/4V0gwZhMrRhi2Lo9Ih70=",
"dev": true,
"requires": {
"jsonparse": "0.0.5",
"through": "2.3.8"
}
},
"jsprim": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz",
@ -13696,6 +13696,15 @@
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"string-template": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz",
@ -13713,15 +13722,6 @@
"strip-ansi": "3.0.1"
}
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"stringify-object": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-2.4.0.tgz",

View File

@ -37,7 +37,8 @@ module.exports = scope => {
'scripts': {
'start': 'node server.js',
'strapi': 'node_modules/strapi/bin/strapi.js', // Allow to use `npm run strapi` CLI,
'lint': 'node_modules/.bin/eslint api/**/*.js config/**/*.js plugins/**/*.js'
'lint': 'node_modules/.bin/eslint api/**/*.js config/**/*.js plugins/**/*.js',
'postinstall': 'node node_modules/strapi-utils/script/plugin-install.js'
},
'author': {
'name': scope.author || 'A Strapi developer',

View File

@ -48,7 +48,7 @@
"plop": "^1.5.0",
"prettier": "^1.5.3",
"rimraf": "^2.5.4",
"strapi-helper-plugin": "3.0.0-alpha.5.5",
"strapi-helper-plugin": "file:../strapi-helper-plugin",
"webpack": "^2.1.0-beta.25"
},
"author": {
@ -68,4 +68,4 @@
"npm": ">= 3.0.0"
},
"license": "MIT"
}
}

View File

@ -45,4 +45,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -0,0 +1,30 @@
'use strict';
/**
* Module dependencies
*/
// Node.js core
const exec = require('child_process').execSync;
const path = require('path');
const fs = require('fs');
// Public node modules.
const _ = require('lodash');
// Define files/dir paths
const pluginsDirPath = path.join(process.cwd(), 'plugins');
const plugins = fs.readdirSync(pluginsDirPath);
// Install dependencies for each plugins
_.forEach(plugins, plugin => {
const pluginPath = path.join(pluginsDirPath, plugin);
console.log(`Install plugin ${plugin} dependencies...`);
try {
exec(`cd ${pluginPath} && npm install --prod --ignore-scripts`);
} catch (err) {
console.log(err);
}
});