Skip to content

Commit 5a589cb

Browse files
committed
addeds sourcemaps for debugging and Flow types
1 parent 9747fa8 commit 5a589cb

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

Brocfile.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ var jsFiles = new Funnel('src', {
2323
});
2424

2525
// transpile ES6/7 into ES5
26-
jsFiles = babelTranspiler(jsFiles, {stage: 0});
26+
jsFiles = babelTranspiler(jsFiles, {
27+
stage: 0,
28+
sourceMaps: 'inline', // add sourcemaps for ES6 debugging
29+
plugins: ['typecheck'] // add Flow types checking!
30+
});
2731

2832
// transpile for the browser
2933
jsFiles = fastBrowserify(jsFiles, {
34+
debug: env !== 'production', // add sourcemaps if not for production
3035
bundles: {
3136
'index.js': {
3237
entryPoints: ['index.js']
@@ -38,7 +43,7 @@ if (env === 'production') {
3843
jsFiles = uglifyJavaScript(jsFiles);
3944
jsFiles = gzipFiles(jsFiles, {
4045
extensions: ['js', 'css'],
41-
keepUncompressed: true
46+
keepUncompressed: false
4247
});
4348
}
4449

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "react-es7",
3-
"version": "0.0.20",
3+
"version": "0.1.0",
44
"description": "Example of using React + Reflux + router + ES6 with experimental ES7 syntax + Jest + Semantic-UI",
55
"main": "src/index.js",
66
"scripts": {
7-
"test": "BABEL_JEST_STAGE=1 jest",
7+
"test": "BABEL_JEST_STAGE=0 jest",
88
"bundle": "broccoli build dist",
99
"serve": "broccoli serve"
1010
},
@@ -23,8 +23,9 @@
2323
"author": "Jaroslaw Zabiello <[email protected]>",
2424
"license": "MIT",
2525
"devDependencies": {
26-
"jest-cli": "^0.4.2",
26+
"babel": "^5.5.6",
2727
"babel-jest": "^5.2.0",
28+
"babel-plugin-typecheck": "0.0.3",
2829
"broccoli": "^0.16.2",
2930
"broccoli-babel-transpiler": "^5.0.0",
3031
"broccoli-env": "0.0.1",
@@ -33,8 +34,10 @@
3334
"broccoli-gzip": "^0.2.1",
3435
"broccoli-merge-trees": "^0.2.1",
3536
"broccoli-sass": "^0.6.6",
37+
"broccoli-source-map": "^0.2.0",
3638
"broccoli-timepiece": "^0.3.0",
3739
"broccoli-uglify-js": "^0.1.3",
40+
"jest-cli": "^0.4.12",
3841
"rimraf": "^2.3.3"
3942
},
4043
"dependencies": {

src/sum.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// ES6 code
2-
var sum = (a, b) => a + b;
1+
// ES6 code with Flow types
2+
3+
const sum = (a:number, b:number) => a + b;
34

45
export default sum
56

0 commit comments

Comments
 (0)