mirror of
https://github.com/strapi/strapi.git
synced 2025-11-17 18:51:22 +00:00
Create strapi-helper-plugin package
This commit is contained in:
parent
0125767331
commit
dd99d33ded
@ -1,38 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* PluginHeaderActions
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
class PluginHeaderActions extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
render() {
|
||||
const actions = this.props.actions && this.props.actions.map((action, i) => (
|
||||
<button
|
||||
key={i}
|
||||
className={`btn ${action.class} ${styles.btn}`}
|
||||
onClick={action.onClick}
|
||||
disabled={action.disabled}
|
||||
>
|
||||
{action.label}
|
||||
</button>
|
||||
));
|
||||
|
||||
return (
|
||||
<div className={styles.pluginHeaderActions}>
|
||||
<div className="pull-xs-right">
|
||||
{actions}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PluginHeaderActions.propTypes = {
|
||||
actions: React.PropTypes.array,
|
||||
};
|
||||
|
||||
export default PluginHeaderActions;
|
||||
@ -1,3 +0,0 @@
|
||||
.btn {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
// import PluginHeaderActions from '../index';
|
||||
|
||||
import expect from 'expect';
|
||||
// import { shallow } from 'enzyme';
|
||||
// import React from 'react';
|
||||
|
||||
describe('<PluginHeaderActions />', () => {
|
||||
it('Expect to have unit tests specified', () => {
|
||||
expect(true).toEqual(false);
|
||||
});
|
||||
});
|
||||
10
packages/strapi-helper-plugin/.gitignore
vendored
Normal file
10
packages/strapi-helper-plugin/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Don't check auto-generated stuff into git
|
||||
coverage
|
||||
build
|
||||
node_modules
|
||||
stats.json
|
||||
|
||||
# Cruft
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
.idea
|
||||
5
packages/strapi-helper-plugin/README.md
Normal file
5
packages/strapi-helper-plugin/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Strapi Helper Plugin
|
||||
|
||||
## Description
|
||||
|
||||
Helper to develop Strapi plugins.
|
||||
@ -8,15 +8,14 @@
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { syncHistoryWithStore } from 'react-router-redux';
|
||||
|
||||
import App from './containers/App';
|
||||
import createRoutes from './routes';
|
||||
import configureStore from './store';
|
||||
import { selectLocationState } from './containers/App/selectors';
|
||||
import { translationMessages } from './i18n';
|
||||
import App from 'containers/App';
|
||||
import createRoutes from 'routes';
|
||||
import configureStore from 'store';
|
||||
import { selectLocationState } from 'containers/App/selectors';
|
||||
// import { translationMessages } from 'i18n';
|
||||
|
||||
// Plugin identifier based on the package.json `name` value
|
||||
const pluginId = require('../package.json').name.replace(
|
||||
const pluginId = require('../../../../package.json').name.replace(
|
||||
/^strapi-plugin-/i,
|
||||
''
|
||||
);
|
||||
@ -59,7 +58,7 @@ if (window.Strapi) {
|
||||
leftMenuLinks: [],
|
||||
mainComponent: Comp,
|
||||
routes: createRoutes(store),
|
||||
translationMessages,
|
||||
// translationMessages,
|
||||
});
|
||||
}
|
||||
|
||||
24
packages/strapi-helper-plugin/lib/app/i18n.js
Normal file
24
packages/strapi-helper-plugin/lib/app/i18n.js
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* i18n.js
|
||||
*
|
||||
* This will setup the i18n language files and locale data for your plugin.
|
||||
*
|
||||
*/
|
||||
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import enTranslationMessages from './translations/en.json';
|
||||
import frTranslationMessages from './translations/fr.json';
|
||||
|
||||
const translationMessages = {
|
||||
en: enTranslationMessages,
|
||||
fr: frTranslationMessages,
|
||||
};
|
||||
|
||||
const define = messages => {
|
||||
defineMessages(messages);
|
||||
};
|
||||
|
||||
|
||||
|
||||
export { translationMessages, define };
|
||||
@ -7,7 +7,7 @@ import { combineReducers } from 'redux-immutable';
|
||||
import { fromJS } from 'immutable';
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
|
||||
import globalReducer from './containers/App/reducer';
|
||||
import globalReducer from 'containers/App/reducer';
|
||||
|
||||
/*
|
||||
* routeReducer
|
||||
@ -1,8 +1,7 @@
|
||||
import { conformsTo, isEmpty, isFunction, isObject, isString } from 'lodash';
|
||||
import invariant from 'invariant';
|
||||
import warning from 'warning';
|
||||
|
||||
import createReducer from '../reducers';
|
||||
import createReducer from 'reducers';
|
||||
|
||||
/**
|
||||
* Validate the shape of redux store
|
||||
@ -2,6 +2,7 @@ const resolve = require('path').resolve;
|
||||
|
||||
const pullAll = require('lodash/pullAll');
|
||||
const uniq = require('lodash/uniq');
|
||||
const merge = require('lodash/uniq');
|
||||
|
||||
const ReactBoilerplate = {
|
||||
// This refers to the react-boilerplate version this project is based on.
|
||||
@ -41,10 +42,10 @@ const ReactBoilerplate = {
|
||||
path: resolve('../node_modules/react-boilerplate-dlls'),
|
||||
},
|
||||
|
||||
entry(pkg) {
|
||||
const dependencyNames = Object.keys(pkg.dependencies);
|
||||
const exclude = pkg.dllPlugin.exclude || ReactBoilerplate.dllPlugin.defaults.exclude;
|
||||
const include = pkg.dllPlugin.include || ReactBoilerplate.dllPlugin.defaults.include;
|
||||
entry(helperPkg, pluginPkg) {
|
||||
const dependencyNames = merge(Object.keys(helperPkg.dependencies), Object.keys(pluginPkg.dependencies));
|
||||
const exclude = ReactBoilerplate.dllPlugin.defaults.exclude;
|
||||
const include = ReactBoilerplate.dllPlugin.defaults.include;
|
||||
const includeDependencies = uniq(dependencyNames.concat(include));
|
||||
|
||||
return {
|
||||
@ -39,12 +39,12 @@ module.exports = {
|
||||
// Generate index.js and index.test.js
|
||||
const actions = [{
|
||||
type: 'add',
|
||||
path: '../../app/components/{{properCase name}}/index.js',
|
||||
path: '../../../../../app/components/{{properCase name}}/index.js',
|
||||
templateFile: data.type === 'ES6 Class' ? './component/es6.js.hbs' : './component/stateless.js.hbs',
|
||||
abortOnFail: true,
|
||||
}, {
|
||||
type: 'add',
|
||||
path: '../../app/components/{{properCase name}}/tests/index.test.js',
|
||||
path: '../../../../../app/components/{{properCase name}}/tests/index.test.js',
|
||||
templateFile: './component/test.js.hbs',
|
||||
abortOnFail: true,
|
||||
}];
|
||||
@ -53,7 +53,7 @@ module.exports = {
|
||||
if (data.wantCSS) {
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/components/{{properCase name}}/styles.scss',
|
||||
path: '../../../../../app/components/{{properCase name}}/styles.scss',
|
||||
templateFile: './component/styles.scss.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -63,7 +63,7 @@ module.exports = {
|
||||
if (data.wantMessages) {
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/components/{{properCase name}}/messages.js',
|
||||
path: '../../../../../app/components/{{properCase name}}/messages.js',
|
||||
templateFile: './component/messages.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -48,12 +48,12 @@ module.exports = {
|
||||
// Generate index.js and index.test.js
|
||||
const actions = [{
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/index.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/index.js',
|
||||
templateFile: './container/index.js.hbs',
|
||||
abortOnFail: true,
|
||||
}, {
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/tests/index.test.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/tests/index.test.js',
|
||||
templateFile: './container/test.js.hbs',
|
||||
abortOnFail: true,
|
||||
}];
|
||||
@ -62,7 +62,7 @@ module.exports = {
|
||||
if (data.wantCSS) {
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/styles.scss',
|
||||
path: '../../../../../app/containers/{{properCase name}}/styles.scss',
|
||||
templateFile: './container/styles.scss.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -72,7 +72,7 @@ module.exports = {
|
||||
if (data.wantMessages) {
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/messages.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/messages.js',
|
||||
templateFile: './container/messages.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -84,13 +84,13 @@ module.exports = {
|
||||
// Actions
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/actions.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/actions.js',
|
||||
templateFile: './container/actions.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/tests/actions.test.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/tests/actions.test.js',
|
||||
templateFile: './container/actions.test.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -98,7 +98,7 @@ module.exports = {
|
||||
// Constants
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/constants.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/constants.js',
|
||||
templateFile: './container/constants.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -106,13 +106,13 @@ module.exports = {
|
||||
// Selectors
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/selectors.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/selectors.js',
|
||||
templateFile: './container/selectors.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/tests/selectors.test.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/tests/selectors.test.js',
|
||||
templateFile: './container/selectors.test.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -120,13 +120,13 @@ module.exports = {
|
||||
// Reducer
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/reducer.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/reducer.js',
|
||||
templateFile: './container/reducer.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/tests/reducer.test.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/tests/reducer.test.js',
|
||||
templateFile: './container/reducer.test.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -136,13 +136,13 @@ module.exports = {
|
||||
if (data.wantSagas) {
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/sagas.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/sagas.js',
|
||||
templateFile: './container/sagas.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/containers/{{properCase name}}/tests/sagas.test.js',
|
||||
path: '../../../../../app/containers/{{properCase name}}/tests/sagas.test.js',
|
||||
templateFile: './container/sagas.test.js.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const componentGenerator = require('./component/index.js');
|
||||
const containerGenerator = require('./container/index.js');
|
||||
@ -17,11 +18,14 @@ module.exports = (plop) => {
|
||||
plop.setGenerator('route', routeGenerator);
|
||||
plop.setGenerator('language', languageGenerator);
|
||||
plop.addHelper('directory', (comp) => {
|
||||
console.log('-----------------------------------------------')
|
||||
console.log(path.resolve(process.cwd(), 'app', 'containers', comp))
|
||||
console.log('-----------------------------------------------')
|
||||
try {
|
||||
fs.accessSync(`app/containers/${comp}`, fs.F_OK);
|
||||
return `containers/${comp}`;
|
||||
fs.accessSync(`${path.resolve(process.cwd(), 'app', 'containers', comp)}`, fs.F_OK);
|
||||
return `${path.resolve(process.cwd(), 'app', 'containers', comp)}`;
|
||||
} catch (e) {
|
||||
return `components/${comp}`;
|
||||
return `${path.resolve(process.cwd(), 'app', 'components', comp)}`;
|
||||
}
|
||||
});
|
||||
plop.addHelper('curly', (object, open) => (open ? '{' : '}'));
|
||||
@ -23,43 +23,43 @@ module.exports = {
|
||||
const actions = [];
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/i18n.js',
|
||||
path: '../../../../../app/i18n.js',
|
||||
pattern: /('react-intl\/locale-data\/[a-z]+';\n)(?!.*'react-intl\/locale-data\/[a-z]+';)/g,
|
||||
templateFile: './language/intl-locale-data.hbs',
|
||||
});
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/i18n.js',
|
||||
path: '../../../../../app/i18n.js',
|
||||
pattern: /([\n\s'[a-z]+',)(?!.*[\n\s'[a-z]+',)/g,
|
||||
templateFile: './language/app-locale.hbs',
|
||||
});
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/i18n.js',
|
||||
path: '../../../../../app/i18n.js',
|
||||
pattern: /(from\s'.\/translations\/[a-z]+.json';\n)(?!.*from\s'.\/translations\/[a-z]+.json';)/g,
|
||||
templateFile: './language/translation-messages.hbs',
|
||||
});
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/i18n.js',
|
||||
path: '../../../../../app/i18n.js',
|
||||
pattern: /(addLocaleData\([a-z]+LocaleData\);\n)(?!.*addLocaleData\([a-z]+LocaleData\);)/g,
|
||||
templateFile: './language/add-locale-data.hbs',
|
||||
});
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/i18n.js',
|
||||
path: '../../../../../app/i18n.js',
|
||||
pattern: /([a-z]+:\sformatTranslationMessages\([a-z]+TranslationMessages\),\n)(?!.*[a-z]+:\sformatTranslationMessages\([a-z]+TranslationMessages\),)/g,
|
||||
templateFile: './language/format-translation-messages.hbs',
|
||||
});
|
||||
actions.push({
|
||||
type: 'add',
|
||||
path: '../../app/translations/{{language}}.json',
|
||||
path: '../../../../../app/translations/{{language}}.json',
|
||||
templateFile: './language/translations-json.hbs',
|
||||
abortOnFail: true,
|
||||
});
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/app.js',
|
||||
path: '../../../../../app/app.js',
|
||||
pattern: /(System\.import\('intl\/locale-data\/jsonp\/[a-z]+\.js'\),\n)(?!.*System\.import\('intl\/locale-data\/jsonp\/[a-z]+\.js'\),)/g,
|
||||
templateFile: './language/polyfill-intl-locale.hbs',
|
||||
});
|
||||
@ -63,14 +63,14 @@ module.exports = {
|
||||
data.useSagas = sagasExists(data.component); // eslint-disable-line no-param-reassign
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/routes.js',
|
||||
path: '../../../../../app/routes.js',
|
||||
pattern: /(\s{\n\s{0,}path: '\*',)/g,
|
||||
template: trimTemplateFile('routeWithReducer.hbs'),
|
||||
});
|
||||
} else {
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: '../../app/routes.js',
|
||||
path: '../../../../../app/routes.js',
|
||||
pattern: /(\s{\n\s{0,}path: '\*',)/g,
|
||||
template: trimTemplateFile('route.hbs'),
|
||||
});
|
||||
@ -5,8 +5,10 @@
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const pageComponents = fs.readdirSync('app/components');
|
||||
const pageContainers = fs.readdirSync('app/containers');
|
||||
const path = require('path');
|
||||
|
||||
const pageComponents = fs.readdirSync(path.resolve(process.cwd(), 'app', 'components'));
|
||||
const pageContainers = fs.readdirSync(path.resolve(process.cwd(), 'app', 'containers'));
|
||||
const components = pageComponents.concat(pageContainers);
|
||||
|
||||
function componentExists(comp) {
|
||||
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var shelljs = require('shelljs');
|
||||
var path = require('path');
|
||||
|
||||
var animateProgress = require('./helpers/progress');
|
||||
var chalk = require('chalk');
|
||||
var addCheckMark = require('./helpers/checkmark');
|
||||
@ -9,7 +11,7 @@ var progress = animateProgress('Generating stats');
|
||||
|
||||
// Generate stats.json file with webpack
|
||||
shelljs.exec(
|
||||
'webpack --config internals/webpack/webpack.prod.babel.js --profile --json > stats.json',
|
||||
`./node_modules/strapi-helper-plugin/node_modules/webpack/bin/webpack.js --config ${path.resolve(__dirname, '..', 'webpack', 'webpack.prod.babel.js')} --profile --json > stats.json`,
|
||||
addCheckMark.bind(null, callback) // Output a checkmark on completion
|
||||
);
|
||||
|
||||
@ -46,4 +46,4 @@ if (!exists(dllManifestPath)) {
|
||||
}
|
||||
|
||||
// the BUILDING_DLL env var is set to avoid confusing the development environment
|
||||
exec('cross-env BUILDING_DLL=true webpack --display-chunks --color --config internals/webpack/webpack.dll.babel.js')
|
||||
exec('./node_modules/strapi-helper-plugin/node_modules/cross-env/bin/cross-env.js BUILDING_DLL=true ./node_modules/strapi-helper-plugin/node_modules/webpack/bin/webpack.js --display-chunks --color --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js')
|
||||
@ -3,7 +3,7 @@ var exec = require('child_process').exec;
|
||||
exec('npm -v', function (err, stdout, stderr) {
|
||||
if (err) throw err;
|
||||
if (parseFloat(stdout) < 3) {
|
||||
throw new Error('[ERROR: React Boilerplate] You need npm version @>=3');
|
||||
throw new Error('[ERROR: Strapi plugin] You need npm version @>=3');
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
@ -6,6 +6,7 @@ const path = require('path');
|
||||
|
||||
const webpack = require('webpack');
|
||||
|
||||
console.log(require.resolve('babel-preset-latest'))
|
||||
module.exports = (options) => ({
|
||||
entry: options.entry,
|
||||
output: Object.assign({ // Compile into js/build.js
|
||||
@ -15,14 +16,51 @@ module.exports = (options) => ({
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.js$/, // Transform all .js files required somewhere with Babel
|
||||
loader: 'babel',
|
||||
exclude: /node_modules/,
|
||||
query: options.babelQuery,
|
||||
use: {
|
||||
loader: 'babel',
|
||||
options: {
|
||||
"presets": [
|
||||
[
|
||||
require.resolve('babel-preset-latest'),
|
||||
{
|
||||
"es2015": {
|
||||
"modules": false
|
||||
}
|
||||
}
|
||||
],
|
||||
require.resolve('babel-preset-react'),
|
||||
require.resolve('babel-preset-stage-0'),
|
||||
],
|
||||
"env": {
|
||||
"production": {
|
||||
"only": [
|
||||
"app"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-react-remove-prop-types",
|
||||
"transform-react-constant-elements",
|
||||
"transform-react-inline-elements"
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"plugins": [
|
||||
"istanbul"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
include: [
|
||||
path.join(process.cwd(), 'app'),
|
||||
// Add the `strapi-helper-plugin` folders watched by babel
|
||||
path.join(process.cwd(), 'node_modules', 'strapi-helper-plugin', 'lib', 'app'),
|
||||
],
|
||||
}, {
|
||||
// Transform our own .css files with PostCSS and CSS-modules
|
||||
test: /\.scss$/,
|
||||
exclude: /node_modules/,
|
||||
loader: options.cssLoaders,
|
||||
// loader: 'null-loader'
|
||||
use: options.cssLoaders,
|
||||
}, {
|
||||
// Do not transform vendor's CSS with CSS-modules
|
||||
// The point is that they remain in global scope.
|
||||
@ -66,7 +104,13 @@ module.exports = (options) => ({
|
||||
new webpack.NamedModulesPlugin(),
|
||||
]),
|
||||
resolve: {
|
||||
modules: ['node_modules'],
|
||||
modules: [
|
||||
'app',
|
||||
'node_modules/strapi-helper-plugin/lib/app',
|
||||
'node_modules/strapi-helper-plugin/node_modules',
|
||||
'node_modules'
|
||||
],
|
||||
symlinks: false,
|
||||
extensions: [
|
||||
'.js',
|
||||
'.jsx',
|
||||
@ -78,6 +122,13 @@ module.exports = (options) => ({
|
||||
'main',
|
||||
],
|
||||
},
|
||||
|
||||
resolveLoader: {
|
||||
modules: [
|
||||
path.join(__dirname, '..', '..', '..', 'node_modules'),
|
||||
path.join(process.cwd(), 'node_modules'),
|
||||
]
|
||||
},
|
||||
devtool: options.devtool,
|
||||
target: 'web', // Make web variables accessible to webpack, e.g. window
|
||||
});
|
||||
@ -2,8 +2,8 @@
|
||||
* DEVELOPMENT WEBPACK CONFIGURATION
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const webpack = require('webpack');
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
@ -16,6 +16,8 @@ const plugins = [
|
||||
new webpack.NoErrorsPlugin(),
|
||||
];
|
||||
|
||||
console.log(path.resolve(__dirname, '..', 'postcss', 'postcss.config.js'))
|
||||
|
||||
const logger = require('../../server/logger');
|
||||
|
||||
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
@ -28,7 +30,7 @@ module.exports = require('./webpack.base.babel')({
|
||||
entry: [
|
||||
'eventsource-polyfill', // Necessary for hot reloading with IE
|
||||
`webpack-hot-middleware/client?path=http://localhost:${port}/__webpack_hmr`,
|
||||
path.join(process.cwd(), 'app/app.js'), // Start with js/app.js
|
||||
path.join(process.cwd(), 'node_modules', 'strapi-helper-plugin', 'lib', 'app', 'app.js'), // Start with js/app.js
|
||||
],
|
||||
|
||||
// Don't use hashes in dev mode for better performance
|
||||
@ -43,7 +45,24 @@ module.exports = require('./webpack.base.babel')({
|
||||
|
||||
// Load the SCSS in a style tag in development
|
||||
// cssLoaders: 'style-loader!css-loader?modules&importLoaders=1&sourceMap!postcss-loader!sass-loader',
|
||||
cssLoaders: `style-loader!css-loader?localIdentName=${pluginId}[local]__[path][name]__[hash:base64:5]&modules&importLoaders=1&sourceMap!postcss-loader!sass-loader`,
|
||||
cssLoaders: [{
|
||||
loader: 'style-loader',
|
||||
}, {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
localIdentName: `${pluginId}[local]__[path][name]__[hash:base64:5]`,
|
||||
modules: true,
|
||||
importLoaders: 1,
|
||||
sourceMap: true,
|
||||
}
|
||||
}, {
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
config: path.resolve(__dirname, '..', 'postcss', 'postcss.config.js')
|
||||
}
|
||||
}, {
|
||||
loader: 'sass-loader',
|
||||
}],
|
||||
|
||||
// Process the CSS with PostCSS
|
||||
postcssPlugins: [
|
||||
@ -14,15 +14,17 @@ const defaults = require('lodash/defaultsDeep');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const dllPlugin = require('../config').dllPlugin;
|
||||
const helperPkg = require(join(__dirname, '..', '..', '..', 'package.json'));
|
||||
|
||||
const pkg = require(join(process.cwd(), 'package.json'));
|
||||
if (!pkg.dllPlugin) { process.exit(0); }
|
||||
const dllConfig = defaults(pkg.dllPlugin, dllPlugin.defaults);
|
||||
const pluginPkg = require(join(process.cwd(), 'package.json'));
|
||||
if (!pluginPkg.dllPlugin) { process.exit(0); }
|
||||
const dllConfig = defaults(pluginPkg.dllPlugin, dllPlugin.defaults);
|
||||
const outputPath = join(process.cwd(), dllConfig.path);
|
||||
|
||||
module.exports = {
|
||||
context: process.cwd(),
|
||||
entry: dllConfig.dlls ? dllConfig.dlls : dllPlugin.entry(pkg),
|
||||
// entry: dllConfig.dlls ? dllConfig.dlls : dllPlugin.entry(pluginPkg),
|
||||
entry: dllPlugin.entry(helperPkg, pluginPkg),
|
||||
devtool: 'eval',
|
||||
output: {
|
||||
filename: '[name].dll.js',
|
||||
@ -32,4 +34,10 @@ module.exports = {
|
||||
plugins: [
|
||||
new webpack.DllPlugin({ name: '[name]', path: join(outputPath, '[name].json') }), // eslint-disable-line no-new
|
||||
],
|
||||
resolve: {
|
||||
modules: [
|
||||
'node_modules',
|
||||
'node_modules/strapi-helper-plugin/node_modules'
|
||||
],
|
||||
},
|
||||
};
|
||||
@ -25,7 +25,7 @@ module.exports = require('./webpack.base.babel')({
|
||||
|
||||
// We use ExtractTextPlugin so we get a seperate SCSS file instead
|
||||
// of the CSS being in the JS and injected as a style tag
|
||||
cssLoaders: `style-loader!css-loader?localIdentName=${pluginId}[local]__[path][name]__[hash:base64:5]&modules&importLoaders=1&sourceMap!postcss-loader!sass-loader`,
|
||||
cssLoaders: `style-loader!css-loader?localIdentName=${pluginId}[local]__[path][name]__[hash:base64:5]&modules&importLoaders=1&sourceMap!postcss-loader?config=${path.resolve(__dirname, '..', 'postcss', 'postcss.config.js')}!sass-loader`,
|
||||
|
||||
// In production, we minify our CSS with cssnano
|
||||
postcssPlugins: [
|
||||
@ -7,7 +7,9 @@ const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const modules = [
|
||||
'app',
|
||||
'node_modules',
|
||||
'node_modules/strapi-helper-plugin/lib/app'
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
@ -45,6 +45,8 @@ const addDevMiddlewares = (app, webpackConfig) => {
|
||||
*/
|
||||
module.exports = (app) => {
|
||||
const webpackConfig = require('../../internals/webpack/webpack.dev.babel');
|
||||
|
||||
// const webpackConfig = require(path.resolve(process.cwd(), 'node_modules', 'strapi-helper-plugin', 'internals', 'webpack', 'webpack.dev.babel'));
|
||||
addDevMiddlewares(app, webpackConfig);
|
||||
|
||||
return app;
|
||||
128
packages/strapi-helper-plugin/package.json
Normal file
128
packages/strapi-helper-plugin/package.json
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"name": "strapi-helper-plugin",
|
||||
"version": "3.0.0-alpha.3",
|
||||
"description": "Helper for Strapi plugins development",
|
||||
"engines": {
|
||||
"node": ">= 7.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
"name": "Strapi team",
|
||||
"url": "http://strapi.io"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Strapi team",
|
||||
"email": "hi@strapi.io",
|
||||
"url": "http://strapi.io"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"pre-commit": [
|
||||
"lint:admin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-polyfill": "6.13.0",
|
||||
"chalk": "1.1.3",
|
||||
"compression": "1.6.2",
|
||||
"cross-env": "3.1.3",
|
||||
"express": "4.14.0",
|
||||
"fontfaceobserver": "2.0.1",
|
||||
"history": "3.0.0",
|
||||
"immutable": "3.8.1",
|
||||
"intl": "1.2.4",
|
||||
"invariant": "2.2.1",
|
||||
"lodash": "4.15.0",
|
||||
"react": "15.3.0",
|
||||
"react-dom": "15.3.0",
|
||||
"react-helmet": "3.1.0",
|
||||
"react-intl": "2.1.3",
|
||||
"react-redux": "4.4.5",
|
||||
"react-router": "2.6.1",
|
||||
"react-router-redux": "4.0.5",
|
||||
"react-router-scroll": "0.2.1",
|
||||
"redux": "3.5.2",
|
||||
"redux-immutable": "3.0.7",
|
||||
"redux-saga": "0.11.0",
|
||||
"reselect": "2.5.3",
|
||||
"warning": "3.0.0",
|
||||
"whatwg-fetch": "1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.18.0",
|
||||
"babel-core": "6.18.0",
|
||||
"babel-eslint": "7.1.0",
|
||||
"babel-loader": "6.2.7",
|
||||
"babel-plugin-istanbul": "2.0.3",
|
||||
"babel-plugin-react-intl": "2.2.0",
|
||||
"babel-plugin-react-transform": "2.0.2",
|
||||
"babel-plugin-transform-async-to-generator": "^6.22.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.22.0",
|
||||
"babel-plugin-transform-react-constant-elements": "6.9.1",
|
||||
"babel-plugin-transform-react-inline-elements": "6.8.0",
|
||||
"babel-plugin-transform-react-remove-prop-types": "0.2.10",
|
||||
"babel-plugin-transform-runtime": "^6.15.0",
|
||||
"babel-preset-es2017": "^6.22.0",
|
||||
"babel-preset-latest": "6.16.0",
|
||||
"babel-preset-react": "6.16.0",
|
||||
"babel-preset-react-hmre": "1.1.1",
|
||||
"babel-preset-stage-0": "6.16.0",
|
||||
"chai": "3.5.0",
|
||||
"chai-enzyme": "0.5.2",
|
||||
"cheerio": "0.22.0",
|
||||
"coveralls": "2.11.14",
|
||||
"css-loader": "0.25.0",
|
||||
"enzyme": "2.5.1",
|
||||
"eslint": "3.9.0",
|
||||
"eslint-config-airbnb": "12.0.0",
|
||||
"eslint-config-airbnb-base": "9.0.0",
|
||||
"eslint-config-prettier": "^2.0.0",
|
||||
"eslint-import-resolver-webpack": "0.6.0",
|
||||
"eslint-plugin-import": "2.0.1",
|
||||
"eslint-plugin-jsx-a11y": "2.2.3",
|
||||
"eslint-plugin-react": "6.4.1",
|
||||
"eslint-plugin-redux-saga": "0.1.5",
|
||||
"eventsource-polyfill": "0.9.6",
|
||||
"expect": "1.20.2",
|
||||
"expect-jsx": "2.6.0",
|
||||
"exports-loader": "0.6.3",
|
||||
"file-loader": "0.9.0",
|
||||
"image-webpack-loader": "2.0.0",
|
||||
"imports-loader": "0.6.5",
|
||||
"json-loader": "0.5.4",
|
||||
"karma": "1.3.0",
|
||||
"karma-chrome-launcher": "2.0.0",
|
||||
"karma-coverage": "1.1.1",
|
||||
"karma-firefox-launcher": "1.0.0",
|
||||
"karma-ie-launcher": "1.0.0",
|
||||
"karma-mocha": "1.2.0",
|
||||
"karma-mocha-reporter": "2.2.0",
|
||||
"karma-safari-launcher": "1.0.0",
|
||||
"karma-sourcemap-loader": "0.3.7",
|
||||
"karma-webpack": "1.8.0",
|
||||
"lint-staged": "3.2.0",
|
||||
"mocha": "3.1.2",
|
||||
"node-sass": "^3.13.0",
|
||||
"null-loader": "0.1.1",
|
||||
"plop": "1.5.0",
|
||||
"postcss-cssnext": "^2.8.0",
|
||||
"postcss-focus": "^1.0.0",
|
||||
"postcss-loader": "^1.1.1",
|
||||
"postcss-reporter": "^2.0.0",
|
||||
"postcss-smart-import": "^0.6.7",
|
||||
"pre-commit": "1.1.3",
|
||||
"precss": "^1.4.0",
|
||||
"prettier": "^1.3.1",
|
||||
"psi": "2.0.4",
|
||||
"rimraf": "2.5.4",
|
||||
"sass-loader": "^4.0.2",
|
||||
"shelljs": "0.7.5",
|
||||
"sinon": "2.0.0-pre",
|
||||
"style-loader": "0.13.1",
|
||||
"url-loader": "0.5.7",
|
||||
"webpack": "2.1.0-beta.25",
|
||||
"webpack-dev-middleware": "1.8.4",
|
||||
"webpack-hot-middleware": "2.13.1"
|
||||
}
|
||||
}
|
||||
@ -9,9 +9,9 @@ import _ from 'lodash';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
|
||||
import Container from '../../components/Container';
|
||||
import EditForm from '../../components/EditForm';
|
||||
import { makeSelectModels } from '../App/selectors';
|
||||
import Container from 'components/Container';
|
||||
import EditForm from 'components/EditForm';
|
||||
import { makeSelectModels } from 'containers/App/selectors';
|
||||
|
||||
import {
|
||||
setCurrentModelName,
|
||||
|
||||
@ -2,8 +2,8 @@ import { takeLatest } from 'redux-saga';
|
||||
import { call, cancel, fork, put, take, select } from 'redux-saga/effects';
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
|
||||
import request from '../../utils/request';
|
||||
import { router } from '../../app';
|
||||
import request from 'utils/request';
|
||||
import { router } from 'app';
|
||||
|
||||
import {
|
||||
recordLoaded,
|
||||
|
||||
@ -7,7 +7,7 @@ import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
import Container from '../../components/Container';
|
||||
import Container from 'components/Container';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
||||
@ -10,10 +10,10 @@ import { createStructuredSelector } from 'reselect';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { makeSelectModels } from '../App/selectors';
|
||||
import Container from '../../components/Container';
|
||||
import Table from '../../components/Table';
|
||||
import TableFooter from '../../components/TableFooter';
|
||||
import { makeSelectModels } from 'containers/App/selectors';
|
||||
import Container from 'components/Container';
|
||||
import Table from 'components/Table';
|
||||
import TableFooter from 'components/TableFooter';
|
||||
|
||||
import styles from './styles.scss';
|
||||
import {
|
||||
|
||||
@ -2,7 +2,7 @@ import { takeLatest } from 'redux-saga';
|
||||
import { put, select, fork, call, take, cancel } from 'redux-saga/effects';
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
|
||||
import request from '../../utils/request';
|
||||
import request from 'utils/request';
|
||||
|
||||
import { loadedRecord, loadedCount } from './actions';
|
||||
import { LOAD_RECORDS, LOAD_COUNT } from './constants';
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
/**
|
||||
* i18n.js
|
||||
*
|
||||
* This will setup the i18n language files and locale data for your plugin.
|
||||
*
|
||||
*/
|
||||
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import enTranslationMessages from './translations/en.json';
|
||||
import frTranslationMessages from './translations/fr.json';
|
||||
|
||||
const translationMessages = {
|
||||
en: enTranslationMessages,
|
||||
fr: frTranslationMessages,
|
||||
};
|
||||
|
||||
const define = messages => {
|
||||
defineMessages(messages);
|
||||
};
|
||||
|
||||
// Hot reloadable translation json files
|
||||
if (module.hot) {
|
||||
// modules.hot.accept does not accept dynamic dependencies,
|
||||
// have to be constants at compile-time
|
||||
module.hot.accept('./i18n', () => {
|
||||
if (window.Strapi) {
|
||||
System.import('./i18n').then(result => {
|
||||
const translationMessagesUpdated = result.translationMessages;
|
||||
window.Strapi
|
||||
.refresh(pluginId)
|
||||
.translationMessages(translationMessagesUpdated);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { translationMessages, define };
|
||||
@ -2,8 +2,8 @@
|
||||
// They are all wrapped in the App component, which should contain the navbar etc
|
||||
// See http://blog.mxstbr.com/2016/01/react-apps-with-pages for more information
|
||||
// about the code splitting business
|
||||
import { getAsyncInjectors } from './utils/asyncInjectors';
|
||||
import appSagas from './containers/App/sagas';
|
||||
import { getAsyncInjectors } from 'utils/asyncInjectors';
|
||||
import appSagas from 'containers/App/sagas';
|
||||
|
||||
const loadModule = cb => componentModule => {
|
||||
cb(null, componentModule.default);
|
||||
|
||||
@ -1,153 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* This script will extract the internationalization messages from all components
|
||||
and package them in the transalation json files in the translations file.
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const nodeGlob = require('glob');
|
||||
const transform = require('babel-core').transform;
|
||||
|
||||
const animateProgress = require('./helpers/progress');
|
||||
const addCheckmark = require('./helpers/checkmark');
|
||||
|
||||
const pkg = require('../../package.json');
|
||||
const i18n = require('../../app/i18n');
|
||||
|
||||
require('shelljs/global');
|
||||
|
||||
// Glob to match all js files except test files
|
||||
const FILES_TO_PARSE = 'app/**/!(*.test).js';
|
||||
const locales = i18n.appLocales;
|
||||
|
||||
const newLine = () => process.stdout.write('\n');
|
||||
|
||||
// Progress Logger
|
||||
let progress;
|
||||
const task = (message) => {
|
||||
progress = animateProgress(message);
|
||||
process.stdout.write(message);
|
||||
|
||||
return (error) => {
|
||||
if (error) {
|
||||
process.stderr.write(error);
|
||||
}
|
||||
clearTimeout(progress);
|
||||
return addCheckmark(() => newLine());
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap async functions below into a promise
|
||||
const glob = (pattern) => new Promise((resolve, reject) => {
|
||||
nodeGlob(pattern, (error, value) => (error ? reject(error) : resolve(value)));
|
||||
});
|
||||
|
||||
const readFile = (fileName) => new Promise((resolve, reject) => {
|
||||
fs.readFile(fileName, (error, value) => (error ? reject(error) : resolve(value)));
|
||||
});
|
||||
|
||||
const writeFile = (fileName, data) => new Promise((resolve, reject) => {
|
||||
fs.writeFile(fileName, data, (error, value) => (error ? reject(error) : resolve(value)));
|
||||
});
|
||||
|
||||
// Store existing translations into memory
|
||||
const oldLocaleMappings = [];
|
||||
const localeMappings = [];
|
||||
// Loop to run once per locale
|
||||
for (const locale of locales) {
|
||||
oldLocaleMappings[locale] = {};
|
||||
localeMappings[locale] = {};
|
||||
// File to store translation messages into
|
||||
const translationFileName = `app/translations/${locale}.json`;
|
||||
try {
|
||||
// Parse the old translation message JSON files
|
||||
const messages = JSON.parse(fs.readFileSync(translationFileName));
|
||||
for (const message of messages) {
|
||||
oldLocaleMappings[locale][message.id] = message;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.code !== 'ENOENT') {
|
||||
process.stderr.write(
|
||||
`There was an error loading this translation file: ${translationFileName}
|
||||
\n${error}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const extractFromFile = async (fileName) => {
|
||||
try {
|
||||
const code = await readFile(fileName);
|
||||
// Use babel plugin to extract instances where react-intl is used
|
||||
const { metadata: result } = await transform(code, {
|
||||
presets: pkg.babel.presets,
|
||||
plugins: [
|
||||
['react-intl'],
|
||||
],
|
||||
});
|
||||
for (const message of result['react-intl'].messages) {
|
||||
for (const locale of locales) {
|
||||
const oldLocaleMapping = oldLocaleMappings[locale][message.id];
|
||||
// Merge old translations into the babel extracted instances where react-intl is used
|
||||
localeMappings[locale][message.id] = {
|
||||
id: message.id,
|
||||
description: message.description,
|
||||
defaultMessage: message.defaultMessage,
|
||||
message: (oldLocaleMapping && oldLocaleMapping.message)
|
||||
? oldLocaleMapping.message
|
||||
: '',
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
process.stderr.write(`Error transforming file: ${fileName}\n${error}`);
|
||||
}
|
||||
};
|
||||
|
||||
(async function main() {
|
||||
const memoryTaskDone = task('Storing language files in memory');
|
||||
const files = await glob(FILES_TO_PARSE);
|
||||
memoryTaskDone()
|
||||
|
||||
const extractTaskDone = task('Run extraction on all files');
|
||||
// Run extraction on all files that match the glob on line 16
|
||||
await Promise.all(files.map((fileName) => extractFromFile(fileName)));
|
||||
extractTaskDone()
|
||||
|
||||
// Make the directory if it doesn't exist, especially for first run
|
||||
mkdir('-p', 'app/translations');
|
||||
for (const locale of locales) {
|
||||
const translationFileName = `app/translations/${locale}.json`;
|
||||
|
||||
try {
|
||||
const localeTaskDone = task(
|
||||
`Writing translation messages for ${locale} to: ${translationFileName}`
|
||||
);
|
||||
|
||||
// Sort the translation JSON file so that git diffing is easier
|
||||
// Otherwise the translation messages will jump around every time we extract
|
||||
let messages = Object.values(localeMappings[locale]).sort((a, b) => {
|
||||
a = a.id.toUpperCase();
|
||||
b = b.id.toUpperCase();
|
||||
return do {
|
||||
if (a < b) -1;
|
||||
else if (a > b) 1;
|
||||
else 0;
|
||||
};
|
||||
});
|
||||
|
||||
// Write to file the JSON representation of the translation messages
|
||||
const prettified = `${JSON.stringify(messages, null, 2)}\n`;
|
||||
|
||||
await writeFile(translationFileName, prettified);
|
||||
|
||||
localeTaskDone();
|
||||
} catch (error) {
|
||||
localeTaskDone(
|
||||
`There was an error saving this translation file: ${translationFileName}
|
||||
\n${error}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
process.exit()
|
||||
}());
|
||||
@ -11,36 +11,26 @@
|
||||
"author": "Strapi",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"analyze:clean": "rimraf stats.json",
|
||||
"analyze:clean": "./node_modules/strapi-helper-plugin/node_modules/rimraf/bin.js stats.json",
|
||||
"preanalyze": "npm run analyze:clean",
|
||||
"analyze": "node ./internals/scripts/analyze.js",
|
||||
"extract-intl": "babel-node --presets latest,stage-0 -- ./internals/scripts/extract-intl.js",
|
||||
"npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
|
||||
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"npmcheckversion": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/npmcheckversion.js",
|
||||
"preinstall": "npm run npmcheckversion",
|
||||
"postinstall": "npm run build:dll",
|
||||
"prebuild": "npm run build:clean && npm run test",
|
||||
"build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "npm run test:clean && rimraf ./build",
|
||||
"build:dll": "node ./internals/scripts/dependencies.js",
|
||||
"start": "cross-env NODE_ENV=development node server",
|
||||
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
|
||||
"start:production": "npm run build && npm run start:prod",
|
||||
"start:prod": "cross-env NODE_ENV=production node server",
|
||||
"pagespeed": "node ./internals/scripts/pagespeed.js",
|
||||
"presetup": "npm i chalk shelljs",
|
||||
"setup": "node ./internals/scripts/setup.js",
|
||||
"postsetup": "npm run build:dll",
|
||||
"clean": "shjs ./internals/scripts/clean.js",
|
||||
"clean:all": "npm run analyze:clean && npm run test:clean && npm run build:clean",
|
||||
"generate": "plop --plopfile internals/generators/index.js",
|
||||
"build": "./node_modules/cross-env/bin/cross-env.js NODE_ENV=production ./node_modules/strapi-helper-plugin/webpack/bin/webpack.js --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "npm run test:clean && ./node_modules/strapi-helper-plugin/node_modules/rimraf/bin.js ./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": "npm run lint:js",
|
||||
"lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts",
|
||||
"lint:eslint": "./node_modules/strapi-helper-plugin/node_modules/eslint/bin/eslint.js --ignore-path .gitignore",
|
||||
"lint:js": "npm run lint:eslint -- . ",
|
||||
"lint:staged": "lint-staged",
|
||||
"pretest": "npm run test:clean && npm run lint",
|
||||
"prettier": "prettier --single-quote --trailing-comma es5 --write \"{app,__{tests,mocks}__}/**/*.js\"",
|
||||
"test:clean": "rimraf ./coverage",
|
||||
"test": "cross-env NODE_ENV=test karma start internals/testing/karma.conf.js --single-run",
|
||||
"prettier": "./node_modules/strapi-helper-plugin/node_modules/prettier/bin/prettier.js --single-quote --trailing-comma es5 --write \"{app,__{tests,mocks}__}/**/*.js\"",
|
||||
"test:clean": "./node_modules/strapi-helper-plugin/node_modules/rimraf/bin.js ./coverage",
|
||||
"test": "./node_modules/cross-env/bin/cross-env.js NODE_ENV=test ./node_modules/strapi-helper-plugin/node_modules/karma/bin/karma start ./node_modules/strapi-helper-plugin/lib/internals/testing/karma.conf.js --single-run",
|
||||
"test:watch": "npm run test -- --auto-watch --no-single-run",
|
||||
"test:firefox": "npm run test -- --browsers Firefox",
|
||||
"test:safari": "npm run test -- --browsers Safari",
|
||||
@ -54,37 +44,6 @@
|
||||
]
|
||||
},
|
||||
"pre-commit": "lint:staged",
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"latest",
|
||||
{
|
||||
"es2015": {
|
||||
"modules": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"react",
|
||||
"stage-0"
|
||||
],
|
||||
"env": {
|
||||
"production": {
|
||||
"only": [
|
||||
"app"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-react-remove-prop-types",
|
||||
"transform-react-constant-elements",
|
||||
"transform-react-inline-elements"
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"plugins": [
|
||||
"istanbul"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslintConfig": {
|
||||
"parser": "babel-eslint",
|
||||
"extends": [
|
||||
@ -173,7 +132,7 @@
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"webpack": {
|
||||
"config": "./internals/webpack/webpack.test.babel.js"
|
||||
"config": "./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.test.babel.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,107 +154,8 @@
|
||||
"eventsource-polyfill"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-polyfill": "6.13.0",
|
||||
"chalk": "1.1.3",
|
||||
"compression": "1.6.2",
|
||||
"cross-env": "3.1.3",
|
||||
"express": "4.14.0",
|
||||
"fontfaceobserver": "2.0.1",
|
||||
"history": "3.0.0",
|
||||
"immutable": "3.8.1",
|
||||
"intl": "1.2.4",
|
||||
"invariant": "2.2.1",
|
||||
"lodash": "4.15.0",
|
||||
"react": "15.3.0",
|
||||
"react-dom": "15.3.0",
|
||||
"react-helmet": "3.1.0",
|
||||
"react-intl": "2.1.3",
|
||||
"react-redux": "4.4.5",
|
||||
"react-router": "2.6.1",
|
||||
"react-router-redux": "4.0.5",
|
||||
"react-router-scroll": "0.2.1",
|
||||
"redux": "3.5.2",
|
||||
"redux-immutable": "3.0.7",
|
||||
"redux-saga": "0.11.0",
|
||||
"reselect": "2.5.3",
|
||||
"warning": "3.0.0",
|
||||
"whatwg-fetch": "1.0.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.18.0",
|
||||
"babel-core": "6.18.0",
|
||||
"babel-eslint": "7.1.0",
|
||||
"babel-loader": "6.2.7",
|
||||
"babel-plugin-istanbul": "2.0.3",
|
||||
"babel-plugin-react-intl": "2.2.0",
|
||||
"babel-plugin-react-transform": "2.0.2",
|
||||
"babel-plugin-transform-async-to-generator": "^6.22.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.22.0",
|
||||
"babel-plugin-transform-react-constant-elements": "6.9.1",
|
||||
"babel-plugin-transform-react-inline-elements": "6.8.0",
|
||||
"babel-plugin-transform-react-remove-prop-types": "0.2.10",
|
||||
"babel-plugin-transform-runtime": "^6.15.0",
|
||||
"babel-preset-es2017": "^6.22.0",
|
||||
"babel-preset-latest": "6.16.0",
|
||||
"babel-preset-react": "6.16.0",
|
||||
"babel-preset-react-hmre": "1.1.1",
|
||||
"babel-preset-stage-0": "6.16.0",
|
||||
"chai": "3.5.0",
|
||||
"chai-enzyme": "0.5.2",
|
||||
"cheerio": "0.22.0",
|
||||
"coveralls": "2.11.14",
|
||||
"css-loader": "0.25.0",
|
||||
"enzyme": "2.5.1",
|
||||
"eslint": "3.9.0",
|
||||
"eslint-config-airbnb": "12.0.0",
|
||||
"eslint-config-airbnb-base": "9.0.0",
|
||||
"eslint-config-prettier": "^2.0.0",
|
||||
"eslint-import-resolver-webpack": "0.6.0",
|
||||
"eslint-plugin-import": "2.0.1",
|
||||
"eslint-plugin-jsx-a11y": "2.2.3",
|
||||
"eslint-plugin-react": "6.4.1",
|
||||
"eslint-plugin-redux-saga": "0.1.5",
|
||||
"eventsource-polyfill": "0.9.6",
|
||||
"expect": "1.20.2",
|
||||
"expect-jsx": "2.6.0",
|
||||
"exports-loader": "0.6.3",
|
||||
"file-loader": "0.9.0",
|
||||
"image-webpack-loader": "2.0.0",
|
||||
"imports-loader": "0.6.5",
|
||||
"json-loader": "0.5.4",
|
||||
"karma": "1.3.0",
|
||||
"karma-chrome-launcher": "2.0.0",
|
||||
"karma-coverage": "1.1.1",
|
||||
"karma-firefox-launcher": "1.0.0",
|
||||
"karma-ie-launcher": "1.0.0",
|
||||
"karma-mocha": "1.2.0",
|
||||
"karma-mocha-reporter": "2.2.0",
|
||||
"karma-safari-launcher": "1.0.0",
|
||||
"karma-sourcemap-loader": "0.3.7",
|
||||
"karma-webpack": "1.8.0",
|
||||
"lint-staged": "3.2.0",
|
||||
"mocha": "3.1.2",
|
||||
"node-sass": "^3.13.0",
|
||||
"null-loader": "0.1.1",
|
||||
"plop": "1.5.0",
|
||||
"postcss-cssnext": "^2.8.0",
|
||||
"postcss-focus": "^1.0.0",
|
||||
"postcss-loader": "^1.1.1",
|
||||
"postcss-reporter": "^2.0.0",
|
||||
"postcss-smart-import": "^0.6.7",
|
||||
"pre-commit": "1.1.3",
|
||||
"precss": "^1.4.0",
|
||||
"prettier": "^1.3.1",
|
||||
"psi": "2.0.4",
|
||||
"rimraf": "2.5.4",
|
||||
"sass-loader": "^4.0.2",
|
||||
"shelljs": "0.7.5",
|
||||
"sinon": "2.0.0-pre",
|
||||
"style-loader": "0.13.1",
|
||||
"url-loader": "0.5.7",
|
||||
"webpack": "2.1.0-beta.25",
|
||||
"webpack-dev-middleware": "1.8.4",
|
||||
"webpack-hot-middleware": "2.13.1"
|
||||
"strapi-helper-plugin": "^3.0.0-alpha.3"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user