wp-blank-scripts 3.1.19 → 4.0.0-alpha.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 +160 -233
- package/cli/config.js +6 -6
- package/cli/deploy.js +8 -8
- package/cli/migrate-sass.js +86 -0
- package/cli/setup.js +22 -44
- package/index.js +22 -11
- package/lib/buildProject.js +15 -3
- package/lib/deployProject.js +18 -27
- package/lib/index.js +0 -2
- package/lib/pullSQL.js +1 -3
- package/lib/setupProject.js +4 -6
- package/overridable/checkProjectDependencies.js +22 -13
- package/overridable/index.js +0 -2
- package/package.json +41 -46
- package/utils/checkNodeVersion.js +3 -3
- package/utils/ensureGitignore.js +24 -0
- package/utils/execSsh.js +2 -2
- package/utils/git.js +10 -87
- package/utils/isReactProject.js +3 -0
- package/utils/replaceSQL.js +6 -10
- package/utils/runProjectBuildTask.js +6 -2
- package/utils/startMAMP.js +5 -5
- package/utils/tunnelSsh.js +20 -20
- package/webpack.base.config.js +112 -39
- package/webpack.react.config.js +3 -3
- package/webpack.wp.config.js +59 -30
- package/overridable/copyFx.js +0 -5
- package/utils/deploySQLFromCI.js +0 -34
- package/utils/getDefaultSetup.js +0 -5
- package/utils/getFxFiles.js +0 -119
package/README.md
CHANGED
|
@@ -1,130 +1,116 @@
|
|
|
1
1
|
# WP Blank Scripts
|
|
2
2
|
|
|
3
|
-
CLI and build tool for
|
|
3
|
+
CLI and build tool for WordPress projects at ViVO Digital.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Requirements
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**v3 Warnings**
|
|
10
|
-
|
|
11
|
-
#### Sass division outside of calc() deprecated
|
|
12
|
-
|
|
13
|
-
Deprecation Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
|
|
14
|
-
Recommendation: math.div(-$grid-gutter, 2) or calc(-1 * $grid-gutter / 2). More info and automated migrator: https://sass-lang.com/d/slash-div
|
|
15
|
-
|
|
16
|
-
Fix:
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
npm install -g sass-migrator
|
|
20
|
-
sass-migrator division **/*.scss
|
|
21
|
-
|
|
22
|
-
```
|
|
7
|
+
- Node `>=22`
|
|
8
|
+
- MAMP (optional — skipped automatically if not installed)
|
|
23
9
|
|
|
24
10
|
## Project Structure
|
|
25
11
|
|
|
12
|
+
### New projects (v4+)
|
|
13
|
+
|
|
26
14
|
```
|
|
27
15
|
/
|
|
28
|
-
├── config
|
|
16
|
+
├── config/
|
|
29
17
|
│ ├── .htaccess{-environment}
|
|
30
18
|
│ ├── robots{-environment}.txt
|
|
31
19
|
│ └── wp-config{-environment}.php
|
|
32
|
-
├── src
|
|
33
|
-
│ ├──
|
|
34
|
-
│
|
|
35
|
-
│
|
|
36
|
-
│
|
|
37
|
-
│
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
│ ├── inc
|
|
41
|
-
│ ├── screenshot.png
|
|
42
|
-
│ ├── style.css
|
|
43
|
-
│ └── templates
|
|
44
|
-
├── sql
|
|
45
|
-
├── tasks
|
|
20
|
+
├── src/
|
|
21
|
+
│ ├── blocks/
|
|
22
|
+
│ ├── parts/
|
|
23
|
+
│ ├── index.js
|
|
24
|
+
│ ├── style.scss
|
|
25
|
+
│ └── ...theme files
|
|
26
|
+
├── sql/
|
|
27
|
+
├── tasks/
|
|
46
28
|
│ └── overrides.js
|
|
47
|
-
├── vendor
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
├── vendor/
|
|
30
|
+
└── wp-content/
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Legacy projects (pre-v4)
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
/
|
|
37
|
+
├── src/
|
|
38
|
+
│ ├── assets/
|
|
39
|
+
│ │ ├── admin/
|
|
40
|
+
│ │ ├── css/
|
|
41
|
+
│ │ ├── fonts/
|
|
42
|
+
│ │ ├── images/
|
|
43
|
+
│ │ └── js/
|
|
44
|
+
│ └── ...theme files
|
|
45
|
+
└── ...
|
|
50
46
|
```
|
|
51
47
|
|
|
48
|
+
Both structures are auto-detected — no configuration required.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
52
|
## Usage
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Add to your project's `package.json` scripts:
|
|
55
55
|
|
|
56
56
|
```json
|
|
57
57
|
{
|
|
58
58
|
"scripts": {
|
|
59
|
-
"
|
|
60
|
-
"build": "
|
|
59
|
+
"dev": "wp-scripts dev",
|
|
60
|
+
"build": "wp-scripts build",
|
|
61
|
+
"build:staging": "wp-scripts build --environment=staging",
|
|
62
|
+
"build:production": "wp-scripts build --environment=production",
|
|
61
63
|
"import": "wp-scripts import",
|
|
62
64
|
"backup": "wp-scripts backup",
|
|
63
65
|
"setup": "wp-scripts setup",
|
|
64
66
|
"export": "wp-scripts export",
|
|
65
67
|
"deploy": "wp-scripts deploy",
|
|
66
|
-
"pull": "wp-scripts pull"
|
|
67
|
-
"clone": "wp-scripts clone"
|
|
68
|
+
"pull": "wp-scripts pull"
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
#### `backup`
|
|
75
|
-
|
|
76
|
-
Backup wp-content from dev project to local file system.
|
|
77
|
-
|
|
78
|
-
#### `build`
|
|
79
|
-
|
|
80
|
-
Build the project to the output directory
|
|
81
|
-
|
|
82
|
-
**Env variables:**
|
|
83
|
-
|
|
84
|
-
- `BUILD_ENV=local|staging|production` to set the build environment
|
|
85
|
-
|
|
86
|
-
**Options:**
|
|
87
|
-
|
|
88
|
-
**environment** `local|staging|production` (required)
|
|
73
|
+
---
|
|
89
74
|
|
|
90
|
-
|
|
75
|
+
## CLI Commands
|
|
91
76
|
|
|
92
|
-
|
|
77
|
+
### `dev`
|
|
93
78
|
|
|
94
|
-
Run the project in dev mode with live reload
|
|
79
|
+
Run the project in dev mode with live reload.
|
|
95
80
|
|
|
96
81
|
**Env variables:**
|
|
97
82
|
|
|
98
|
-
- `PORT=3001`
|
|
99
|
-
- `HTTPS=1`
|
|
83
|
+
- `PORT=3001` — change dev server port
|
|
84
|
+
- `HTTPS=1` — enable HTTPS for the dev server
|
|
85
|
+
- `BYPASS_REACT=true` — force non-React mode even if `react` is in dependencies
|
|
100
86
|
|
|
101
|
-
|
|
87
|
+
---
|
|
102
88
|
|
|
103
|
-
|
|
89
|
+
### `build`
|
|
104
90
|
|
|
105
|
-
|
|
91
|
+
Build the project to the output directory.
|
|
106
92
|
|
|
107
93
|
**Options:**
|
|
108
94
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
The environment to deploy to.
|
|
112
|
-
|
|
113
|
-
**mode** `Site|wp-content|Theme|Plugins|SQL only` (required)
|
|
95
|
+
- `--environment` `local|staging|production` — build environment (required)
|
|
114
96
|
|
|
115
|
-
|
|
97
|
+
When building for `staging` or `production`, output goes to `dist-{environment}` so it doesn't overwrite your local dev build. The deploy command handles cleanup automatically.
|
|
116
98
|
|
|
117
|
-
|
|
99
|
+
---
|
|
118
100
|
|
|
119
|
-
|
|
101
|
+
### `deploy`
|
|
120
102
|
|
|
121
|
-
|
|
103
|
+
Build and deploy the project via rsync over SSH, with optional SQL deployment.
|
|
122
104
|
|
|
123
|
-
|
|
105
|
+
All environment info must be in `config/settings.json`.
|
|
124
106
|
|
|
125
|
-
**
|
|
107
|
+
**Options:**
|
|
126
108
|
|
|
127
|
-
|
|
109
|
+
- `--environment` `staging|production` (required)
|
|
110
|
+
- `--mode` `Site|wp-content|Theme|Plugins|SQL only` (required)
|
|
111
|
+
- `--sql` `boolean` — deploy SQL (assumed true if mode is `SQL only`)
|
|
112
|
+
- `--serverPassword` `string` — SSH password (if not using key)
|
|
113
|
+
- `--serverPrivateKey` `string` — path to SSH private key (defaults to `~/.ssh/id_rsa`)
|
|
128
114
|
|
|
129
115
|
**Example:**
|
|
130
116
|
|
|
@@ -132,15 +118,15 @@ Path to the private key for the configured user on the server. This is only requ
|
|
|
132
118
|
wp-scripts deploy --mode="wp-content" --environment="staging"
|
|
133
119
|
```
|
|
134
120
|
|
|
135
|
-
|
|
121
|
+
---
|
|
136
122
|
|
|
137
|
-
|
|
123
|
+
### `export`
|
|
138
124
|
|
|
139
|
-
|
|
125
|
+
Export the local SQL database to the `sql/` directory.
|
|
140
126
|
|
|
141
|
-
**
|
|
127
|
+
**Options:**
|
|
142
128
|
|
|
143
|
-
|
|
129
|
+
- `--environment` `local|staging|production` (required) — if not `local`, URLs are replaced with those from the config for that environment
|
|
144
130
|
|
|
145
131
|
**Example:**
|
|
146
132
|
|
|
@@ -148,59 +134,38 @@ The environment you are exporting for. If not `local` urls will be replaced to t
|
|
|
148
134
|
wp-scripts export --environment="staging"
|
|
149
135
|
```
|
|
150
136
|
|
|
151
|
-
|
|
137
|
+
---
|
|
152
138
|
|
|
153
|
-
|
|
139
|
+
### `import`
|
|
154
140
|
|
|
155
|
-
|
|
141
|
+
Import a SQL file into the local database. Creates the database if it doesn't exist.
|
|
156
142
|
|
|
157
143
|
**Options:**
|
|
158
144
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Pass `latest` instead of a file path to automatically import the most recent SQL file from the `./sql` directory.
|
|
145
|
+
- `--file` `path/to/file` (required) — pass `latest` to use the most recent file in `./sql`
|
|
146
|
+
- `--replace` `boolean` — replace URLs before importing (does not mutate the original file)
|
|
147
|
+
- `--environment` `local|dev|staging|production` — environment to replace URLs **from**
|
|
148
|
+
- `--currentEnvironment` `local|dev|staging|production` — environment to replace URLs **to**
|
|
164
149
|
|
|
165
|
-
**
|
|
166
|
-
|
|
167
|
-
Should urls be replaced in the SQL before importing. This will not mutate the original file.
|
|
168
|
-
|
|
169
|
-
**environment** `local|dev|staging|production`
|
|
170
|
-
|
|
171
|
-
The environment you are replacing the urls **from**. This is only required if `replace` is true.
|
|
172
|
-
|
|
173
|
-
**currentEnvironment** `local|dev|staging|production`
|
|
174
|
-
|
|
175
|
-
The environment you are replacing the urls **to**. This is only required if `replace` is true.
|
|
176
|
-
|
|
177
|
-
**Example:**
|
|
150
|
+
**Examples:**
|
|
178
151
|
|
|
179
152
|
```bash
|
|
180
153
|
wp-scripts import --file="./sql/database.sql"
|
|
181
|
-
# Import file and replace urls from staging to dev
|
|
182
|
-
wp-scripts import --file="./sql/database.sql" --replace="true" --environment="staging" --currentEnvironment="dev"
|
|
183
|
-
# Use the latest file
|
|
184
154
|
wp-scripts import --file="latest"
|
|
155
|
+
wp-scripts import --file="./sql/database.sql" --replace="true" --environment="staging" --currentEnvironment="local"
|
|
185
156
|
```
|
|
186
157
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
Pull from an _environment_ database to the `project/sql` directory.
|
|
190
|
-
|
|
191
|
-
**Options:**
|
|
192
|
-
|
|
193
|
-
**environment** `staging|production` (required)
|
|
158
|
+
---
|
|
194
159
|
|
|
195
|
-
|
|
160
|
+
### `pull`
|
|
196
161
|
|
|
197
|
-
|
|
162
|
+
Pull a remote database to the `sql/` directory.
|
|
198
163
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
**serverPrivateKey** `string`
|
|
164
|
+
**Options:**
|
|
202
165
|
|
|
203
|
-
|
|
166
|
+
- `--environment` `staging|production` (required)
|
|
167
|
+
- `--serverPassword` `string`
|
|
168
|
+
- `--serverPrivateKey` `string`
|
|
204
169
|
|
|
205
170
|
**Example:**
|
|
206
171
|
|
|
@@ -208,187 +173,149 @@ Path to the private key for the configured user on the server. This is only requ
|
|
|
208
173
|
wp-scripts pull --environment="staging" --serverPrivateKey="~/.ssh/id_rsa"
|
|
209
174
|
```
|
|
210
175
|
|
|
211
|
-
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### `setup`
|
|
212
179
|
|
|
213
|
-
|
|
180
|
+
Set up a new blank project by replacing template placeholders.
|
|
214
181
|
|
|
215
182
|
**Options:**
|
|
216
183
|
|
|
217
|
-
|
|
184
|
+
- `--projectLocation` `string` — path relative to MAMP document root
|
|
185
|
+
- `--project` `string` — project name
|
|
186
|
+
- `--productionDomain` `string` — production domain (e.g. `example.com`)
|
|
187
|
+
- `--tablePrefix` `string` — WordPress table prefix
|
|
218
188
|
|
|
219
|
-
|
|
189
|
+
Running without options launches an interactive prompt.
|
|
220
190
|
|
|
221
|
-
|
|
191
|
+
---
|
|
222
192
|
|
|
223
|
-
|
|
193
|
+
### `backup`
|
|
224
194
|
|
|
225
|
-
|
|
195
|
+
Backup `wp-content` from the dev project to the local file system.
|
|
226
196
|
|
|
227
|
-
|
|
197
|
+
---
|
|
228
198
|
|
|
229
|
-
|
|
199
|
+
### `hooks`
|
|
230
200
|
|
|
231
|
-
|
|
201
|
+
Run a git hook action.
|
|
232
202
|
|
|
233
|
-
|
|
203
|
+
**Options:**
|
|
234
204
|
|
|
235
|
-
|
|
205
|
+
- `--type` `string` — hook type (e.g. `post-merge`)
|
|
236
206
|
|
|
237
|
-
|
|
207
|
+
---
|
|
238
208
|
|
|
239
|
-
|
|
209
|
+
### `config`
|
|
240
210
|
|
|
241
|
-
|
|
211
|
+
Add deployment config for an environment.
|
|
242
212
|
|
|
243
|
-
**
|
|
213
|
+
**Options:**
|
|
244
214
|
|
|
245
|
-
|
|
215
|
+
- `--environment` `staging|production`
|
|
246
216
|
|
|
247
|
-
|
|
217
|
+
---
|
|
248
218
|
|
|
249
|
-
|
|
250
|
-
wp-scripts setup --project="Hello" --productionDomain="example.com" --agency="Mitch" --agencySlug="mitch" --agencyWebsite="mitch.app" --tablePrefix="mh_"
|
|
251
|
-
```
|
|
219
|
+
### `migrate-sass`
|
|
252
220
|
|
|
253
|
-
|
|
221
|
+
Migrate legacy SCSS to Dart Sass 3.0 compatible syntax using the official `sass-migrator`.
|
|
254
222
|
|
|
255
|
-
|
|
223
|
+
Dart Sass 3.0 removes `@import`, deprecated color functions (`darken`, `lighten`), `/` for division, and global built-in functions (`map-get`, `nth`). This command runs the official migrations in a safe order.
|
|
256
224
|
|
|
257
225
|
**Options:**
|
|
258
226
|
|
|
259
|
-
|
|
227
|
+
- `--migration` `division|color|module` — run a single specific migration (omit to run all three in order)
|
|
228
|
+
- `--glob` `string` — SCSS file glob (default: `src/**/*.scss`)
|
|
229
|
+
- `--dry-run` — preview changes without writing files
|
|
260
230
|
|
|
261
|
-
|
|
231
|
+
**Migrations (run in this order):**
|
|
262
232
|
|
|
263
|
-
|
|
233
|
+
| Migration | What it does | Risk |
|
|
234
|
+
|-----------|-------------|------|
|
|
235
|
+
| `division` | Replaces `/` division with `math.div()`, adds `@use 'sass:math'` | Low |
|
|
236
|
+
| `color` | Replaces `darken()`/`lighten()` etc. with `color.adjust()`/`color.scale()`, adds `@use 'sass:color'` | Low |
|
|
237
|
+
| `module` | Converts `@import` → `@use`/`@forward`, namespaces variables/mixins/functions | High — review carefully |
|
|
264
238
|
|
|
265
|
-
|
|
266
|
-
wp-scripts hooks --type="pre-commit"
|
|
267
|
-
```
|
|
239
|
+
**Recommended workflow:**
|
|
268
240
|
|
|
269
|
-
|
|
241
|
+
Node modules are resolved automatically (`--load-path=.` is passed to sass-migrator), so imports like `@import 'node_modules/swiper/css/swiper.min'` are handled correctly.
|
|
270
242
|
|
|
271
|
-
|
|
243
|
+
```bash
|
|
244
|
+
# 1. Preview what will change
|
|
245
|
+
wp-scripts migrate-sass --dry-run
|
|
272
246
|
|
|
273
|
-
Run the
|
|
247
|
+
# 2. Run the safe migrations first
|
|
248
|
+
wp-scripts migrate-sass --migration=division
|
|
249
|
+
wp-scripts migrate-sass --migration=color
|
|
274
250
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
```
|
|
251
|
+
# 3. Verify your build still works, then commit
|
|
252
|
+
yarn build
|
|
278
253
|
|
|
279
|
-
|
|
254
|
+
# 4. Run the module migration separately — requires manual review
|
|
255
|
+
# Variables will be namespaced (e.g. $var → variables.$var)
|
|
256
|
+
wp-scripts migrate-sass --migration=module
|
|
257
|
+
```
|
|
280
258
|
|
|
281
|
-
|
|
259
|
+
The `module` migration is complex and almost always requires manual cleanup — especially if partials are imported in multiple places. Run it last and review every changed file before committing.
|
|
282
260
|
|
|
283
|
-
|
|
261
|
+
---
|
|
284
262
|
|
|
285
|
-
|
|
263
|
+
## Overrides
|
|
286
264
|
|
|
287
|
-
|
|
265
|
+
Create a `tasks/overrides.js` file in your project to customise the build.
|
|
288
266
|
|
|
289
|
-
|
|
267
|
+
### `copyFiles`
|
|
290
268
|
|
|
291
|
-
|
|
269
|
+
Add extra files to the webpack copy task.
|
|
292
270
|
|
|
293
|
-
```
|
|
271
|
+
```js
|
|
294
272
|
exports.copyFiles = (paths) => {
|
|
295
|
-
|
|
296
|
-
const {
|
|
297
|
-
sourceDir, // Relative
|
|
298
|
-
themeDir, // Relative
|
|
299
|
-
sourcePath, // Absolute
|
|
300
|
-
buildPath, // Absolute
|
|
301
|
-
themePath, // Absolute
|
|
302
|
-
} = paths;
|
|
273
|
+
const { sourceDir, themeDir, sourcePath, buildPath, themePath } = paths;
|
|
303
274
|
|
|
304
275
|
return [
|
|
305
276
|
{
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
to: path.join(themePath, 'new-directory'),
|
|
277
|
+
from: path.join(sourceDir, 'my-directory'),
|
|
278
|
+
to: path.join(themePath, 'my-directory'),
|
|
309
279
|
},
|
|
310
|
-
{
|
|
311
|
-
// Copy files inside a directory the the theme
|
|
312
|
-
from: path.join(sourceDir, 'new-directory'),
|
|
313
|
-
to: themePath,
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
// Copy file from a directory to the root directory
|
|
317
|
-
from: path.join(sourceDir, 'directory-file-was-in', 'file.txt'),
|
|
318
|
-
to: '',
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
// Copy all files from vendor (except vivo-digital & johnpbloch) to the theme/inc/vendor
|
|
322
|
-
from: path.join(__dirname, "..", "vendor"),
|
|
323
|
-
to: path.join(themePath, "inc", "vendor"),
|
|
324
|
-
globOptions: {
|
|
325
|
-
ignore: [
|
|
326
|
-
path.join("@(vivo-digital|johnpbloch)", '**')
|
|
327
|
-
],
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
280
|
];
|
|
331
|
-
}
|
|
281
|
+
};
|
|
332
282
|
```
|
|
333
283
|
|
|
334
|
-
|
|
284
|
+
### `webpackConfig`
|
|
335
285
|
|
|
336
|
-
|
|
286
|
+
Override the default webpack config (merged via webpack-merge).
|
|
337
287
|
|
|
338
|
-
```
|
|
288
|
+
```js
|
|
339
289
|
exports.webpackConfig = () => {
|
|
340
290
|
return {
|
|
341
|
-
// Disable sourcemaps completely
|
|
342
291
|
devtool: false,
|
|
343
|
-
}
|
|
344
|
-
}
|
|
292
|
+
};
|
|
293
|
+
};
|
|
345
294
|
```
|
|
346
295
|
|
|
347
|
-
|
|
296
|
+
### `loaderOptions`
|
|
348
297
|
|
|
349
|
-
|
|
298
|
+
Override default loader options. Available loaders: `css`, `js`, `images`, `fonts`.
|
|
350
299
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
```
|
|
300
|
+
```js
|
|
354
301
|
exports.loaderOptions = () => {
|
|
355
302
|
return {
|
|
356
303
|
js: {
|
|
357
|
-
// Don't run js files from node_modules OR vendor directories through the JS (babel) loader
|
|
358
304
|
exclude: /(node_modules|vendor)/,
|
|
359
|
-
}
|
|
305
|
+
},
|
|
360
306
|
};
|
|
361
307
|
};
|
|
362
308
|
```
|
|
363
309
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
You can change the path of `fx` packages (classes or modules) installed via composer. This is useful for local development.
|
|
367
|
-
|
|
368
|
-
This function should return an object with the package name as the key and local path as the value.
|
|
369
|
-
|
|
370
|
-
```
|
|
371
|
-
exports.copyFx = () => {
|
|
372
|
-
return {
|
|
373
|
-
'package-name': 'path/to/local/repository',
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
#### `checkProjectDependencies`
|
|
310
|
+
### `checkProjectDependencies`
|
|
379
311
|
|
|
380
312
|
Run a custom dependency check before the project builds.
|
|
381
313
|
|
|
382
|
-
```
|
|
383
|
-
exports.checkProjectDependencies = () => {
|
|
384
|
-
const pck = JSON.parse(fs.readFileSync(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (!dependencies['some-required-package']) {
|
|
388
|
-
console.log('Missing this package!');
|
|
314
|
+
```js
|
|
315
|
+
exports.checkProjectDependencies = async () => {
|
|
316
|
+
const pck = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
317
|
+
if (!pck.dependencies['some-required-package']) {
|
|
318
|
+
console.warn('Missing some-required-package!');
|
|
389
319
|
}
|
|
390
320
|
};
|
|
391
321
|
```
|
|
392
|
-
|
|
393
|
-
## Node Version
|
|
394
|
-
Currently supports `18.8.0` for all projects running `wp-blank-scripts@3.0.0`
|
package/cli/config.js
CHANGED
|
@@ -63,12 +63,12 @@ module.exports = async () => {
|
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
name: 'urlProduction',
|
|
66
|
-
message: 'What is the production URL?',
|
|
66
|
+
message: 'What is the production URL? (https://...)',
|
|
67
67
|
when: (answers) => answers.environment === 'production',
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
name: 'hostProduction',
|
|
71
|
-
message: 'What is the production server host?',
|
|
71
|
+
message: 'What is the production server host? (example.com)',
|
|
72
72
|
when: (answers) => answers.environment === 'production',
|
|
73
73
|
},
|
|
74
74
|
{
|
|
@@ -102,20 +102,20 @@ module.exports = async () => {
|
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
name: 'urlStaging',
|
|
105
|
-
message: 'What is the staging URL?',
|
|
105
|
+
message: 'What is the staging URL? (https://...)',
|
|
106
106
|
when: (answers) => answers.environment === 'staging',
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
name: 'hostStaging',
|
|
110
|
-
message: 'What is the staging server host?',
|
|
110
|
+
message: 'What is the staging server host? (example.com)',
|
|
111
111
|
when: (answers) => answers.environment === 'staging',
|
|
112
|
-
default: '
|
|
112
|
+
default: 'preview.vivo.digital',
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
name: 'userStaging',
|
|
116
116
|
message: 'What is the staging server user?',
|
|
117
117
|
when: (answers) => answers.environment === 'staging',
|
|
118
|
-
default: '
|
|
118
|
+
default: 'previewv',
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
name: 'destinationStaging',
|
package/cli/deploy.js
CHANGED
|
@@ -43,11 +43,11 @@ async function selectOptions() {
|
|
|
43
43
|
message: chalk.cyan('Do you want to deploy sql?'),
|
|
44
44
|
type: 'confirm',
|
|
45
45
|
default: false,
|
|
46
|
-
when: answers => answers.mode !== DEPLOY_MODES.SQL_ONLY,
|
|
46
|
+
when: (answers) => answers.mode !== DEPLOY_MODES.SQL_ONLY,
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
name: 'serverPassword',
|
|
50
|
-
message: answers => {
|
|
50
|
+
message: (answers) => {
|
|
51
51
|
const user = settings.server[answers.environment].user;
|
|
52
52
|
const host = settings.server[answers.environment].host;
|
|
53
53
|
return chalk.cyan(
|
|
@@ -55,18 +55,18 @@ async function selectOptions() {
|
|
|
55
55
|
);
|
|
56
56
|
},
|
|
57
57
|
type: 'password',
|
|
58
|
-
when: answers => answers.sql || answers.mode === DEPLOY_MODES.SQL_ONLY,
|
|
58
|
+
when: (answers) => answers.sql || answers.mode === DEPLOY_MODES.SQL_ONLY,
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
name: 'serverPrivateKey',
|
|
62
|
-
message: answers => {
|
|
62
|
+
message: (answers) => {
|
|
63
63
|
const user = settings.server[answers.environment].user;
|
|
64
64
|
const host = settings.server[answers.environment].host;
|
|
65
65
|
return chalk.cyan(`Enter the path to your private key for user ${user} on host ${host}`);
|
|
66
66
|
},
|
|
67
67
|
default: '~/.ssh/id_rsa',
|
|
68
68
|
type: 'input',
|
|
69
|
-
when: answers => !answers.serverPassword,
|
|
69
|
+
when: (answers) => !answers.serverPassword,
|
|
70
70
|
},
|
|
71
71
|
]);
|
|
72
72
|
|
|
@@ -84,7 +84,7 @@ async function selectOptions() {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
async function confirmOptions(selectedOptions) {
|
|
87
|
-
const
|
|
87
|
+
const deploymentOptions = [
|
|
88
88
|
['Environment', selectedOptions.environment],
|
|
89
89
|
['Mode', selectedOptions.mode],
|
|
90
90
|
['SQL', selectedOptions.sql || selectedOptions.mode === DEPLOY_MODES.SQL_ONLY],
|
|
@@ -93,7 +93,7 @@ async function confirmOptions(selectedOptions) {
|
|
|
93
93
|
const { confirm } = await inquirer.prompt([
|
|
94
94
|
{
|
|
95
95
|
name: 'confirm',
|
|
96
|
-
message: `Please confirm your project settings:\n${
|
|
96
|
+
message: `Please confirm your project settings:\n${deploymentOptions
|
|
97
97
|
.map(([title, value]) => `${chalk.yellow(title)}: ${value}`)
|
|
98
98
|
.join('\n')}`,
|
|
99
99
|
type: 'confirm',
|
|
@@ -126,7 +126,7 @@ async function promptForCommit(options, unstagedFiles) {
|
|
|
126
126
|
name: 'message',
|
|
127
127
|
message: chalk.cyan('Commit message'),
|
|
128
128
|
default: `Deploying to ${options.environment}`,
|
|
129
|
-
when: answers => answers.commit,
|
|
129
|
+
when: (answers) => answers.commit,
|
|
130
130
|
},
|
|
131
131
|
]);
|
|
132
132
|
|