-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update E2E workflow to use zip built by generate zip action.
- Loading branch information
1 parent
86e9489
commit 3921ba6
Showing
2 changed files
with
47 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require( 'fs' ); | ||
const { exit } = require( 'process' ); | ||
|
||
const path = `${ process.cwd() }/.wp-env.override.json`; | ||
const path = `${ process.cwd() }/.wp-env.json`; | ||
|
||
// eslint-disable-next-line import/no-dynamic-require | ||
const config = fs.existsSync( path ) ? require( path ) : {}; | ||
let config = fs.existsSync( path ) ? require( path ) : { plugins: [ '.' ] }; | ||
|
||
const args = process.argv.slice( 2 ); | ||
const args = {}; | ||
process.argv | ||
.slice(2, process.argv.length) | ||
.forEach( arg => { | ||
if (arg.slice(0,2) === '--') { | ||
const param = arg.split('='); | ||
const paramName = param[0].slice(2,param[0].length); | ||
const paramValue = param.length > 1 ? param[1] : true; | ||
args[paramName] = paramValue; | ||
} | ||
}); | ||
|
||
if ( args.length === 0 ) exit( 0 ); | ||
if ( ! args.core && ! args.plugins ) { | ||
return; | ||
} | ||
|
||
if ( 'latest' === args.core ) { | ||
delete args.core; | ||
} | ||
|
||
if ( args[ 0 ] === 'latest' ) { | ||
if ( fs.existsSync( path ) ) { | ||
fs.unlinkSync( path ); | ||
} | ||
exit( 0 ); | ||
if( Object.keys(args).length === 0 ) { | ||
return; | ||
} | ||
|
||
config.core = args[ 0 ]; | ||
if ( args.plugins ) { | ||
args.plugins = args.plugins.split(','); | ||
} | ||
|
||
// eslint-disable-next-line no-useless-escape | ||
if ( ! config.core.match( /^WordPress\/WordPress\#/ ) ) { | ||
config.core = `WordPress/WordPress#${ config.core }`; | ||
config = { | ||
...config, | ||
...args, | ||
} | ||
|
||
try { | ||
fs.writeFileSync( path, JSON.stringify( config ) ); | ||
fs.writeFileSync( path, JSON.stringify( config ) ); | ||
} catch ( err ) { | ||
// eslint-disable-next-line no-console | ||
console.error( err ); | ||
console.error( err ); | ||
} |