@wpmoo/odoo 0.8.34 → 0.8.35
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 +5 -0
- package/dist/daily-actions.js +11 -1
- package/dist/help.js +3 -0
- package/dist/templates.js +153 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,8 +180,10 @@ npx @wpmoo/odoo reset
|
|
|
180
180
|
Run daily local development actions from a generated environment root:
|
|
181
181
|
|
|
182
182
|
```bash
|
|
183
|
+
npx @wpmoo/odoo start
|
|
183
184
|
npx @wpmoo/odoo logs odoo
|
|
184
185
|
npx @wpmoo/odoo restart
|
|
186
|
+
npx @wpmoo/odoo stop
|
|
185
187
|
npx @wpmoo/odoo shell
|
|
186
188
|
npx @wpmoo/odoo psql devel
|
|
187
189
|
npx @wpmoo/odoo install sale devel
|
|
@@ -193,6 +195,9 @@ Daily actions require `.wpmoo/odoo.json` in the current directory and delegate t
|
|
|
193
195
|
fixed scripts under `./scripts`; they do not search parent directories or accept
|
|
194
196
|
arbitrary script names.
|
|
195
197
|
|
|
198
|
+
Generated environments also include a local `./moo` shortcut for Doodba-style
|
|
199
|
+
daily commands such as `./moo start`, `./moo restart`, and `./moo stop`.
|
|
200
|
+
|
|
196
201
|
## Defaults
|
|
197
202
|
|
|
198
203
|
Each source repo can contain one or many Odoo modules. For example:
|
package/dist/daily-actions.js
CHANGED
|
@@ -2,9 +2,11 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { access } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { markerPath } from './environment.js';
|
|
5
|
-
export const dailyActionCommands = ['logs', 'restart', 'shell', 'psql', 'install', 'update', 'test'];
|
|
5
|
+
export const dailyActionCommands = ['start', 'stop', 'logs', 'restart', 'shell', 'psql', 'install', 'update', 'test'];
|
|
6
6
|
const dailyActionCommandSet = new Set(dailyActionCommands);
|
|
7
7
|
const scripts = {
|
|
8
|
+
start: 'up.sh',
|
|
9
|
+
stop: 'down.sh',
|
|
8
10
|
logs: 'logs.sh',
|
|
9
11
|
restart: 'restart.sh',
|
|
10
12
|
shell: 'shell.sh',
|
|
@@ -17,6 +19,10 @@ export function isDailyActionCommand(command) {
|
|
|
17
19
|
return dailyActionCommandSet.has(command);
|
|
18
20
|
}
|
|
19
21
|
function usage(command) {
|
|
22
|
+
if (command === 'start')
|
|
23
|
+
return 'Usage: wpmoo start';
|
|
24
|
+
if (command === 'stop')
|
|
25
|
+
return 'Usage: wpmoo stop';
|
|
20
26
|
if (command === 'logs')
|
|
21
27
|
return 'Usage: wpmoo logs [service]';
|
|
22
28
|
if (command === 'restart')
|
|
@@ -66,6 +72,10 @@ function testArgs(argv) {
|
|
|
66
72
|
return argv;
|
|
67
73
|
}
|
|
68
74
|
function scriptArgs(command, argv) {
|
|
75
|
+
if (command === 'start')
|
|
76
|
+
return ensureNoArgs(command, argv);
|
|
77
|
+
if (command === 'stop')
|
|
78
|
+
return ensureNoArgs(command, argv);
|
|
69
79
|
if (command === 'logs')
|
|
70
80
|
return optionalSingleArg(command, argv, 'odoo');
|
|
71
81
|
if (command === 'restart')
|
package/dist/help.js
CHANGED
|
@@ -11,6 +11,8 @@ Usage:
|
|
|
11
11
|
npx @wpmoo/odoo add-module --repo <source-repo> --module <module-name>
|
|
12
12
|
npx @wpmoo/odoo remove-module --repo <source-repo> --module <module-name>
|
|
13
13
|
npx @wpmoo/odoo reset
|
|
14
|
+
npx @wpmoo/odoo start
|
|
15
|
+
npx @wpmoo/odoo stop
|
|
14
16
|
npx @wpmoo/odoo logs [service]
|
|
15
17
|
npx @wpmoo/odoo restart
|
|
16
18
|
npx @wpmoo/odoo shell
|
|
@@ -55,6 +57,7 @@ Options:
|
|
|
55
57
|
Daily actions:
|
|
56
58
|
Daily actions must be run from a generated environment root containing .wpmoo/odoo.json.
|
|
57
59
|
They delegate to the fixed scripts copied from the compose resource under ./scripts.
|
|
60
|
+
Generated environments also include ./moo for Doodba-style local commands such as ./moo start.
|
|
58
61
|
|
|
59
62
|
Example:
|
|
60
63
|
npx @wpmoo/odoo create \\
|
package/dist/templates.js
CHANGED
|
@@ -22,6 +22,7 @@ function repositoryLayout(options) {
|
|
|
22
22
|
├── docker-compose_17.0.yml
|
|
23
23
|
├── docker-compose_18.0.yml
|
|
24
24
|
├── docker-compose_19.0.yml
|
|
25
|
+
├── moo
|
|
25
26
|
├── scripts/
|
|
26
27
|
├── etc/
|
|
27
28
|
├── odoo/
|
|
@@ -100,7 +101,7 @@ function repoDuplicationNote() {
|
|
|
100
101
|
}
|
|
101
102
|
function verificationCommand(options) {
|
|
102
103
|
const firstAddon = allAddons(options)[0] ?? options.product;
|
|
103
|
-
return `./
|
|
104
|
+
return `./moo test ${firstAddon}`;
|
|
104
105
|
}
|
|
105
106
|
function environmentUsageDocs(options) {
|
|
106
107
|
return `## Docker Compose Notes
|
|
@@ -125,16 +126,16 @@ Source repositories stay under \`odoo/custom/src/private\`. At container startup
|
|
|
125
126
|
|
|
126
127
|
\`\`\`bash
|
|
127
128
|
cp .env.example .env
|
|
128
|
-
./
|
|
129
|
-
./
|
|
130
|
-
./
|
|
131
|
-
./
|
|
129
|
+
./moo start
|
|
130
|
+
./moo logs
|
|
131
|
+
./moo shell
|
|
132
|
+
./moo stop
|
|
132
133
|
\`\`\`
|
|
133
134
|
|
|
134
135
|
Run tests for one planned product addon:
|
|
135
136
|
|
|
136
137
|
\`\`\`bash
|
|
137
|
-
./
|
|
138
|
+
./moo test ${allAddons(options)[0] ?? options.product}
|
|
138
139
|
\`\`\`
|
|
139
140
|
`;
|
|
140
141
|
}
|
|
@@ -226,7 +227,146 @@ set -euo pipefail
|
|
|
226
227
|
script_dir="$(cd -- "$(dirname -- "\${BASH_SOURCE[0]}")" && pwd)"
|
|
227
228
|
cd "$script_dir"
|
|
228
229
|
|
|
229
|
-
|
|
230
|
+
usage() {
|
|
231
|
+
case "$1" in
|
|
232
|
+
"start") echo "Usage: ./moo start" ;;
|
|
233
|
+
"stop") echo "Usage: ./moo stop" ;;
|
|
234
|
+
"logs") echo "Usage: ./moo logs [service]" ;;
|
|
235
|
+
"restart") echo "Usage: ./moo restart" ;;
|
|
236
|
+
"shell") echo "Usage: ./moo shell" ;;
|
|
237
|
+
"psql") echo "Usage: ./moo psql [db]" ;;
|
|
238
|
+
"install") echo "Usage: ./moo install <module[,module]> [db]" ;;
|
|
239
|
+
"update") echo "Usage: ./moo update <module[,module]> [db]" ;;
|
|
240
|
+
"test") echo "Usage: ./moo test <module[,module]> [--db <db>] [--mode init|update] [--tags <tags>]" ;;
|
|
241
|
+
esac
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
fail_usage() {
|
|
245
|
+
usage "$1" >&2
|
|
246
|
+
exit 2
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
require_no_args() {
|
|
250
|
+
local command="$1"
|
|
251
|
+
shift
|
|
252
|
+
if [[ "$#" -ne 0 ]]; then
|
|
253
|
+
fail_usage "$command"
|
|
254
|
+
fi
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
optional_single_arg() {
|
|
258
|
+
local command="$1"
|
|
259
|
+
local fallback="$2"
|
|
260
|
+
shift 2
|
|
261
|
+
if [[ "$#" -gt 1 ]]; then
|
|
262
|
+
fail_usage "$command"
|
|
263
|
+
fi
|
|
264
|
+
printf '%s\\n' "\${1:-$fallback}"
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
require_module_args() {
|
|
268
|
+
local command="$1"
|
|
269
|
+
shift
|
|
270
|
+
if [[ "$#" -lt 1 || "\${1:-}" == -* || "$#" -gt 2 ]]; then
|
|
271
|
+
fail_usage "$command"
|
|
272
|
+
fi
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
validate_test_args() {
|
|
276
|
+
if [[ "$#" -lt 1 || "\${1:-}" == -* ]]; then
|
|
277
|
+
fail_usage "test"
|
|
278
|
+
fi
|
|
279
|
+
|
|
280
|
+
shift
|
|
281
|
+
while [[ "$#" -gt 0 ]]; do
|
|
282
|
+
case "$1" in
|
|
283
|
+
"--db"|"--tags")
|
|
284
|
+
if [[ "$#" -lt 2 || "\${2:-}" == --* ]]; then
|
|
285
|
+
echo "Missing value for $1" >&2
|
|
286
|
+
exit 2
|
|
287
|
+
fi
|
|
288
|
+
shift 2
|
|
289
|
+
;;
|
|
290
|
+
"--mode")
|
|
291
|
+
if [[ "$#" -lt 2 || "\${2:-}" == --* ]]; then
|
|
292
|
+
echo "Missing value for --mode" >&2
|
|
293
|
+
exit 2
|
|
294
|
+
fi
|
|
295
|
+
if [[ "$2" != "init" && "$2" != "update" ]]; then
|
|
296
|
+
echo "Invalid value for --mode: expected init or update" >&2
|
|
297
|
+
exit 2
|
|
298
|
+
fi
|
|
299
|
+
shift 2
|
|
300
|
+
;;
|
|
301
|
+
*)
|
|
302
|
+
echo "Unknown option for ./moo test: $1" >&2
|
|
303
|
+
exit 2
|
|
304
|
+
;;
|
|
305
|
+
esac
|
|
306
|
+
done
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
run_script() {
|
|
310
|
+
local script="$1"
|
|
311
|
+
shift
|
|
312
|
+
if [[ ! -x "$script" ]]; then
|
|
313
|
+
echo "Missing daily action script: \${script#./}" >&2
|
|
314
|
+
exit 1
|
|
315
|
+
fi
|
|
316
|
+
exec "$script" "$@"
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
command="\${1:-}"
|
|
320
|
+
case "$command" in
|
|
321
|
+
"start")
|
|
322
|
+
shift
|
|
323
|
+
require_no_args "$command" "$@"
|
|
324
|
+
run_script ./scripts/up.sh
|
|
325
|
+
;;
|
|
326
|
+
"stop")
|
|
327
|
+
shift
|
|
328
|
+
require_no_args "$command" "$@"
|
|
329
|
+
run_script ./scripts/down.sh
|
|
330
|
+
;;
|
|
331
|
+
"logs")
|
|
332
|
+
shift
|
|
333
|
+
service="$(optional_single_arg "$command" "odoo" "$@")"
|
|
334
|
+
run_script ./scripts/logs.sh "$service"
|
|
335
|
+
;;
|
|
336
|
+
"restart")
|
|
337
|
+
shift
|
|
338
|
+
require_no_args "$command" "$@"
|
|
339
|
+
run_script ./scripts/restart.sh
|
|
340
|
+
;;
|
|
341
|
+
"shell")
|
|
342
|
+
shift
|
|
343
|
+
require_no_args "$command" "$@"
|
|
344
|
+
run_script ./scripts/shell.sh
|
|
345
|
+
;;
|
|
346
|
+
"psql")
|
|
347
|
+
shift
|
|
348
|
+
db="$(optional_single_arg "$command" "postgres" "$@")"
|
|
349
|
+
run_script ./scripts/psql.sh "$db"
|
|
350
|
+
;;
|
|
351
|
+
"install")
|
|
352
|
+
shift
|
|
353
|
+
require_module_args "$command" "$@"
|
|
354
|
+
run_script ./scripts/install.sh "$@"
|
|
355
|
+
;;
|
|
356
|
+
"update")
|
|
357
|
+
shift
|
|
358
|
+
require_module_args "$command" "$@"
|
|
359
|
+
run_script ./scripts/update.sh "$@"
|
|
360
|
+
;;
|
|
361
|
+
"test")
|
|
362
|
+
shift
|
|
363
|
+
validate_test_args "$@"
|
|
364
|
+
run_script ./scripts/test.sh "$@"
|
|
365
|
+
;;
|
|
366
|
+
*)
|
|
367
|
+
exec npx --yes @wpmoo/odoo@latest "$@"
|
|
368
|
+
;;
|
|
369
|
+
esac
|
|
230
370
|
`;
|
|
231
371
|
}
|
|
232
372
|
export function renderAddonsYaml(options) {
|
|
@@ -291,16 +431,19 @@ git submodule update --init --recursive
|
|
|
291
431
|
|
|
292
432
|
## WPMoo CLI Shortcut
|
|
293
433
|
|
|
294
|
-
This environment includes a local \`moo\`
|
|
434
|
+
This environment includes a local \`moo\` shortcut script. From the repository
|
|
295
435
|
root:
|
|
296
436
|
|
|
297
437
|
\`\`\`bash
|
|
298
438
|
./moo
|
|
439
|
+
./moo start
|
|
440
|
+
./moo stop
|
|
441
|
+
./moo restart
|
|
299
442
|
./moo add-module
|
|
300
443
|
\`\`\`
|
|
301
444
|
|
|
302
|
-
|
|
303
|
-
anywhere and the script will
|
|
445
|
+
Optionally, if this repository root is on your \`PATH\`, you can run \`moo ...\`
|
|
446
|
+
from anywhere and the script will return to this environment root first.
|
|
304
447
|
${optionalAgentSkillsReadme(options)}
|
|
305
448
|
## Source Repositories
|
|
306
449
|
|