mirror of
https://github.com/strapi/strapi.git
synced 2025-10-12 00:23:19 +00:00
commit
484bcc81f1
2
packages/strapi-admin/.gitignore
vendored
2
packages/strapi-admin/.gitignore
vendored
@ -1,8 +1,6 @@
|
||||
# Don't check auto-generated stuff into git
|
||||
coverage
|
||||
node_modules
|
||||
build
|
||||
plugins.json
|
||||
stats.json
|
||||
package-lock.json
|
||||
|
||||
|
12
packages/strapi-admin/admin/.gitignore
vendored
Normal file
12
packages/strapi-admin/admin/.gitignore
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# Don't check auto-generated stuff into git
|
||||
coverage
|
||||
node_modules
|
||||
build
|
||||
plugins.json
|
||||
stats.json
|
||||
package-lock.json
|
||||
|
||||
# Cruft
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
.idea
|
101
packages/strapi-admin/admin/.npmignore
Normal file
101
packages/strapi-admin/admin/.npmignore
Normal file
@ -0,0 +1,101 @@
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
*.log
|
||||
*.sql
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
ssl
|
||||
.idea
|
||||
nbproject
|
||||
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
node_modules
|
||||
.node_history
|
||||
|
||||
|
||||
############################
|
||||
# Tests
|
||||
############################
|
||||
|
||||
test
|
||||
testApp
|
||||
coverage
|
@ -7,18 +7,18 @@
|
||||
"url": "git://github.com/strapi/strapi-admin.git"
|
||||
},
|
||||
"scripts": {
|
||||
"analyze:clean": "node ../strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"analyze:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"preanalyze": "npm run analyze:clean",
|
||||
"analyze": "node ../strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"build:dev": "npm run build:dll && node ../strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development IS_ADMIN=true node ../strapi-helper-plugin/node_modules/.bin/webpack --config ../strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "npm run build:dll && node ../strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ../strapi-helper-plugin/node_modules/.bin/webpack --config ../strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:dll": "node ../strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node ../strapi-helper-plugin/node_modules/.bin/webpack --config ../strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js --color -p --progress",
|
||||
"build:clean": "node ../strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ../strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PORT=4000 IS_ADMIN=true node ../strapi-helper-plugin/lib/server",
|
||||
"generate": "node ../strapi-helper-plugin/node_modules/.bin/plop --plopfile ../strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ../strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ../strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"build:dev": "npm run build:dll && node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "npm run build:dll && node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:dll": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js --color -p --progress",
|
||||
"build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PORT=4000 IS_ADMIN=true node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path ./admin/.gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"pretest": "npm run lint",
|
||||
"prettier": "node ../strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "echo Tests are not implemented.",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
|
@ -101,9 +101,19 @@ module.exports = (scope, cb) => {
|
||||
logger.info(`Linking \`${dependency.key}\` dependency to the project...`);
|
||||
|
||||
if (dependency.global) {
|
||||
fs.symlinkSync(dependency.path, path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
|
||||
try {
|
||||
fs.accessSync(dependency.path, fs.constants.W_OK | fs.constants.F_OK);
|
||||
fs.symlinkSync(dependency.path, path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
|
||||
} catch (e) {
|
||||
// Silent.
|
||||
}
|
||||
} else {
|
||||
fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
|
||||
try {
|
||||
fs.accessSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), fs.constants.W_OK | fs.constants.F_OK);
|
||||
fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
|
||||
} catch (e) {
|
||||
// Silent.
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -39,7 +39,7 @@ const URLs = {
|
||||
|
||||
if (isAdmin && !isSetup) {
|
||||
// Load server configuration.
|
||||
const serverConfig = path.resolve(process.env.PWD, '..', 'config', 'environments', _.lowerCase(process.env.NODE_ENV), 'server.json');
|
||||
const serverConfig = path.resolve(appPath, 'config', 'environments', _.lowerCase(process.env.NODE_ENV), 'server.json');
|
||||
|
||||
try {
|
||||
const server = require(serverConfig);
|
||||
@ -63,18 +63,18 @@ const plugins = {
|
||||
|
||||
if (process.env.npm_lifecycle_event === 'start') {
|
||||
try {
|
||||
fs.accessSync(path.resolve(process.env.PWD, '..', 'plugins'), fs.constants.R_OK);
|
||||
fs.accessSync(path.resolve(appPath, 'plugins'), fs.constants.R_OK);
|
||||
} catch (e) {
|
||||
// Allow app without plugins.
|
||||
plugins.exist = true;
|
||||
}
|
||||
|
||||
// Read `plugins` directory.
|
||||
plugins.src = isAdmin && !plugins.exist ? fs.readdirSync(path.resolve(process.env.PWD, '..', 'plugins')).filter(x => x[0] !== '.') : [];
|
||||
plugins.src = isAdmin && !plugins.exist ? fs.readdirSync(path.resolve(appPath, 'plugins')).filter(x => x[0] !== '.') : [];
|
||||
|
||||
// Construct object of plugin' paths.
|
||||
plugins.folders = plugins.src.reduce((acc, current) => {
|
||||
acc[current] = path.resolve(process.env.PWD, '..', 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
|
||||
acc[current] = path.resolve(appPath, 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
@ -83,7 +83,7 @@ if (process.env.npm_lifecycle_event === 'start') {
|
||||
module.exports = (options) => ({
|
||||
entry: options.entry,
|
||||
output: Object.assign({ // Compile into js/build.js
|
||||
path: path.join(process.cwd(), 'admin', 'build')
|
||||
path: path.join(process.env.PWD, 'admin', 'build')
|
||||
}, options.output), // Merge with env dependent settings
|
||||
module: {
|
||||
loaders: [{
|
||||
@ -111,13 +111,13 @@ module.exports = (options) => ({
|
||||
},
|
||||
},
|
||||
},
|
||||
include: [path.join(process.cwd(), 'admin', 'src')]
|
||||
include: [path.join(process.env.PWD, 'admin', 'src')]
|
||||
.concat(plugins.src.reduce((acc, current) => {
|
||||
acc.push(path.resolve(process.env.PWD, '..', 'plugins', current, 'admin', 'src'), plugins.folders[current]);
|
||||
acc.push(path.resolve(appPath, 'plugins', current, 'admin', 'src'), plugins.folders[current]);
|
||||
|
||||
return acc;
|
||||
}, []))
|
||||
.concat([path.join(process.cwd(), 'node_modules', 'strapi-helper-plugin', 'lib', 'src')])
|
||||
.concat([path.join(process.env.PWD, 'node_modules', 'strapi-helper-plugin', 'lib', 'src')])
|
||||
}, {
|
||||
// Transform our own .scss files
|
||||
test: /\.scss$/,
|
||||
|
@ -14,6 +14,10 @@ const postcssReporter = require('postcss-reporter');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
|
||||
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
|
||||
// Load plugins into the same build in development mode.
|
||||
const plugins = {
|
||||
exist: false,
|
||||
@ -23,22 +27,22 @@ const plugins = {
|
||||
|
||||
if (process.env.npm_lifecycle_event === 'start') {
|
||||
try {
|
||||
fs.accessSync(path.resolve(process.env.PWD, '..', 'plugins'), fs.constants.R_OK);
|
||||
fs.accessSync(path.resolve(appPath, 'plugins'), fs.constants.R_OK);
|
||||
} catch (e) {
|
||||
// Allow app without plugins.
|
||||
plugins.exist = true;
|
||||
}
|
||||
|
||||
plugins.src = process.env.IS_ADMIN === 'true' && !plugins.exist ? fs.readdirSync(path.resolve(process.env.PWD, '..', 'plugins')).filter(x => x[0] !== '.') : [];
|
||||
plugins.src = process.env.IS_ADMIN === 'true' && !plugins.exist ? fs.readdirSync(path.resolve(appPath, 'plugins')).filter(x => x[0] !== '.') : [];
|
||||
|
||||
plugins.folders = plugins.src.reduce((acc, current) => {
|
||||
acc[current] = path.resolve(process.env.PWD, '..', 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
|
||||
acc[current] = path.resolve(appPath, 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
const appPath = path.join(process.cwd(), 'admin', 'src', 'app.js')
|
||||
|
||||
const port = argv.port || process.env.PORT || 3000;
|
||||
|
||||
module.exports = require('./webpack.base.babel')({
|
||||
@ -46,7 +50,7 @@ module.exports = require('./webpack.base.babel')({
|
||||
entry: Object.assign({
|
||||
main: [
|
||||
`webpack-hot-middleware/client?path=http://localhost:${port}/__webpack_hmr`,
|
||||
appPath,
|
||||
path.join(appPath, 'admin', 'admin', 'src', 'app.js'),
|
||||
]
|
||||
}, plugins.src.reduce((acc, current) => {
|
||||
acc[current] = path.resolve(plugins.folders[current], 'app.js');
|
||||
@ -94,7 +98,7 @@ module.exports = require('./webpack.base.babel')({
|
||||
// Tell babel that we want presets and to hot-reload
|
||||
babelPresets: [
|
||||
[
|
||||
require.resolve('babel-preset-latest'),
|
||||
require.resolve('babel-preset-env'),
|
||||
{
|
||||
es2015: {
|
||||
modules: false,
|
||||
@ -107,12 +111,27 @@ module.exports = require('./webpack.base.babel')({
|
||||
],
|
||||
alias: {
|
||||
moment: 'moment/moment.js',
|
||||
'lodash': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'),
|
||||
'immutable': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'),
|
||||
'react-intl': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'),
|
||||
'react': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'),
|
||||
'react-dom': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group')
|
||||
'lodash': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
},
|
||||
|
||||
// Emit a source map for easier debugging
|
||||
@ -126,7 +145,7 @@ module.exports = require('./webpack.base.babel')({
|
||||
*/
|
||||
function templateContent() {
|
||||
const html = fs.readFileSync(
|
||||
path.resolve(process.cwd(), 'admin/src/index.html')
|
||||
path.resolve(appPath, 'admin', 'admin', 'src', 'index.html')
|
||||
).toString();
|
||||
|
||||
return html;
|
||||
|
@ -10,16 +10,22 @@
|
||||
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
|
||||
module.exports = {
|
||||
context: process.cwd(),
|
||||
context: appPath,
|
||||
entry: {
|
||||
vendor: ['react', 'react-dom', 'react-intl', 'reactstrap', 'react-transition-group', 'immutable', 'lodash'] // Shared dependencies accross the admin and plugins.
|
||||
},
|
||||
devtool: 'cheap-module-source-map',
|
||||
output: {
|
||||
filename: '[name].dll.js',
|
||||
path: path.resolve(__dirname, 'dist/'),
|
||||
path: isSetup ?
|
||||
path.join(__dirname, 'dist'):
|
||||
path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'dist'),
|
||||
|
||||
// The name of the global variable which the library's
|
||||
// require() function will be assigned to
|
||||
@ -28,7 +34,9 @@ module.exports = {
|
||||
plugins: [
|
||||
new webpack.DllPlugin({
|
||||
name: '[name]_lib',
|
||||
path: path.join(__dirname, 'manifest.json'),
|
||||
path: isSetup ?
|
||||
path.join(__dirname, 'manifest.json'):
|
||||
path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json'),
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
@ -40,13 +48,27 @@ module.exports = {
|
||||
],
|
||||
alias: {
|
||||
moment: 'moment/moment.js',
|
||||
'lodash': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'),
|
||||
'immutable': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'),
|
||||
'react-intl': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'),
|
||||
'react': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'),
|
||||
'react-dom': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap')
|
||||
'lodash': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
},
|
||||
symlinks: false,
|
||||
extensions: [
|
||||
|
@ -17,22 +17,24 @@ const pluginId = pkg.name.replace(/^strapi-plugin-/i, '');
|
||||
const dllPlugin = pkg.dllPlugin;
|
||||
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
|
||||
// Necessary configuration file to ensure that plugins will be loaded.
|
||||
const pluginsToInitialize = (() => {
|
||||
try {
|
||||
return require(path.resolve(process.cwd(), 'admin', 'src', 'config', 'plugins.json'));
|
||||
return require(path.resolve(appPath, 'admin', 'src', 'config', 'plugins.json'));
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
const plugins = [
|
||||
new webpack.DllReferencePlugin({
|
||||
manifest: require(path.join(__dirname, 'manifest.json')),
|
||||
manifest: require(isSetup ?
|
||||
path.join(__dirname, 'manifest.json'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json')
|
||||
),
|
||||
}),
|
||||
// Minify and optimize the JavaScript
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
@ -57,9 +59,7 @@ const settings = {
|
||||
|
||||
if (!isSetup) {
|
||||
// Load server configurations.
|
||||
const serverConfig = isAdmin ?
|
||||
path.resolve(process.env.PWD, '..', 'config', 'environments', _.lowerCase(process.env.NODE_ENV), 'server.json'):
|
||||
path.resolve(process.env.PWD, '..', '..', 'config', 'environments', _.lowerCase(process.env.NODE_ENV), 'server.json');
|
||||
const serverConfig = path.resolve(appPath, 'config', 'environments', _.lowerCase(process.env.NODE_ENV), 'server.json');
|
||||
|
||||
const server = require(serverConfig);
|
||||
const pathAccess = _.get(server, 'admin.path', 'admin');
|
||||
@ -103,14 +103,20 @@ if (isAdmin) {
|
||||
}));
|
||||
}
|
||||
|
||||
const appPath = isAdmin
|
||||
? path.join(process.cwd(), 'admin', 'src', 'app.js')
|
||||
: path.join(process.cwd(), 'node_modules', 'strapi-helper-plugin', 'lib', 'src', 'app.js');
|
||||
const main = (() => {
|
||||
if (isAdmin && isSetup) {
|
||||
return path.join(process.cwd(), 'admin', 'src', 'app.js');
|
||||
} else if (isAdmin) {
|
||||
return path.join(appPath, 'admin', 'admin', 'src', 'app.js');
|
||||
}
|
||||
|
||||
return path.join(process.env.PWD, 'node_modules', 'strapi-helper-plugin', 'lib', 'src', 'app.js');
|
||||
})();
|
||||
|
||||
module.exports = require('./webpack.base.babel')({
|
||||
// In production, we skip all hot-reloading stuff
|
||||
entry: {
|
||||
main: appPath,
|
||||
main
|
||||
},
|
||||
|
||||
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
|
||||
@ -136,7 +142,7 @@ module.exports = require('./webpack.base.babel')({
|
||||
// Babel presets configuration
|
||||
babelPresets: [
|
||||
[
|
||||
require.resolve('babel-preset-latest'),
|
||||
require.resolve('babel-preset-env'),
|
||||
{
|
||||
es2015: {
|
||||
modules: false,
|
||||
@ -149,12 +155,27 @@ module.exports = require('./webpack.base.babel')({
|
||||
|
||||
alias: {
|
||||
moment: 'moment/moment.js',
|
||||
'lodash': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'),
|
||||
'immutable': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'),
|
||||
'react-intl': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'),
|
||||
'react': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'),
|
||||
'react-dom': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group')
|
||||
'lodash': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
},
|
||||
|
||||
devtool: 'cheap-module-source-map',
|
||||
|
@ -34,11 +34,12 @@
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-eslint": "^7.2.3",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-istanbul": "^4.1.5",
|
||||
"babel-plugin-transform-react-constant-elements": "^6.23.0",
|
||||
"babel-plugin-transform-react-inline-elements": "^6.22.0",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.8",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"babel-preset-latest": "^6.24.1",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-react-hmre": "^1.1.1",
|
||||
"babel-preset-stage-0": "^6.24.1",
|
||||
@ -76,7 +77,7 @@
|
||||
"node-sass": "^4.5.3",
|
||||
"null-loader": "^0.1.1",
|
||||
"plop": "^1.8.0",
|
||||
"postcss-cssnext": "^3.0.2",
|
||||
"postcss-cssnext": "^2.11.0",
|
||||
"postcss-focus": "^2.0.0",
|
||||
"postcss-loader": "^2.0.6",
|
||||
"postcss-reporter": "^5.0.0",
|
||||
|
@ -29,18 +29,18 @@
|
||||
"description": "content-manager.plugin.description"
|
||||
},
|
||||
"scripts": {
|
||||
"analyze:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"analyze:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"preanalyze": "npm run analyze:clean",
|
||||
"analyze": "node node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"prebuild": "npm run build:clean && npm run test",
|
||||
"build:dev": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PLUGIN=true node node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"build:dev": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PLUGIN=true node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/plop/plop.js --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"pretest": "npm run lint",
|
||||
"prettier": "node node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "echo Tests are not implemented.",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
|
@ -8,18 +8,18 @@
|
||||
"description": "content-type-builder.plugin.description"
|
||||
},
|
||||
"scripts": {
|
||||
"analyze:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"analyze:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"preanalyze": "npm run analyze:clean",
|
||||
"analyze": "node node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"prebuild": "npm run build:clean && npm run test",
|
||||
"build:dev": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"build:dev": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"pretest": "npm run lint",
|
||||
"prettier": "node node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "echo Tests are not implemented.",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
|
@ -8,18 +8,18 @@
|
||||
"description": "settings-manager.plugin.description"
|
||||
},
|
||||
"scripts": {
|
||||
"analyze:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"analyze:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json",
|
||||
"preanalyze": "npm run analyze:clean",
|
||||
"analyze": "node node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"prebuild": "npm run build:clean && npm run test",
|
||||
"build:dev": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"build:dev": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"pretest": "npm run lint",
|
||||
"prettier": "node node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "echo Tests are not implemented.",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
|
@ -22,8 +22,8 @@ shell.cd('../strapi-helper-plugin');
|
||||
shell.exec('npm link');
|
||||
|
||||
shell.cd('../strapi-admin');
|
||||
shell.exec('npm install ../strapi-utils');
|
||||
shell.exec('npm install ../strapi-helper-plugin');
|
||||
shell.exec('npm install ../strapi-utils');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
shell.exec('npm link');
|
||||
shell.exec('npm run build');
|
||||
|
Loading…
x
Reference in New Issue
Block a user