mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 08:08:05 +00:00
Build working
This commit is contained in:
parent
25ced3c084
commit
79ba29b6a1
@ -38,7 +38,9 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
file: function* () {
|
file: function* () {
|
||||||
|
console.log('file', this.params.file, ' ', path.resolve(__dirname, '..', 'public', 'build', this.params.file));
|
||||||
yield sendfile(this, path.resolve(__dirname, '..', 'public', 'build', this.params.file));
|
yield sendfile(this, path.resolve(__dirname, '..', 'public', 'build', this.params.file));
|
||||||
|
console.log(':(')
|
||||||
if (!this.status) this.throw(404);
|
if (!this.status) this.throw(404);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -45,7 +45,7 @@ if (module.hot) {
|
|||||||
module.hot.accept('./i18n', () => {
|
module.hot.accept('./i18n', () => {
|
||||||
if (window.Strapi) {
|
if (window.Strapi) {
|
||||||
System.import('./i18n')
|
System.import('./i18n')
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
const translationMessagesUpdated = result.translationMessages;
|
const translationMessagesUpdated = result.translationMessages;
|
||||||
window.Strapi.refresh(pluginId).translationMessages(translationMessagesUpdated);
|
window.Strapi.refresh(pluginId).translationMessages(translationMessagesUpdated);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -13,19 +13,18 @@ import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|||||||
|
|
||||||
import appMessages from 'containers/App/messages.json';
|
import appMessages from 'containers/App/messages.json';
|
||||||
import messages from './messages.json';
|
import messages from './messages.json';
|
||||||
console.log('messages', messages)
|
|
||||||
import { define } from '../../i18n';
|
import { define } from '../../i18n';
|
||||||
define(messages);
|
define(messages);
|
||||||
|
|
||||||
import {
|
import {
|
||||||
selectHome,
|
// selectHome,
|
||||||
selectLoading,
|
selectLoading,
|
||||||
selectError,
|
selectError,
|
||||||
selectGeneralSettings,
|
// selectGeneralSettings,
|
||||||
selectName,
|
selectName,
|
||||||
selectDescription,
|
selectDescription,
|
||||||
selectVersion,
|
selectVersion,
|
||||||
selectLocationState,
|
// selectLocationState,
|
||||||
} from './selectors';
|
} from './selectors';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -124,17 +123,17 @@ HomePage.propTypes = {
|
|||||||
React.PropTypes.string,
|
React.PropTypes.string,
|
||||||
React.PropTypes.bool,
|
React.PropTypes.bool,
|
||||||
]),
|
]),
|
||||||
error: React.PropTypes.oneOfType([
|
// error: React.PropTypes.oneOfType([
|
||||||
React.PropTypes.object,
|
// React.PropTypes.object,
|
||||||
React.PropTypes.bool,
|
// React.PropTypes.bool,
|
||||||
]),
|
// ]),
|
||||||
intl: intlShape.isRequired,
|
intl: intlShape.isRequired,
|
||||||
loading: React.PropTypes.bool,
|
// loading: React.PropTypes.bool,
|
||||||
name: React.PropTypes.oneOfType([
|
name: React.PropTypes.oneOfType([
|
||||||
React.PropTypes.string,
|
React.PropTypes.string,
|
||||||
React.PropTypes.bool,
|
React.PropTypes.bool,
|
||||||
]),
|
]),
|
||||||
onCancel: React.PropTypes.func,
|
// onCancel: React.PropTypes.func,
|
||||||
onChangeName: React.PropTypes.func,
|
onChangeName: React.PropTypes.func,
|
||||||
onChangeDescription: React.PropTypes.func,
|
onChangeDescription: React.PropTypes.func,
|
||||||
onChangeVersion: React.PropTypes.func,
|
onChangeVersion: React.PropTypes.func,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const translationMessages = {
|
|||||||
fr: frTranslationMessages,
|
fr: frTranslationMessages,
|
||||||
};
|
};
|
||||||
|
|
||||||
const define = messages => {
|
const define = (messages) => {
|
||||||
defineMessages(messages);
|
defineMessages(messages);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import createSagaMiddleware from 'redux-saga';
|
|||||||
import createReducer from './reducers';
|
import createReducer from './reducers';
|
||||||
|
|
||||||
const sagaMiddleware = createSagaMiddleware();
|
const sagaMiddleware = createSagaMiddleware();
|
||||||
const devtools = window.devToolsExtension || (() => noop => noop);
|
const devtools = window.devToolsExtension || (() => (noop) => noop);
|
||||||
|
|
||||||
export default function configureStore(initialState = {}, history) {
|
export default function configureStore(initialState = {}, history) {
|
||||||
// Create the store with two middlewares
|
// Create the store with two middlewares
|
||||||
|
|||||||
@ -19,13 +19,13 @@ function parseJSON(response) {
|
|||||||
* @return {Promise} Returns either the response, or throws an error
|
* @return {Promise} Returns either the response, or throws an error
|
||||||
*/
|
*/
|
||||||
function checkStatus(response) {
|
function checkStatus(response) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
if (response.status >= 200 && response.status < 300) {
|
if (response.status >= 200 && response.status < 300) {
|
||||||
return resolve(response);
|
return resolve(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseJSON(response)
|
return parseJSON(response)
|
||||||
.then(data => {
|
.then((data) => {
|
||||||
const error = new Error(data.message || response.statusText);
|
const error = new Error(data.message || response.statusText);
|
||||||
error.data = data;
|
error.data = data;
|
||||||
error.response = response;
|
error.response = response;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
import configureStore from 'store.js';
|
import configureStore from 'store';
|
||||||
import { memoryHistory } from 'react-router';
|
import { memoryHistory } from 'react-router';
|
||||||
import { put } from 'redux-saga/effects';
|
import { put } from 'redux-saga/effects';
|
||||||
import { fromJS } from 'immutable';
|
import { fromJS } from 'immutable';
|
||||||
|
|||||||
@ -17,7 +17,7 @@ module.exports = {
|
|||||||
name: 'name',
|
name: 'name',
|
||||||
message: 'What should it be called?',
|
message: 'What should it be called?',
|
||||||
default: 'Button',
|
default: 'Button',
|
||||||
validate: value => {
|
validate: (value) => {
|
||||||
if ((/.+/).test(value)) {
|
if ((/.+/).test(value)) {
|
||||||
return componentExists(value) ? 'A component or container with this name already exists' : true;
|
return componentExists(value) ? 'A component or container with this name already exists' : true;
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ module.exports = {
|
|||||||
default: true,
|
default: true,
|
||||||
message: 'Do you want i18n messages (i.e. will this component use text)?',
|
message: 'Do you want i18n messages (i.e. will this component use text)?',
|
||||||
}],
|
}],
|
||||||
actions: data => {
|
actions: (data) => {
|
||||||
// Generate index.js and index.test.js
|
// Generate index.js and index.test.js
|
||||||
const actions = [{
|
const actions = [{
|
||||||
type: 'add',
|
type: 'add',
|
||||||
|
|||||||
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
name: 'name',
|
name: 'name',
|
||||||
message: 'What should it be called?',
|
message: 'What should it be called?',
|
||||||
default: 'Form',
|
default: 'Form',
|
||||||
validate: value => {
|
validate: (value) => {
|
||||||
if ((/.+/).test(value)) {
|
if ((/.+/).test(value)) {
|
||||||
return componentExists(value) ? 'A component or container with this name already exists' : true;
|
return componentExists(value) ? 'A component or container with this name already exists' : true;
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ module.exports = {
|
|||||||
default: true,
|
default: true,
|
||||||
message: 'Do you want i18n messages (i.e. will this component use text)?',
|
message: 'Do you want i18n messages (i.e. will this component use text)?',
|
||||||
}],
|
}],
|
||||||
actions: data => {
|
actions: (data) => {
|
||||||
// Generate index.js and index.test.js
|
// Generate index.js and index.test.js
|
||||||
const actions = [{
|
const actions = [{
|
||||||
type: 'add',
|
type: 'add',
|
||||||
|
|||||||
@ -10,7 +10,7 @@ module.exports = {
|
|||||||
name: 'language',
|
name: 'language',
|
||||||
message: 'What is the language you want to add i18n support for (e.g. "fr", "de")?',
|
message: 'What is the language you want to add i18n support for (e.g. "fr", "de")?',
|
||||||
default: 'fr',
|
default: 'fr',
|
||||||
validate: value => {
|
validate: (value) => {
|
||||||
if ((/.+/).test(value) && value.length === 2) {
|
if ((/.+/).test(value) && value.length === 2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ module.exports = {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'component',
|
name: 'component',
|
||||||
message: 'Which component should the route show?',
|
message: 'Which component should the route show?',
|
||||||
validate: value => {
|
validate: (value) => {
|
||||||
if ((/.+/).test(value)) {
|
if ((/.+/).test(value)) {
|
||||||
return componentExists(value) ? true : `"${value}" doesn't exist.`;
|
return componentExists(value) ? true : `"${value}" doesn't exist.`;
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ module.exports = {
|
|||||||
name: 'path',
|
name: 'path',
|
||||||
message: 'Enter the path of the route.',
|
message: 'Enter the path of the route.',
|
||||||
default: '/about',
|
default: '/about',
|
||||||
validate: value => {
|
validate: (value) => {
|
||||||
if ((/.+/).test(value)) {
|
if ((/.+/).test(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Add the route to the routes.js file above the error route
|
// Add the route to the routes.js file above the error route
|
||||||
// TODO smarter route adding
|
// TODO smarter route adding
|
||||||
actions: data => {
|
actions: (data) => {
|
||||||
const actions = [];
|
const actions = [];
|
||||||
if (reducerExists(data.component)) {
|
if (reducerExists(data.component)) {
|
||||||
data.useSagas = sagasExists(data.component); // eslint-disable-line no-param-reassign
|
data.useSagas = sagasExists(data.component); // eslint-disable-line no-param-reassign
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
// Important modules this config uses
|
// Important modules this config uses
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
// const OfflinePlugin = require('offline-plugin');
|
||||||
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||||
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
||||||
|
|
||||||
@ -20,8 +21,8 @@ module.exports = require('./webpack.base.babel')({
|
|||||||
output: {
|
output: {
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
chunkFilename: '[name].[chunkhash].chunk.js',
|
chunkFilename: '[name].[chunkhash].chunk.js',
|
||||||
publicPath: 'http://localhost:1337/settings-manager/',
|
// publicPath: 'http://localhost:1337/settings-manager/',
|
||||||
assetsPublicPath: '/settings-manager/',
|
publicPath: '/settings-manager/',
|
||||||
},
|
},
|
||||||
|
|
||||||
// We use ExtractTextPlugin so we get a seperate SCSS file instead
|
// We use ExtractTextPlugin so we get a seperate SCSS file instead
|
||||||
@ -46,13 +47,10 @@ module.exports = require('./webpack.base.babel')({
|
|||||||
async: true,
|
async: true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// OccurrenceOrderPlugin is needed for long-term caching to work properly.
|
|
||||||
// See http://mxs.is/googmv
|
|
||||||
new webpack.optimize.OccurrenceOrderPlugin(true),
|
|
||||||
|
|
||||||
// Merge all duplicate modules
|
// Merge all duplicate modules
|
||||||
new webpack.optimize.DedupePlugin(),
|
new webpack.optimize.DedupePlugin(),
|
||||||
|
|
||||||
|
|
||||||
// Minify and optimize the JavaScript
|
// Minify and optimize the JavaScript
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
compress: {
|
compress: {
|
||||||
@ -60,7 +58,48 @@ module.exports = require('./webpack.base.babel')({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Extract the CSS into a seperate file
|
|
||||||
new ExtractTextPlugin('[name].[contenthash].css'),
|
// Minify and optimize the index.html
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
template: 'app/index.html',
|
||||||
|
minify: {
|
||||||
|
removeComments: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
removeRedundantAttributes: true,
|
||||||
|
useShortDoctype: true,
|
||||||
|
removeEmptyAttributes: true,
|
||||||
|
removeStyleLinkTypeAttributes: true,
|
||||||
|
keepClosingSlash: true,
|
||||||
|
minifyJS: true,
|
||||||
|
minifyCSS: true,
|
||||||
|
minifyURLs: true,
|
||||||
|
},
|
||||||
|
inject: true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
// Put it in the end to capture all the HtmlWebpackPlugin's
|
||||||
|
// assets manipulations and do leak its manipulations to HtmlWebpackPlugin
|
||||||
|
// new OfflinePlugin({
|
||||||
|
// relativePaths: false,
|
||||||
|
// publicPath: '/',
|
||||||
|
//
|
||||||
|
// // No need to cache .htaccess. See http://mxs.is/googmp,
|
||||||
|
// // this is applied before any match in `caches` section
|
||||||
|
// excludes: ['.htaccess'],
|
||||||
|
//
|
||||||
|
// caches: {
|
||||||
|
// main: [':rest:'],
|
||||||
|
//
|
||||||
|
// // All chunks marked as `additional`, loaded after main section
|
||||||
|
// // and do not prevent SW to install. Change to `optional` if
|
||||||
|
// // do not want them to be preloaded at all (cached only when first loaded)
|
||||||
|
// additional: ['*.chunk.js'],
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
// // Removes warning for about `additional` section usage
|
||||||
|
// safeToUseOptionalCaches: true,
|
||||||
|
//
|
||||||
|
// AppCache: false,
|
||||||
|
// }),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -245,11 +245,13 @@
|
|||||||
"expect": "1.20.2",
|
"expect": "1.20.2",
|
||||||
"expect-jsx": "2.6.0",
|
"expect-jsx": "2.6.0",
|
||||||
"exports-loader": "0.6.3",
|
"exports-loader": "0.6.3",
|
||||||
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "0.9.0",
|
"file-loader": "0.9.0",
|
||||||
"html-loader": "0.4.4",
|
"html-loader": "0.4.4",
|
||||||
"html-webpack-plugin": "2.24.0",
|
"html-webpack-plugin": "2.24.0",
|
||||||
"image-webpack-loader": "2.0.0",
|
"image-webpack-loader": "2.0.0",
|
||||||
"imports-loader": "0.6.5",
|
"imports-loader": "0.6.5",
|
||||||
|
"isparta": "^4.0.0",
|
||||||
"json-loader": "0.5.4",
|
"json-loader": "0.5.4",
|
||||||
"karma": "1.3.0",
|
"karma": "1.3.0",
|
||||||
"karma-chrome-launcher": "2.0.0",
|
"karma-chrome-launcher": "2.0.0",
|
||||||
@ -274,6 +276,7 @@
|
|||||||
"postcss-reporter": "^2.0.0",
|
"postcss-reporter": "^2.0.0",
|
||||||
"pre-commit": "1.1.3",
|
"pre-commit": "1.1.3",
|
||||||
"psi": "2.0.4",
|
"psi": "2.0.4",
|
||||||
|
"react-addons-test-utils": "^15.4.0",
|
||||||
"rimraf": "2.5.4",
|
"rimraf": "2.5.4",
|
||||||
"sass-loader": "^4.0.2",
|
"sass-loader": "^4.0.2",
|
||||||
"shelljs": "0.7.5",
|
"shelljs": "0.7.5",
|
||||||
|
|||||||
@ -11,7 +11,7 @@ const divider = chalk.gray('\n-----------------------------------');
|
|||||||
const logger = {
|
const logger = {
|
||||||
|
|
||||||
// Called whenever there's an error on the server we want to print
|
// Called whenever there's an error on the server we want to print
|
||||||
error: err => {
|
error: (err) => {
|
||||||
console.error(chalk.red(err));
|
console.error(chalk.red(err));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user