@42wp/dev-env 1.0.3 → 1.0.5

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 CHANGED
@@ -45,18 +45,18 @@ so you (and your team) can just run `42wp start` with no flags. Scaffold one wit
45
45
  `42wp init`:
46
46
 
47
47
  ```bash
48
- 42wp init jovempan --subdomains --vip --locale pt_BR --theme 42wp-jovem-pan --demo-content
48
+ 42wp init mysite --subdomains --vip --locale pt_BR --theme my-theme --demo-content
49
49
  ```
50
50
 
51
51
  That writes:
52
52
 
53
53
  ```ini
54
- project_slug=jovempan
54
+ project_slug=mysite
55
55
  multisite=subdomain # false | subdir | subdomain
56
56
  username=admin
57
57
  password=password
58
58
  locale=pt_BR
59
- default_theme=42wp-jovem-pan
59
+ default_theme=my-theme
60
60
  wpvip=true
61
61
  initial_content=200
62
62
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@42wp/dev-env",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "42WP — a CLI to spin up disposable WordPress dev environments with Docker (Traefik + MySQL + per-project containers).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -217,12 +217,24 @@ export async function start(rawName, opts = {}) {
217
217
  step(t('start.upping'));
218
218
  await compose(['up', '-d', '--build'], { cwd: envDir });
219
219
 
220
- // 6. Wait for WP-CLI to answer inside the container (replaces `sleep 5`).
220
+ // 6. Wait for the WordPress core to be fully copied into the container before
221
+ // installing. The wordpress image's entrypoint extracts core alphabetically,
222
+ // so wp-includes/version.php lands BEFORE wp-settings.php — polling `wp core
223
+ // version` alone can proceed mid-copy on slow disks (e.g. a VM), and then
224
+ // `wp core install` fatals on a missing wp-settings.php. Waiting for
225
+ // wp-settings.php (which `install` requires, and which comes after all of
226
+ // wp-includes/) closes that window.
221
227
  step(t('start.waitingWp'));
222
228
  await pollUntil(
223
229
  async () => {
224
- const { code } = await dockerExecCapture(container, ['wp', 'core', 'version', '--allow-root']);
225
- return code === 0;
230
+ const settings = await dockerExecCapture(container, [
231
+ 'test',
232
+ '-f',
233
+ '/var/www/html/wp-settings.php',
234
+ ]);
235
+ if (settings.code !== 0) return false;
236
+ const version = await dockerExecCapture(container, ['wp', 'core', 'version', '--allow-root']);
237
+ return version.code === 0;
226
238
  },
227
239
  { label: 'WordPress', timeout: 90000 },
228
240
  );
package/src/lib/naming.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { t } from './i18n.js';
8
8
 
9
- // Remove the shortest trailing ".something", e.g. "jovempan.localhost" -> "jovempan".
9
+ // Remove the shortest trailing ".something", e.g. "mysite.localhost" -> "mysite".
10
10
  export function normalizeName(raw) {
11
11
  return String(raw ?? '').replace(/\.[^.]*$/, '');
12
12
  }
package/src/locales/en.js CHANGED
@@ -13,7 +13,7 @@ export default {
13
13
  'global.invalid': "Invalid global command. Use 'start' or 'stop'.",
14
14
 
15
15
  // start
16
- 'start.needName': 'You must provide a project name (or set project_slug in .42wp-dev-env). e.g.: 42wp start jovempan',
16
+ 'start.needName': 'You must provide a project name (or set project_slug in .42wp-dev-env). e.g.: 42wp start mysite',
17
17
  'start.usingConfig': 'Using options from .42wp-dev-env (CLI flags override).',
18
18
  'start.notWpContent':
19
19
  '${dir} is not a wp-content directory (missing ${missing}). Run 42wp start from your project root (it needs ${required}), or pass --force to override.',
@@ -54,14 +54,14 @@ export default {
54
54
  'init.next': 'Tip: with project_slug set, you can run 42wp start with no name.',
55
55
 
56
56
  // update
57
- 'update.needName': 'Tell me which project to update. e.g.: 42wp update jovempan',
57
+ 'update.needName': 'Tell me which project to update. e.g.: 42wp update mysite',
58
58
  'update.notFound': "Project '${name}' not found at ${dir}. Run 42wp start ${name} first.",
59
59
  'update.rebuilding': 'Rebuilding ${name} on ${image}...',
60
60
  'update.updatingDb': 'Updating database schema (wp core update-db)...',
61
61
  'update.done': 'Updated! ${name} is now on WordPress ${version}.',
62
62
 
63
63
  // rm
64
- 'rm.needName': 'Tell me which project to remove. e.g.: 42wp rm jovempan',
64
+ 'rm.needName': 'Tell me which project to remove. e.g.: 42wp rm mysite',
65
65
  'rm.notFound': "Project '${name}' not found at ${dir}.",
66
66
  'rm.confirm':
67
67
  "Remove '${name}'? This deletes its container, image and database. Your repository is kept.",
@@ -74,17 +74,17 @@ export default {
74
74
  'rm.done': "Removed '${name}'. Your repository was left untouched.",
75
75
 
76
76
  // seed
77
- 'seed.needName': 'Tell me which project to seed. e.g.: 42wp seed jovempan',
77
+ 'seed.needName': 'Tell me which project to seed. e.g.: 42wp seed mysite',
78
78
  'seed.notRunning': "Project '${name}' is not running. Start it first with 42wp start ${name}.",
79
79
  'seed.failed': 'Demo content generation failed.',
80
80
 
81
81
  // stop
82
- 'stop.needName': 'Tell me which project to stop. e.g.: 42wp stop jovempan',
82
+ 'stop.needName': 'Tell me which project to stop. e.g.: 42wp stop mysite',
83
83
  'stop.stopping': 'Stopping the ${name} environment...',
84
84
  'stop.notFound': 'Environment for ${name} not found at ${dir}.',
85
85
 
86
86
  // wp proxy
87
- 'wp.needArgs': 'Provide the project and command. e.g.: 42wp wp jovempan plugin list',
87
+ 'wp.needArgs': 'Provide the project and command. e.g.: 42wp wp mysite plugin list',
88
88
  'wp.notRunning': 'Container ${container} is not running.',
89
89
 
90
90
  // validation
package/src/locales/pt.js CHANGED
@@ -13,7 +13,7 @@ export default {
13
13
  'global.invalid': "Comando global inválido. Use 'start' ou 'stop'.",
14
14
 
15
15
  // start
16
- 'start.needName': 'Você precisa informar o nome do projeto (ou definir project_slug no .42wp-dev-env). Ex: 42wp start jovempan',
16
+ 'start.needName': 'Você precisa informar o nome do projeto (ou definir project_slug no .42wp-dev-env). Ex: 42wp start mysite',
17
17
  'start.usingConfig': 'Usando opções do .42wp-dev-env (flags da CLI têm prioridade).',
18
18
  'start.notWpContent':
19
19
  '${dir} não é um diretório wp-content (falta ${missing}). Rode 42wp start na raiz do projeto (precisa de ${required}), ou use --force para ignorar.',
@@ -54,14 +54,14 @@ export default {
54
54
  'init.next': 'Dica: com project_slug definido, você pode rodar 42wp start sem o nome.',
55
55
 
56
56
  // update
57
- 'update.needName': 'Informe o projeto para atualizar. Ex: 42wp update jovempan',
57
+ 'update.needName': 'Informe o projeto para atualizar. Ex: 42wp update mysite',
58
58
  'update.notFound': "Projeto '${name}' não encontrado em ${dir}. Rode 42wp start ${name} primeiro.",
59
59
  'update.rebuilding': 'Reconstruindo ${name} com ${image}...',
60
60
  'update.updatingDb': 'Atualizando o schema do banco (wp core update-db)...',
61
61
  'update.done': 'Atualizado! ${name} agora está no WordPress ${version}.',
62
62
 
63
63
  // rm
64
- 'rm.needName': 'Informe o projeto para remover. Ex: 42wp rm jovempan',
64
+ 'rm.needName': 'Informe o projeto para remover. Ex: 42wp rm mysite',
65
65
  'rm.notFound': "Projeto '${name}' não encontrado em ${dir}.",
66
66
  'rm.confirm':
67
67
  "Remover '${name}'? Isso apaga o container, a imagem e o banco de dados. Seu repositório é mantido.",
@@ -74,17 +74,17 @@ export default {
74
74
  'rm.done': "Removido '${name}'. Seu repositório não foi tocado.",
75
75
 
76
76
  // seed
77
- 'seed.needName': 'Informe o projeto para popular. Ex: 42wp seed jovempan',
77
+ 'seed.needName': 'Informe o projeto para popular. Ex: 42wp seed mysite',
78
78
  'seed.notRunning': "O projeto '${name}' não está rodando. Inicie com 42wp start ${name} primeiro.",
79
79
  'seed.failed': 'Falha ao gerar o conteúdo de demonstração.',
80
80
 
81
81
  // stop
82
- 'stop.needName': 'Informe o projeto para parar. Ex: 42wp stop jovempan',
82
+ 'stop.needName': 'Informe o projeto para parar. Ex: 42wp stop mysite',
83
83
  'stop.stopping': 'Parando o ambiente ${name}...',
84
84
  'stop.notFound': 'Ambiente para ${name} não encontrado em ${dir}.',
85
85
 
86
86
  // proxy wp
87
- 'wp.needArgs': 'Informe o projeto e o comando. Ex: 42wp wp jovempan plugin list',
87
+ 'wp.needArgs': 'Informe o projeto e o comando. Ex: 42wp wp mysite plugin list',
88
88
  'wp.notRunning': 'Container ${container} não está rodando.',
89
89
 
90
90
  // validação