@wordpress/env 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli.js CHANGED
@@ -22,57 +22,61 @@ const wpRed = boldWhite.bgHex( '#d94f4f' );
22
22
  const wpYellow = boldWhite.bgHex( '#f0b849' );
23
23
 
24
24
  // Spinner.
25
- const withSpinner = ( command ) => ( ...args ) => {
26
- const spinner = ora().start();
27
- args[ 0 ].spinner = spinner;
28
- let time = process.hrtime();
29
- return command( ...args ).then(
30
- ( message ) => {
31
- time = process.hrtime( time );
32
- spinner.succeed(
33
- `${ message || spinner.text } (in ${ time[ 0 ] }s ${ (
34
- time[ 1 ] / 1e6
35
- ).toFixed( 0 ) }ms)`
36
- );
37
- process.exit( 0 );
38
- },
39
- ( error ) => {
40
- if ( error instanceof env.ValidationError ) {
41
- // Error is a validation error. That means the user did something wrong.
42
- spinner.fail( error.message );
43
- process.exit( 1 );
44
- } else if (
45
- error &&
46
- typeof error === 'object' &&
47
- 'exitCode' in error &&
48
- 'err' in error &&
49
- 'out' in error
50
- ) {
51
- // Error is a docker-compose error. That means something docker-related failed.
52
- // https://github.com/PDMLab/docker-compose/blob/HEAD/src/index.ts
53
- spinner.fail( 'Error while running docker-compose command.' );
54
- if ( error.out ) {
55
- process.stdout.write( error.out );
56
- }
57
- if ( error.err ) {
58
- process.stderr.write( error.err );
59
- }
60
- process.exit( error.exitCode );
61
- } else if ( error ) {
62
- // Error is an unknown error. That means there was a bug in our code.
63
- spinner.fail(
64
- typeof error === 'string' ? error : error.message
25
+ const withSpinner =
26
+ ( command ) =>
27
+ ( ...args ) => {
28
+ const spinner = ora().start();
29
+ args[ 0 ].spinner = spinner;
30
+ let time = process.hrtime();
31
+ return command( ...args ).then(
32
+ ( message ) => {
33
+ time = process.hrtime( time );
34
+ spinner.succeed(
35
+ `${ message || spinner.text } (in ${ time[ 0 ] }s ${ (
36
+ time[ 1 ] / 1e6
37
+ ).toFixed( 0 ) }ms)`
65
38
  );
66
- // Disable reason: Using console.error() means we get a stack trace.
67
- console.error( error );
68
- process.exit( 1 );
69
- } else {
70
- spinner.fail( 'An unknown error occured.' );
71
- process.exit( 1 );
39
+ process.exit( 0 );
40
+ },
41
+ ( error ) => {
42
+ if ( error instanceof env.ValidationError ) {
43
+ // Error is a validation error. That means the user did something wrong.
44
+ spinner.fail( error.message );
45
+ process.exit( 1 );
46
+ } else if (
47
+ error &&
48
+ typeof error === 'object' &&
49
+ 'exitCode' in error &&
50
+ 'err' in error &&
51
+ 'out' in error
52
+ ) {
53
+ // Error is a docker-compose error. That means something docker-related failed.
54
+ // https://github.com/PDMLab/docker-compose/blob/HEAD/src/index.ts
55
+ spinner.fail(
56
+ 'Error while running docker-compose command.'
57
+ );
58
+ if ( error.out ) {
59
+ process.stdout.write( error.out );
60
+ }
61
+ if ( error.err ) {
62
+ process.stderr.write( error.err );
63
+ }
64
+ process.exit( error.exitCode );
65
+ } else if ( error ) {
66
+ // Error is an unknown error. That means there was a bug in our code.
67
+ spinner.fail(
68
+ typeof error === 'string' ? error : error.message
69
+ );
70
+ // Disable reason: Using console.error() means we get a stack trace.
71
+ console.error( error );
72
+ process.exit( 1 );
73
+ } else {
74
+ spinner.fail( 'An unknown error occured.' );
75
+ process.exit( 1 );
76
+ }
72
77
  }
73
- }
74
- );
75
- };
78
+ );
79
+ };
76
80
 
77
81
  module.exports = function cli() {
78
82
  // Do nothing if Docker is unavailable.
@@ -415,8 +415,7 @@ describe( 'readConfig', () => {
415
415
  },
416
416
  {
417
417
  type: 'git',
418
- url:
419
- 'https://github.com/WordPress/theme-experiments.git',
418
+ url: 'https://github.com/WordPress/theme-experiments.git',
420
419
  ref: 'tt1-blocks@0.4.3',
421
420
  path: expect.stringMatching(
422
421
  /^(\/||\\).*theme-experiments(\/||\\)tt1-blocks$/
@@ -447,22 +446,19 @@ describe( 'readConfig', () => {
447
446
  pluginSources: [
448
447
  {
449
448
  type: 'zip',
450
- url:
451
- 'https://downloads.wordpress.org/plugin/gutenberg.zip',
449
+ url: 'https://downloads.wordpress.org/plugin/gutenberg.zip',
452
450
  path: expect.stringMatching( /^(\/||\\).*gutenberg$/ ),
453
451
  basename: 'gutenberg',
454
452
  },
455
453
  {
456
454
  type: 'zip',
457
- url:
458
- 'https://downloads.wordpress.org/plugin/gutenberg.8.1.0.zip',
455
+ url: 'https://downloads.wordpress.org/plugin/gutenberg.8.1.0.zip',
459
456
  path: expect.stringMatching( /^(\/||\\).*gutenberg$/ ),
460
457
  basename: 'gutenberg',
461
458
  },
462
459
  {
463
460
  type: 'zip',
464
- url:
465
- 'https://downloads.wordpress.org/theme/twentytwenty.zip',
461
+ url: 'https://downloads.wordpress.org/theme/twentytwenty.zip',
466
462
  path: expect.stringMatching(
467
463
  /^(\/||\\).*twentytwenty$/
468
464
  ),
@@ -470,8 +466,7 @@ describe( 'readConfig', () => {
470
466
  },
471
467
  {
472
468
  type: 'zip',
473
- url:
474
- 'https://downloads.wordpress.org/theme/twentytwenty.1.3.zip',
469
+ url: 'https://downloads.wordpress.org/theme/twentytwenty.1.3.zip',
475
470
  path: expect.stringMatching(
476
471
  /^(\/||\\).*twentytwenty$/
477
472
  ),
@@ -502,15 +497,13 @@ describe( 'readConfig', () => {
502
497
  pluginSources: [
503
498
  {
504
499
  type: 'zip',
505
- url:
506
- 'https://www.example.com/test/path/to/gutenberg.zip',
500
+ url: 'https://www.example.com/test/path/to/gutenberg.zip',
507
501
  path: expect.stringMatching( /^(\/||\\).*gutenberg$/ ),
508
502
  basename: 'gutenberg',
509
503
  },
510
504
  {
511
505
  type: 'zip',
512
- url:
513
- 'https://www.example.com/test/path/to/gutenberg.8.1.0.zip',
506
+ url: 'https://www.example.com/test/path/to/gutenberg.8.1.0.zip',
514
507
  path: expect.stringMatching(
515
508
  /^(\/||\\).*gutenberg.8.1.0$/
516
509
  ),
@@ -518,8 +511,7 @@ describe( 'readConfig', () => {
518
511
  },
519
512
  {
520
513
  type: 'zip',
521
- url:
522
- 'https://www.example.com/test/path/to/twentytwenty.zip',
514
+ url: 'https://www.example.com/test/path/to/twentytwenty.zip',
523
515
  path: expect.stringMatching(
524
516
  /^(\/||\\).*twentytwenty$/
525
517
  ),
@@ -527,8 +519,7 @@ describe( 'readConfig', () => {
527
519
  },
528
520
  {
529
521
  type: 'zip',
530
- url:
531
- 'https://www.example.com/test/path/to/twentytwenty.1.3.zip',
522
+ url: 'https://www.example.com/test/path/to/twentytwenty.1.3.zip',
532
523
  path: expect.stringMatching(
533
524
  /^(\/||\\).*twentytwenty.1.3$/
534
525
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/env",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
4
4
  "description": "A zero-config, self contained local WordPress environment for development and testing.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -51,5 +51,5 @@
51
51
  "scripts": {
52
52
  "test": "echo \"Error: run tests from root\" && exit 1"
53
53
  },
54
- "gitHead": "a3e0b62091e8a8bdf5e2518e42d60d7098af48cc"
54
+ "gitHead": "48d5f37dfb52d2e77c8eeb662f9874cf141b8c6b"
55
55
  }