@@ -31,6 +31,7 @@ pub struct Build {
31
31
pub weak_refs : bool ,
32
32
pub reference_types : bool ,
33
33
pub target : Target ,
34
+ pub no_pack : bool ,
34
35
pub profile : BuildProfile ,
35
36
pub mode : InstallMode ,
36
37
pub out_dir : PathBuf ,
@@ -171,6 +172,10 @@ pub struct BuildOptions {
171
172
/// Sets the output file names. Defaults to package name.
172
173
pub out_name : Option < String > ,
173
174
175
+ #[ structopt( long = "no-pack" , alias = "no-package" ) ]
176
+ /// Option to not generate a package.json
177
+ pub no_pack : bool ,
178
+
174
179
#[ structopt( allow_hyphen_values = true ) ]
175
180
/// List of extra options to pass to `cargo build`
176
181
pub extra_options : Vec < String > ,
@@ -188,6 +193,7 @@ impl Default for BuildOptions {
188
193
target : Target :: default ( ) ,
189
194
debug : false ,
190
195
dev : false ,
196
+ no_pack : false ,
191
197
release : false ,
192
198
profiling : false ,
193
199
out_dir : String :: new ( ) ,
@@ -232,6 +238,7 @@ impl Build {
232
238
weak_refs : build_opts. weak_refs ,
233
239
reference_types : build_opts. reference_types ,
234
240
target : build_opts. target ,
241
+ no_pack : build_opts. no_pack ,
235
242
profile,
236
243
mode : build_opts. mode ,
237
244
out_dir,
@@ -249,7 +256,7 @@ impl Build {
249
256
250
257
/// Execute this `Build` command.
251
258
pub fn run ( & mut self ) -> Result < ( ) > {
252
- let process_steps = Build :: get_process_steps ( self . mode ) ;
259
+ let process_steps = Build :: get_process_steps ( self . mode , self . no_pack ) ;
253
260
254
261
let started = Instant :: now ( ) ;
255
262
@@ -274,7 +281,7 @@ impl Build {
274
281
Ok ( ( ) )
275
282
}
276
283
277
- fn get_process_steps ( mode : InstallMode ) -> Vec < ( & ' static str , BuildStep ) > {
284
+ fn get_process_steps ( mode : InstallMode , no_pack : bool ) -> Vec < ( & ' static str , BuildStep ) > {
278
285
macro_rules! steps {
279
286
( $( $name: ident) ,+) => {
280
287
{
@@ -296,16 +303,23 @@ impl Build {
296
303
] ) ;
297
304
}
298
305
}
306
+
299
307
steps. extend ( steps ! [
300
308
step_build_wasm,
301
309
step_create_dir,
302
- step_copy_readme,
303
- step_copy_license,
304
310
step_install_wasm_bindgen,
305
311
step_run_wasm_bindgen,
306
312
step_run_wasm_opt,
307
- step_create_json,
308
313
] ) ;
314
+
315
+ if !no_pack {
316
+ steps. extend ( steps ! [
317
+ step_create_json,
318
+ step_copy_readme,
319
+ step_copy_license,
320
+ ] ) ;
321
+ }
322
+
309
323
steps
310
324
}
311
325
0 commit comments