Skip to content

Commit c55e697

Browse files
committed
Merged branch develop into master
2 parents 2a09af9 + 56bdf15 commit c55e697

19 files changed

+484
-160
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"presets":["es2015", "stage-0", "react"]
2+
"presets":["es2015", "stage-0", "react"],
3+
"plugins": ["transform-runtime"]
34
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ before_script:
1010
- npm install -g gulp
1111

1212
script:
13-
- gulp web:build:dev
13+
- gulp build:dev
1414
- gulp release
1515

README.md

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,53 @@ The library will add a `onClick`, `className` and `style` props on element.
212212
The library will add a `onClick`, `className` and `style` props on element.
213213

214214
### beforeRemoveAction
215-
| Key | Description | Type | Required | Default |
216-
|:------------------:|:------------------------------------------------------------:|:--------:|:---------:|:-----------------------------------------------------------:|
217-
| beforeRemoveAction | Function called before each remove action (with minus menu) | Function | False | `(key, keyPath, deep) => new Promise(resolve => resolve())` |
215+
| Key | Description | Type | Required | Default |
216+
|:------------------:|:------------------------------------------------------------:|:--------:|:---------:|:---------------------------------------------------------------------:|
217+
| beforeRemoveAction | Function called before each remove action (with minus menu) | Function | False | `(key, keyPath, deep, oldValue) => new Promise(resolve => resolve())` |
218218

219219
This function must return a `Promise`. In case of resolve of this one, the remove will be done. Otherwise, in reject, nothing will be done.
220220

221221
Function parameters :
222222

223-
| Key | Description | Type | Example |
224-
|:-----------:|:-------------------------------:|:-------:|:---------------------------------------------------------------:|
225-
| key | Key of current node/value | String | 'object' for data: { object: { string: 'test' } } |
226-
| keyPath | key path | Array | ['object'] for data: { object: { string: 'test' } } |
227-
| deep | Deep of current node | Number | 1 for data: { object: { string: 'test' } } on 'object' node |
223+
| Key | Description | Type | Example |
224+
|:-----------:|:-------------------------------:|:-------:|:----------------------------------------------------------------------------:|
225+
| key | Key of current node/value | String | 'object' for data: { object: { string: 'test' } } |
226+
| keyPath | key path | Array | [] for data: { object: { string: 'test' } } |
227+
| deep | Deep of current node | Number | 1 for data: { object: { string: 'test' } } on 'object' node |
228+
| oldValue | Old value of the key | Any | { string: 'test' } for data: { object: { string: 'test' } } on 'object' node |
229+
230+
### beforeAddAction
231+
| Key | Description | Type | Required | Default |
232+
|:---------------:|:--------------------------------------------------------:|:--------:|:---------:|:---------------------------------------------------------------------:|
233+
| beforeAddAction | Function called before each add action (with plus menu) | Function | False | `(key, keyPath, deep, newValue) => new Promise(resolve => resolve())` |
234+
235+
This function must return a `Promise`. In case of resolve of this one, the remove will be done. Otherwise, in reject, nothing will be done.
236+
237+
Function parameters :
238+
239+
| Key | Description | Type | Example |
240+
|:-----------:|:-------------------------------:|:-------:|:----------------------------------------------------------------------------:|
241+
| key | Key of current node/value | String | 'string' for data: { object: { string: 'test' } } |
242+
| keyPath | key path | Array | ['object'] for data: { object: { string: 'test' } } |
243+
| deep | Deep of current node | Number | 1 for data: { object: { string: 'test' } } on 'object' node |
244+
| newValue | New value of the key | Any | 'test' for data: { object: { string: 'test' } } on 'string' node |
245+
246+
### beforeUpdateAction
247+
| Key | Description | Type | Required | Default |
248+
|:------------------:|:-----------------------------------------:|:--------:|:---------:|:-------------------------------------------------------------------------------:|
249+
| beforeUpdateAction | Function called before each update action | Function | False | `(key, keyPath, deep, oldValue, newValue) => new Promise(resolve => resolve())` |
250+
251+
This function must return a `Promise`. In case of resolve of this one, the remove will be done. Otherwise, in reject, nothing will be done.
252+
253+
Function parameters :
254+
255+
| Key | Description | Type | Example |
256+
|:-----------:|:-------------------------------:|:-------:|:----------------------------------------------------------------------------:|
257+
| key | Key of current node/value | String | 'string' for data: { object: { string: 'test' } } |
258+
| keyPath | key path | Array | ['object'] for data: { object: { string: 'test' } } |
259+
| deep | Deep of current node | Number | 1 for data: { object: { string: 'test' } } on 'object' node |
260+
| oldValue | Old value of the key | Any | 'test' for data: { object: { string: 'test' } } on 'string' node |
261+
| newValue | New value of the key | Any | 'update' for data: { object: { string: 'update' } } on 'string' node |
228262

229263
## Design
230264
The library provide CSS class on elements. All are prefixed by "rejt" to avoid conflict.

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ machine:
55

66
test:
77
override:
8+
- gulp build:dev
89
- gulp release
910

gulp/build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ const runSequence = require('run-sequence');
1919
/* ******** PUBLIC FUNCTIONS ******** */
2020
/* ************************************* */
2121

22-
gulp.task('build:dev', done => runSequence('env:dev', 'web:build:dev', done));
22+
gulp.task('build:prod', done => runSequence('env:prod', 'clean:release:docs', 'web:build:prod', done));
23+
24+
gulp.task('build:dev', done => runSequence('env:dev', 'clean:web:dev', 'web:build:dev', done));
2325

gulp/clean.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const del = require('del');
1919
/* ******** PUBLIC FUNCTIONS ******** */
2020
/* ************************************* */
2121

22+
gulp.task('clean:web:dev', () => del('dev_build'));
23+
2224
gulp.task('clean:release:dist', () => del('dist'));
2325

2426
gulp.task('clean:release:docs', () => del('docs'));

gulp/config/webpack-dev.config.js

Lines changed: 88 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,121 @@
99
/* ************************************* */
1010
const path = require('path');
1111
const webpack = require('webpack');
12-
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
1312
const HtmlWebpackPlugin = require('html-webpack-plugin');
13+
const webpackCombineLoaders = require('webpack-combine-loaders');
14+
const autoprefixer = require('autoprefixer');
1415

1516
// Constants
1617
const BUILD_DIR = path.resolve(__dirname, '../../dev_build/');
1718
const APP_DIR = path.resolve(__dirname, '../../dev/');
19+
const SRC_DIR = path.resolve(__dirname, '../../src');
20+
const ROOT_DIR = path.resolve(__dirname, '../..');
1821

1922
/* ************************************* */
2023
/* ******** EXPORTS ******** */
2124
/* ************************************* */
2225

2326
module.exports = {
27+
bail: true,
28+
devtool: 'source-map',
2429
entry: {
2530
app: [
26-
`${APP_DIR}/index.jsx`,
31+
path.join(APP_DIR, 'index.jsx'),
32+
path.join(APP_DIR, 'index.html'),
2733
],
34+
vendor: ['react', 'react-hotkeys', 'react-dom', 'lodash'],
35+
},
36+
resolve: {
37+
extensions: ['', '.scss', '.sass', '.css', '.js', '.jsx', '.json'],
2838
},
2939
output: {
3040
path: BUILD_DIR,
31-
filename: 'bundle.js',
41+
filename: '[name]-[hash:5].js',
3242
publicPath: '/',
3343
},
3444
module: {
45+
preLoaders: [
46+
{
47+
test: /\.js(x|)$/,
48+
loader: 'eslint',
49+
include: [
50+
SRC_DIR,
51+
],
52+
},
53+
],
3554
loaders: [
3655
{
37-
test: /\.js?/,
56+
test: /\.js(x|)?/,
3857
exclude: /node_modules/,
3958
loader: 'babel',
4059
},
60+
{
61+
test: /\.html$/,
62+
loader: 'html',
63+
},
64+
{
65+
test: /\.css$/,
66+
loader: webpackCombineLoaders([
67+
{
68+
loader: 'css',
69+
query: {
70+
modules: true,
71+
camelCase: true,
72+
localIdentName: '[path][name]---[local]---[hash:base64:5]',
73+
},
74+
},
75+
{
76+
loader: 'postcss',
77+
},
78+
]),
79+
},
80+
{
81+
test: /\.s[ac]ss$/,
82+
loader: webpackCombineLoaders([
83+
{
84+
loader: 'style',
85+
},
86+
{
87+
loader: 'css',
88+
query: {
89+
modules: true,
90+
camelCase: true,
91+
localIdentName: '[path][name]---[local]---[hash:base64:5]',
92+
},
93+
},
94+
{
95+
loader: 'postcss',
96+
},
97+
{
98+
loader: 'sass',
99+
query: {
100+
sourceMaps: 'true',
101+
},
102+
},
103+
]),
104+
},
105+
{
106+
test: /\.(png|jpe?g|gif|svg|woff2?|eot|ttf|otf|wav)(\?.*)?$/,
107+
loader: 'url',
108+
query: {
109+
limit: 10,
110+
name: '[name].[hash:7].[ext]',
111+
},
112+
},
41113
],
42114
},
115+
eslint: {
116+
configFile: path.join(ROOT_DIR, '.eslintrc.json'),
117+
failOnWarning: true,
118+
failOnError: true,
119+
},
120+
postcss: [
121+
autoprefixer({
122+
browsers: ['last 3 versions', 'ie > 8'],
123+
}),
124+
],
43125
plugins: [
126+
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
44127
new webpack.DefinePlugin({
45128
'process.env': {
46129
NODE_ENV: process.env.NODE_ENV,
@@ -49,11 +132,7 @@ module.exports = {
49132
new HtmlWebpackPlugin({
50133
inject: true,
51134
filename: 'index.html',
52-
template: `${APP_DIR}/index.html`,
135+
template: path.join(APP_DIR, 'index.html'),
53136
}),
54-
new ProgressBarPlugin(),
55-
new webpack.optimize.DedupePlugin(),
56-
new webpack.HotModuleReplacementPlugin(),
57-
new webpack.NoErrorsPlugin(),
58137
],
59138
};

gulp/config/webpack-prod.config.js

Lines changed: 96 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,117 @@
1010
const path = require('path');
1111
const webpack = require('webpack');
1212
const HtmlWebpackPlugin = require('html-webpack-plugin');
13+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
14+
const webpackCombineLoaders = require('webpack-combine-loaders');
15+
const autoprefixer = require('autoprefixer');
1316

1417
// Constants
1518
const BUILD_DIR = path.resolve(__dirname, '../../docs/');
1619
const APP_DIR = path.resolve(__dirname, '../../dev/');
20+
const SRC_DIR = path.resolve(__dirname, '../../src');
21+
const ROOT_DIR = path.resolve(__dirname, '../..');
1722

1823
/* ************************************* */
1924
/* ******** EXPORTS ******** */
2025
/* ************************************* */
2126

2227
module.exports = {
28+
bail: true,
29+
devtool: 'cheap-module-source-map',
2330
entry: {
2431
app: [
25-
`${APP_DIR}/index.jsx`,
32+
path.join(APP_DIR, 'index.jsx'),
33+
path.join(APP_DIR, 'index.html'),
2634
],
35+
vendor: ['react', 'react-hotkeys', 'react-dom', 'lodash'],
36+
},
37+
resolve: {
38+
extensions: ['', '.scss', '.sass', '.css', '.js', '.jsx', '.json'],
2739
},
2840
output: {
2941
path: BUILD_DIR,
30-
filename: 'bundle.js',
42+
filename: '[name]-[hash:5].js',
3143
},
3244
module: {
45+
preLoaders: [
46+
{
47+
test: /\.js(x|)$/,
48+
loader: 'eslint',
49+
include: [
50+
SRC_DIR,
51+
],
52+
},
53+
],
3354
loaders: [
3455
{
35-
test: /\.js?/,
56+
test: /\.js(x|)$/,
3657
exclude: /node_modules/,
3758
loader: 'babel',
3859
},
60+
{
61+
test: /\.html$/,
62+
loader: 'html',
63+
},
64+
{
65+
test: /\.css$/,
66+
loader: ExtractTextPlugin.extract(webpackCombineLoaders([
67+
{
68+
loader: 'css',
69+
query: {
70+
modules: true,
71+
camelCase: true,
72+
localIdentName: '[local]',
73+
},
74+
},
75+
{
76+
loader: 'postcss',
77+
},
78+
])),
79+
},
80+
{
81+
test: /\.s[ac]ss$/,
82+
loader: ExtractTextPlugin.extract(webpackCombineLoaders([
83+
{
84+
loader: 'css',
85+
query: {
86+
modules: true,
87+
camelCase: true,
88+
localIdentName: '[local]',
89+
},
90+
},
91+
{
92+
loader: 'postcss',
93+
},
94+
{
95+
loader: 'sass',
96+
query: {
97+
sourceMaps: 'true',
98+
},
99+
},
100+
])),
101+
},
102+
{
103+
test: /\.(png|jpe?g|gif|svg|woff2?|eot|ttf|otf|wav)(\?.*)?$/,
104+
loader: 'url',
105+
query: {
106+
limit: 10,
107+
name: '[name].[hash:7].[ext]',
108+
},
109+
},
39110
],
40111
},
112+
eslint: {
113+
configFile: path.join(ROOT_DIR, '.eslintrc.json'),
114+
failOnWarning: true,
115+
failOnError: true,
116+
},
117+
postcss: [
118+
autoprefixer({
119+
browsers: ['last 3 versions', 'ie > 8'],
120+
}),
121+
],
41122
plugins: [
123+
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
42124
new webpack.DefinePlugin({
43125
'process.env': {
44126
NODE_ENV: process.env.NODE_ENV,
@@ -47,10 +129,18 @@ module.exports = {
47129
new HtmlWebpackPlugin({
48130
inject: true,
49131
filename: 'index.html',
50-
template: `${APP_DIR}/index.html`,
132+
template: path.join(APP_DIR, 'index.html'),
51133
}),
134+
new ExtractTextPlugin('[name]-[hash:5].css'),
52135
new webpack.optimize.DedupePlugin(),
53136
new webpack.optimize.OccurrenceOrderPlugin(),
54-
new webpack.optimize.UglifyJsPlugin({}),
137+
new webpack.optimize.UglifyJsPlugin({
138+
compressor: {
139+
warnings: false,
140+
dead_code: true,
141+
unused: true,
142+
},
143+
minimize: true,
144+
}),
55145
],
56-
};
146+
};

0 commit comments

Comments
 (0)