Skip to content

Commit c9ecc63

Browse files
committed
first commit
0 parents  commit c9ecc63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+26475
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea/
2+
.vscode/
3+
node_modules/
4+
build
5+
.DS_Store
6+
*.tgz
7+
lerna-debug.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
/.changelog

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Sze Ka Wai Raymond
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 398 additions & 0 deletions
Large diffs are not rendered by default.

lerna.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"lerna": "2.0.0-rc.5",
3+
"version": "independent",
4+
"packages": [
5+
"packages/*"
6+
]
7+
}

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "create-react-scripts",
3+
"version": "0.0.1",
4+
"private": true,
5+
"description": "Easily extend the react-scripts to your own version of react-scripts",
6+
"author": "Sze Ka Wai Raymond",
7+
"license": "MIT",
8+
"devDependencies": {
9+
"lerna": "^2.0.0-rc.5"
10+
}
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# create-react-scripts-babelrc
2+
-----------------
3+
Mark **babelrc** option to true in [babel-loader](https://github.com/babel/babel-loader).
4+
This is very useful if you want to add some external babel feature into webpack build.
5+
6+
Example Usage:
7+
##### Modify crs.config
8+
Modify `crs.config` as below.
9+
```js
10+
const { compose } = require('create-react-scripts');
11+
module.exports = compose(
12+
...
13+
require('create-react-scripts-babelrc')(),
14+
);
15+
```
16+
17+
##### Create .babelrc
18+
Create `.babelrc` under your application folder
19+
For example, I want to enable `stage-0` and `decorator` supports.
20+
```
21+
{
22+
"presets": ["react-app", "stage-0"],
23+
"plugins": ["transform-decorators-legacy"]
24+
}
25+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
const { getBabelLoader } = require('create-react-scripts-utils');
4+
5+
module.exports = options => ({
6+
webpack(config, env) {
7+
// get the babel loader
8+
const loader = getBabelLoader(config);
9+
// obtain the options
10+
const options = loader.options || loader.query;
11+
// set the babelrc to true
12+
options.babelrc = true;
13+
return config;
14+
},
15+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "create-react-scripts-babelrc",
3+
"version": "0.0.1",
4+
"author": "Sze Ka Wai Raymond",
5+
"description": "Mark babelrc option to true to create-react-scripts",
6+
"license": "MIT",
7+
"bugs": {
8+
"url": "https://github.com/raymondsze/create-react-scripts/issues"
9+
},
10+
"main": "index.js",
11+
"dependencies": {
12+
"create-react-scripts-utils": "^0.0.1"
13+
}
14+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# create-react-scripts-dll
2+
-----------------
3+
Add [autodll-webpack-plugin](https://github.com/asfktz/autodll-webpack-plugin) support.
4+
This is useful to faster the webpack bundling time.
5+
Also, it make the code structing cleaner by separating the vendor related codes from your source codes.
6+
The pacakge specified in `vendor` section of `pacakge.json` would be bundled into `static/js/vendor:[hash:8].js`.
7+
8+
##### Modify crs.config
9+
Modify `crs.config` as below.
10+
```js
11+
const { compose } = require('create-react-scripts')
12+
13+
module.exports = compose(
14+
...
15+
require('create-react-scripts-dll')(/* options passed to autodll-webpack-plugin */),
16+
);
17+
```
18+
19+
##### Add vendor section to package.json
20+
Modify `package.json` under your application folder
21+
```js
22+
{
23+
...
24+
"vendor" [
25+
"react",
26+
"react-dom"
27+
]
28+
}
29+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const path = require('path');
2+
const AutoDllPlugin = require('autodll-webpack-plugin');
3+
4+
module.exports = options => ({
5+
webpack(config) {
6+
const appPackageJson = path.join(process.cwd(), 'package.json');
7+
const vendor = require(appPackageJson).vendor || [];
8+
config.plugins.push(
9+
new AutoDllPlugin(Object.assign({
10+
inject: true,
11+
filename: '[name].[hash:8].js',
12+
path: './static/js',
13+
entry: { vendor },
14+
}, options))
15+
);
16+
return config;
17+
},
18+
});

0 commit comments

Comments
 (0)