@wordpress/env 8.0.0 → 8.1.1
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/README.md +2 -2
- package/bin/wp-env +18 -2
- package/lib/cli.js +5 -0
- package/lib/init-config.js +7 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -44,9 +44,9 @@ If your project already has a package.json, it's also possible to use `wp-env` a
|
|
|
44
44
|
$ npm i @wordpress/env --save-dev
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
If you have also installed `wp-env` globally, running it will automatically execute the local, project-level package. Alternatively, you can execute `wp-env` via [`npx`](https://www.npmjs.com/package/npx), a utility automatically installed with `npm`.`npx` finds binaries like `wp-env` installed through node modules. As an example: `npx wp-env start --update`.
|
|
48
48
|
|
|
49
|
-
If you don't wish to use `npx`, modify your package.json and add an extra command to npm `scripts` (https://docs.npmjs.com/misc/scripts):
|
|
49
|
+
If you don't wish to use the global installation or `npx`, modify your `package.json` and add an extra command to npm `scripts` (https://docs.npmjs.com/misc/scripts):
|
|
50
50
|
|
|
51
51
|
```json
|
|
52
52
|
"scripts": {
|
package/bin/wp-env
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
// Remove 'node' and the name of the script from the arguments.
|
|
5
|
+
let command = process.argv.slice( 2 );
|
|
6
|
+
// Default to help text when they aren't running any commands.
|
|
7
|
+
if ( ! command.length ) {
|
|
8
|
+
command = [ '--help' ];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Rather than just executing the current CLI we will attempt to find a local version
|
|
12
|
+
// and execute that one instead. This prevents users from accidentally using the
|
|
13
|
+
// global CLI when a potentially different local version is expected.
|
|
14
|
+
const localPath = require.resolve( '@wordpress/env/lib/cli.js', {
|
|
15
|
+
paths: [ process.cwd(), __dirname ],
|
|
16
|
+
} );
|
|
17
|
+
const cli = require( localPath )();
|
|
18
|
+
|
|
19
|
+
// Now we can execute the CLI with the given command.
|
|
20
|
+
cli.parse( command );
|
package/lib/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ const { execSync } = require( 'child_process' );
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
+
const pkg = require( '../package.json' );
|
|
14
15
|
const env = require( './env' );
|
|
15
16
|
const parseXdebugMode = require( './parse-xdebug-mode' );
|
|
16
17
|
const {
|
|
@@ -110,6 +111,10 @@ module.exports = function cli() {
|
|
|
110
111
|
'populate--': true,
|
|
111
112
|
} );
|
|
112
113
|
|
|
114
|
+
// Since we might be running a different CLI version than the one that was called
|
|
115
|
+
// we need to set the version manually from the correct package.json.
|
|
116
|
+
yargs.version( pkg.version );
|
|
117
|
+
|
|
113
118
|
yargs.command(
|
|
114
119
|
'start',
|
|
115
120
|
wpGreen(
|
package/lib/init-config.js
CHANGED
|
@@ -124,6 +124,7 @@ function wordpressDockerFileContents( env, config ) {
|
|
|
124
124
|
# Update apt sources for archived versions of Debian.
|
|
125
125
|
|
|
126
126
|
# stretch (https://lists.debian.org/debian-devel-announce/2023/03/msg00006.html)
|
|
127
|
+
RUN touch /etc/apt/sources.list
|
|
127
128
|
RUN sed -i 's|deb.debian.org/debian stretch|archive.debian.org/debian stretch|g' /etc/apt/sources.list
|
|
128
129
|
RUN sed -i 's|security.debian.org/debian-security stretch|archive.debian.org/debian-security stretch|g' /etc/apt/sources.list
|
|
129
130
|
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
|
|
@@ -133,8 +134,8 @@ ARG HOST_USERNAME
|
|
|
133
134
|
ARG HOST_UID
|
|
134
135
|
ARG HOST_GID
|
|
135
136
|
# When the IDs are already in use we can still safely move on.
|
|
136
|
-
RUN groupadd -g $HOST_GID $HOST_USERNAME || true
|
|
137
|
-
RUN useradd -
|
|
137
|
+
RUN groupadd -o -g $HOST_GID $HOST_USERNAME || true
|
|
138
|
+
RUN useradd -mlo -u $HOST_UID -g $HOST_GID $HOST_USERNAME || true
|
|
138
139
|
|
|
139
140
|
# Install any dependencies we need in the container.
|
|
140
141
|
${ installDependencies( 'wordpress', env, config ) }`;
|
|
@@ -167,7 +168,7 @@ RUN adduser -h /home/$HOST_USERNAME -G $( getent group $HOST_GID | cut -d: -f1 )
|
|
|
167
168
|
|
|
168
169
|
# Install any dependencies we need in the container.
|
|
169
170
|
${ installDependencies( 'cli', env, config ) }
|
|
170
|
-
|
|
171
|
+
|
|
171
172
|
# Switch back to the original user now that we're done.
|
|
172
173
|
USER www-data
|
|
173
174
|
|
|
@@ -200,6 +201,9 @@ RUN apt-get -qy update
|
|
|
200
201
|
# Install some basic PHP dependencies.
|
|
201
202
|
RUN apt-get -qy install $PHPIZE_DEPS && touch /usr/local/etc/php/php.ini
|
|
202
203
|
|
|
204
|
+
# Install git
|
|
205
|
+
RUN apt-get -qy install git
|
|
206
|
+
|
|
203
207
|
# Set up sudo so they can have root access.
|
|
204
208
|
RUN apt-get -qy install sudo
|
|
205
209
|
RUN echo "#$HOST_UID ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/env",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
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": "
|
|
54
|
+
"gitHead": "ce48192a1add94b931ef60f3e9c7fdc873103be8"
|
|
55
55
|
}
|