@@ -33,12 +33,8 @@ const del = require('del');
33
33
const fs = require ( 'fs' ) ;
34
34
const gulp = require ( 'gulp' ) ;
35
35
const babel = require ( 'gulp-babel' ) ;
36
- const header = require ( 'gulp-header' ) ;
37
36
const rename = require ( 'gulp-rename' ) ;
38
- const gulpUtil = require ( 'gulp-util' ) ;
39
37
const path = require ( 'path' ) ;
40
- const webpack = require ( 'webpack' ) ;
41
- const webpackStream = require ( 'webpack-stream' ) ;
42
38
43
39
const RELEASE_COMMIT_SHA = process . env . RELEASE_COMMIT_SHA ;
44
40
if ( RELEASE_COMMIT_SHA && RELEASE_COMMIT_SHA . length !== 40 ) {
@@ -52,10 +48,6 @@ const VERSION = RELEASE_COMMIT_SHA
52
48
? `0.0.0-main-${ RELEASE_COMMIT_SHA . substr ( 0 , 8 ) } `
53
49
: process . env . npm_package_version ;
54
50
55
- const DEVELOPMENT_HEADER = `/**
56
- * Relay v${ VERSION }
57
- */
58
- ` ;
59
51
const PRODUCTION_HEADER = `/**
60
52
* Relay v${ VERSION }
61
53
*
@@ -66,39 +58,6 @@ const PRODUCTION_HEADER = `/**
66
58
*/
67
59
` ;
68
60
69
- const buildDist = function ( filename , opts , isProduction ) {
70
- const webpackOpts = {
71
- externals : [ / ^ [ - / a - z A - Z 0 - 9 ] + $ / , / ^ @ b a b e l \/ .+ $ / ] ,
72
- target : opts . target ,
73
- output : {
74
- filename : filename ,
75
- libraryTarget : opts . libraryTarget ,
76
- library : opts . libraryName ,
77
- } ,
78
- plugins : [
79
- new webpack . DefinePlugin ( {
80
- 'process.env.NODE_ENV' : JSON . stringify (
81
- isProduction ? 'production' : 'development' ,
82
- ) ,
83
- } ) ,
84
- ] ,
85
- } ;
86
- if ( isProduction && ! opts . noMinify ) {
87
- // See more chunks configuration here: https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693
88
- webpackOpts . optimization = {
89
- minimize : true ,
90
- } ;
91
- }
92
- return webpackStream ( webpackOpts , webpack , function ( err , stats ) {
93
- if ( err ) {
94
- throw new gulpUtil . PluginError ( 'webpack' , err ) ;
95
- }
96
- if ( stats . compilation . errors . length ) {
97
- throw new gulpUtil . PluginError ( 'webpack' , stats . toString ( ) ) ;
98
- }
99
- } ) ;
100
- } ;
101
-
102
61
// Paths from package-root
103
62
const PACKAGES = 'packages' ;
104
63
const DIST = 'dist' ;
@@ -119,15 +78,6 @@ const builds = [
119
78
index : 'BabelPluginRelay.js' ,
120
79
macro : 'BabelPluginRelay.macro.js' ,
121
80
} ,
122
- bundles : [
123
- {
124
- entry : 'BabelPluginRelay.js' ,
125
- output : 'babel-plugin-relay' ,
126
- libraryName : 'BabelPluginRelay' ,
127
- libraryTarget : 'commonjs2' ,
128
- target : 'node' ,
129
- } ,
130
- ] ,
131
81
} ,
132
82
{
133
83
package : 'react-relay' ,
@@ -137,79 +87,25 @@ const builds = [
137
87
legacy : 'legacy.js' ,
138
88
ReactRelayContext : 'ReactRelayContext.js' ,
139
89
} ,
140
- bundles : [
141
- {
142
- entry : 'index.js' ,
143
- output : 'react-relay' ,
144
- libraryName : 'ReactRelay' ,
145
- libraryTarget : 'umd' ,
146
- } ,
147
- {
148
- entry : 'hooks.js' ,
149
- output : 'react-relay-hooks' ,
150
- libraryName : 'ReactRelayHooks' ,
151
- libraryTarget : 'umd' ,
152
- } ,
153
- {
154
- entry : 'legacy.js' ,
155
- output : 'react-relay-legacy' ,
156
- libraryName : 'ReactRelayLegacy' ,
157
- libraryTarget : 'umd' ,
158
- } ,
159
- ] ,
160
90
} ,
161
91
{
162
92
package : 'relay-runtime' ,
163
93
exports : {
164
94
index : 'index.js' ,
165
95
experimental : 'experimental.js' ,
166
96
} ,
167
- bundles : [
168
- {
169
- entry : 'index.js' ,
170
- output : 'relay-runtime' ,
171
- libraryName : 'RelayRuntime' ,
172
- libraryTarget : 'umd' ,
173
- } ,
174
- {
175
- entry : 'experimental.js' ,
176
- output : 'relay-runtime-experimental' ,
177
- libraryName : 'ReactRelayExperimental' ,
178
- libraryTarget : 'umd' ,
179
- } ,
180
- ] ,
181
97
} ,
182
98
{
183
99
package : 'relay-test-utils' ,
184
100
exports : {
185
101
index : 'index.js' ,
186
102
} ,
187
- bundles : [
188
- {
189
- entry : 'index.js' ,
190
- output : 'relay-test-utils' ,
191
- libraryName : 'RelayTestUtils' ,
192
- libraryTarget : 'commonjs2' ,
193
- target : 'node' ,
194
- noMinify : true , // Note: uglify can't yet handle modern JS
195
- } ,
196
- ] ,
197
103
} ,
198
104
{
199
105
package : 'relay-test-utils-internal' ,
200
106
exports : {
201
107
index : 'index.js' ,
202
108
} ,
203
- bundles : [
204
- {
205
- entry : 'index.js' ,
206
- output : 'relay-test-utils-internal' ,
207
- libraryName : 'RelayTestUtilsInternal' ,
208
- libraryTarget : 'commonjs2' ,
209
- target : 'node' ,
210
- noMinify : true , // Note: uglify can't yet handle modern JS
211
- } ,
212
- ] ,
213
109
} ,
214
110
] ;
215
111
@@ -295,40 +191,8 @@ const exportsFiles = gulp.series(
295
191
) ,
296
192
) ;
297
193
298
- const bundlesTasks = [ ] ;
299
- builds . forEach ( build => {
300
- build . bundles . forEach ( bundle => {
301
- bundlesTasks . push ( function bundleTask ( ) {
302
- return gulp
303
- . src ( path . join ( DIST , build . package , 'lib' , bundle . entry ) )
304
- . pipe (
305
- buildDist ( bundle . output + '.js' , bundle , /* isProduction */ false ) ,
306
- )
307
- . pipe ( header ( DEVELOPMENT_HEADER ) )
308
- . pipe ( gulp . dest ( path . join ( DIST , build . package ) ) ) ;
309
- } ) ;
310
- } ) ;
311
- } ) ;
312
- const bundles = gulp . series ( bundlesTasks ) ;
313
-
314
- const bundlesMinTasks = [ ] ;
315
- builds . forEach ( build => {
316
- build . bundles . forEach ( bundle => {
317
- bundlesMinTasks . push ( function bundlesMinTask ( ) {
318
- return gulp
319
- . src ( path . join ( DIST , build . package , 'lib' , bundle . entry ) )
320
- . pipe (
321
- buildDist ( bundle . output + '.min.js' , bundle , /* isProduction */ true ) ,
322
- )
323
- . pipe ( header ( PRODUCTION_HEADER ) )
324
- . pipe ( gulp . dest ( path . join ( DIST , build . package ) ) ) ;
325
- } ) ;
326
- } ) ;
327
- } ) ;
328
- const bundlesMin = gulp . series ( bundlesMinTasks ) ;
329
-
330
194
const clean = ( ) => del ( DIST ) ;
331
- const dist = gulp . series ( exportsFiles , bundles , bundlesMin ) ;
195
+ const dist = gulp . series ( exportsFiles ) ;
332
196
const watch = gulp . series ( dist , ( ) =>
333
197
gulp . watch ( INCLUDE_GLOBS , { cwd : PACKAGES } , dist ) ,
334
198
) ;
0 commit comments