Merge branch 'fix/admin' of https://github.com/strapi/strapi into fix/admin

This commit is contained in:
Pierre Burgy 2017-09-27 17:23:04 +02:00
commit 1d887250f4
3 changed files with 51 additions and 18 deletions

View File

@ -10,14 +10,33 @@ const webpack = require('webpack');
const pkg = require(path.resolve(process.cwd(), 'package.json'));
const pluginId = pkg.name.replace(/^strapi-/i, '');
const plugins = process.env.IS_ADMIN === 'true' ? fs.readdirSync(path.resolve(process.env.PWD, '..', 'plugins'))
.filter(x => x[0] !== '.') : [];
let noPlugin = false;
let plugins = [];
let pluginFolders = {};
const pluginFolders = plugins.reduce((acc, current) => {
acc[current] = path.resolve(process.env.PWD, '..', 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
if (process.env.npm_lifecycle_event === 'start') {
try {
fs.accessSync(path.resolve(process.env.PWD, '..', 'plugins'), fs.constants.R_OK);
} catch (e) {
try {
fs.accessSync(path.resolve(process.env.PWD, '..', 'api'), fs.constants.R_OK);
return acc;
}, {});
// Allow app without plugins.
noPlugin = true;
} catch (e) {
throw new Error(`You need to start the WebPack server from the /admin directory in a Strapi's project.`);
}
}
plugins = process.env.IS_ADMIN === 'true' && !noPlugin ? fs.readdirSync(path.resolve(process.env.PWD, '..', 'plugins'))
.filter(x => x[0] !== '.') : [];
pluginFolders = plugins.reduce((acc, current) => {
acc[current] = path.resolve(process.env.PWD, '..', 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
return acc;
}, {});
}
module.exports = (options) => ({
entry: options.entry,

View File

@ -14,21 +14,35 @@ const postcssReporter = require('postcss-reporter');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
const plugins = process.env.IS_ADMIN === 'true' ? fs.readdirSync(path.resolve(process.env.PWD, '..', 'plugins'))
.filter(x => x[0] !== '.') : [];
let noPlugin = false;
let plugins = [];
let pluginFolders = {};
const pluginFolders = plugins.reduce((acc, current) => {
acc[current] = path.resolve(process.env.PWD, '..', 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
if (process.env.npm_lifecycle_event === 'start') {
try {
fs.accessSync(path.resolve(process.env.PWD, '..', 'plugins'), fs.constants.R_OK);
} catch (e) {
try {
fs.accessSync(path.resolve(process.env.PWD, '..', 'api'), fs.constants.R_OK);
return acc;
}, {});
// Allow app without plugins.
noPlugin = true;
} catch (e) {
throw new Error(`You need to start the WebPack server from the /admin directory in a Strapi's project.`);
}
}
plugins = process.env.IS_ADMIN === 'true' && !noPlugin ? fs.readdirSync(path.resolve(process.env.PWD, '..', 'plugins'))
.filter(x => x[0] !== '.') : [];
pluginFolders = plugins.reduce((acc, current) => {
acc[current] = path.resolve(process.env.PWD, '..', 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
return acc;
}, {});
}
const appPath = path.join(process.cwd(), 'admin', 'src', 'app.js')
const logger = require('../../server/logger');
const pkg = require(path.resolve(process.cwd(), 'package.json'));
const dllPlugin = pkg.dllPlugin;
const port = argv.port || process.env.PORT || 3000;
module.exports = require('./webpack.base.babel')({

View File

@ -115,4 +115,4 @@
"webpack-hot-middleware": "^2.18.2",
"whatwg-fetch": "^2.0.3"
}
}
}