File tree Expand file tree Collapse file tree 6 files changed +93
-0
lines changed Expand file tree Collapse file tree 6 files changed +93
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "presets" : [
3
+ " es2015-loose" ,
4
+ " stage-1" ,
5
+ " react"
6
+ ],
7
+ "plugins" : [
8
+ " babel-plugin-dev-expression"
9
+ ]
10
+ }
Original file line number Diff line number Diff line change
1
+ umd
Original file line number Diff line number Diff line change
1
+ .babelrc
2
+ .gitignore
3
+ .npmignore
4
+ modules
5
+ node_modules
6
+ scripts
7
+ webpack.config.js
Original file line number Diff line number Diff line change 4
4
"author" : " Michael Jackson" ,
5
5
"license" : " MIT" ,
6
6
"main" : " index.js" ,
7
+ "scripts" : {
8
+ "build" : " node ./scripts/build.js" ,
9
+ "build-cjs" : " babel ./modules -d . --ignore '__tests__'" ,
10
+ "build-umd" : " webpack modules/index.js umd/react-broadcast.js" ,
11
+ "build-min" : " webpack -p modules/index.js umd/react-broadcast.min.js" ,
12
+ "prepublish" : " node ./scripts/build.js"
13
+ },
7
14
"dependencies" : {
8
15
"invariant" : " ^2.2.1"
9
16
},
10
17
"peerDependencies" : {
11
18
"react" : " 15.x"
19
+ },
20
+ "devDependencies" : {
21
+ "babel-cli" : " ^6.16.0" ,
22
+ "babel-core" : " ^6.16.0" ,
23
+ "babel-loader" : " ^6.2.5" ,
24
+ "babel-plugin-dev-expression" : " ^0.2.1" ,
25
+ "babel-preset-es2015" : " ^6.16.0" ,
26
+ "babel-preset-es2015-loose" : " ^8.0.0" ,
27
+ "babel-preset-react" : " ^6.16.0" ,
28
+ "babel-preset-stage-1" : " ^6.16.0" ,
29
+ "gzip-size" : " ^3.0.0" ,
30
+ "in-publish" : " ^2.0.0" ,
31
+ "pretty-bytes" : " ^4.0.2" ,
32
+ "webpack" : " ^1.13.2"
12
33
}
13
34
}
Original file line number Diff line number Diff line change
1
+ const readFileSync = require ( 'fs' ) . readFileSync
2
+ const execSync = require ( 'child_process' ) . execSync
3
+ const inInstall = require ( 'in-publish' ) . inInstall
4
+ const prettyBytes = require ( 'pretty-bytes' )
5
+ const gzipSize = require ( 'gzip-size' )
6
+
7
+ if ( inInstall ( ) )
8
+ process . exit ( 0 )
9
+
10
+ const exec = ( command , env ) =>
11
+ execSync ( command , { stdio : 'inherit' , env } )
12
+
13
+ const webpackEnv = Object . assign ( { } , process . env , {
14
+ NODE_ENV : 'production'
15
+ } )
16
+
17
+ exec ( 'npm run build-cjs' )
18
+ exec ( 'npm run build-umd' , webpackEnv )
19
+ exec ( 'npm run build-min' , webpackEnv )
20
+
21
+ console . log (
22
+ '\ngzipped, the UMD build is ' + prettyBytes (
23
+ gzipSize . sync ( readFileSync ( 'umd/react-broadcast.min.js' ) )
24
+ )
25
+ )
Original file line number Diff line number Diff line change
1
+ const webpack = require ( 'webpack' )
2
+
3
+ module . exports = {
4
+ output : {
5
+ library : 'ReactBroadcast' ,
6
+ libraryTarget : 'umd'
7
+ } ,
8
+
9
+ externals : {
10
+ react : {
11
+ root : 'React' ,
12
+ commonjs2 : 'react' ,
13
+ commonjs : 'react' ,
14
+ amd : 'react'
15
+ }
16
+ } ,
17
+
18
+ module : {
19
+ loaders : [
20
+ { test : / \. j s $ / , exclude : / n o d e _ m o d u l e s / , loader : 'babel' }
21
+ ]
22
+ } ,
23
+
24
+ plugins : [
25
+ new webpack . DefinePlugin ( {
26
+ 'process.env.NODE_ENV' : JSON . stringify ( process . env . NODE_ENV || 'development' )
27
+ } )
28
+ ]
29
+ }
You can’t perform that action at this time.
0 commit comments