Fix plugins setup

This commit is contained in:
Pierre Burgy 2017-07-21 17:18:47 +02:00
parent c81c865b79
commit e860a1d172
24 changed files with 107 additions and 50 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,21 +26,20 @@ module.exports = scope => {
'description': `Description of ${scope.id} plugin.`
},
'scripts': {
'analyze:clean': 'node_modules/strapi-helper-plugin/node_modules/rimraf/bin.js stats.json',
'analyze:clean': 'rimraf stats.json',
'preanalyze': 'npm run analyze:clean',
'analyze': 'node node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js',
'postinstall': 'npm run build:dll',
'prebuild': 'npm run build:clean && npm run test',
'build': 'node_modules/strapi-helper-plugin/node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/strapi-helper-plugin/node_modules/webpack/bin/webpack.js --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress',
'build:clean': 'node_modules/strapi-helper-plugin/node_modules/rimraf/bin.js admin/build',
'build:dll': 'node node_modules/strapi-helper-plugin/lib/internals/scripts/dependencies.js',
'start': 'node_modules/strapi-helper-plugin/node_modules/cross-env/bin/cross-env.js NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server',
'generate': 'node_modules/strapi-helper-plugin/node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js',
'lint': 'node_modules/strapi-helper-plugin/node_modules/eslint/bin/eslint.js --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin',
'build': 'cross-env NODE_ENV=production webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress',
'build:clean': 'rimraf admin/build',
'start': 'cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server',
'generate': 'node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js',
'lint': 'eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin',
'pretest': 'npm run lint',
'prettier': 'node_modules/strapi-helper-plugin/node_modules/prettier/bin/prettier.js --single-quote --trailing-comma es5 --write \'{admin,__{tests,mocks}__}/**/*.js\'',
'prettier': 'prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"',
'test': 'echo Tests are not implemented.',
'prepublish': 'npm run build'
'prepublish': 'npm run build',
'postinstall': 'node node_modules/strapi-helper-plugin/lib/internals/scripts/postinstall.js'
},
'dependencies': {},
'devDependencies': {

View File

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

View File

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

View File

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

View File

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

View File

@ -86,7 +86,7 @@
"settings": {
"import/resolver": {
"webpack": {
"config": "./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.test.babel.js"
"config": "node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.test.babel.js"
}
}
}

View File

@ -0,0 +1,59 @@
// Import node modules.
const { exec } = require('child_process');
const path = require('path');
const _ = require('lodash');
const addCheckMark = require('./helpers/checkmark');
const animateProgress = require('./helpers/progress');
const pkg = require(path.resolve(__dirname, '..', '..', '..', 'package.json'));
process.stdin.resume();
process.stdin.setEncoding('utf8');
let interval;
// List of necessary dependencies.
const helperDependencies = [
'cross-env',
'plop',
'prettier',
'rimraf',
'webpack',
];
/**
* Define the list of necessary dependencies, with their respective versions.
*/
const necessaryDependencies = _.map(
_.pickBy(pkg.dependencies, (version, devDependency) =>
_.includes(helperDependencies, devDependency) || _.startsWith(devDependency, 'eslint')
), (version, devDependency) =>
`${devDependency}@${version}`
);
/**
* Install necessary dependencies.
*/
const installNecessaryDeps = () => {
process.stdout.write('\nInstalling necessary dependencies');
interval = animateProgress('Installing necessary dependencies');
exec(`npm install ${necessaryDependencies.join(' ')} --no-save`, addCheckMark.bind(null, installDepsCallback));
};
/**
* Callback function after installing dependencies.
*/
const installDepsCallback = (error) => {
clearInterval(interval);
process.stdout.write('\n');
if (error) {
process.stderr.write(error);
process.stdout.write('\n');
process.exit(1);
}
process.exit(0);
};
installNecessaryDeps();

View File

@ -18,25 +18,25 @@ module.exports = (options) => ({
use: {
loader: 'babel',
options: {
"presets": options.babelPresets,
"env": {
"production": {
"only": [
"src",
presets: options.babelPresets,
env: {
production: {
only: [
'src',
],
"plugins": [
plugins: [
require.resolve('babel-plugin-transform-react-remove-prop-types'),
require.resolve('babel-plugin-transform-react-constant-elements'),
require.resolve('babel-plugin-transform-react-inline-elements'),
],
},
"test": {
"plugins": [
"istanbul",
test: {
plugins: [
'istanbul',
],
},
},
}
},
},
include: [
path.join(process.cwd(), 'admin', 'src'),

View File

@ -120,4 +120,4 @@
"webpack-hot-middleware": "2.13.1",
"whatwg-fetch": "1.0.0"
}
}
}

View File

@ -50,4 +50,4 @@
"npm": ">= 5.0.0"
},
"license": "MIT"
}
}

View File

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

View File

@ -28,21 +28,20 @@
"icon": "fa-plug"
},
"scripts": {
"analyze:clean": "node_modules/rimraf/bin.js stats.json",
"analyze:clean": "rimraf stats.json",
"preanalyze": "npm run analyze:clean",
"analyze": "node node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
"postinstall": "npm run build:dll",
"prebuild": "npm run build:clean && npm run test",
"build": "node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
"build:clean": "node_modules/rimraf/bin.js admin/build",
"build:dll": "node node_modules/strapi-helper-plugin/lib/internals/scripts/dependencies.js",
"start": "node_modules/cross-env/bin/cross-env.js NODE_ENV=development node lib/server",
"build": "cross-env NODE_ENV=production webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
"build:clean": "rimraf admin/build",
"start": "cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server",
"generate": "node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
"lint": "node_modules/eslint/bin/eslint.js --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
"lint": "eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
"pretest": "npm run lint",
"prettier": "node_modules/prettier/bin/prettier.js --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
"prettier": "prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
"test": "echo Tests are not implemented.",
"prepublish": "npm run build"
"prepublish": "npm run build",
"postinstall": "node node_modules/strapi-helper-plugin/lib/internals/scripts/postinstall.js"
},
"dependencies": {
"react-select": "^1.0.0-rc.5"
@ -50,4 +49,4 @@
"devDependencies": {
"strapi-helper-plugin": "^3.0.0-alpha.4.4"
}
}
}

View File

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

View File

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

View File

@ -100,4 +100,4 @@
},
"preferGlobal": true,
"license": "MIT"
}
}