@wpmoo/odoo 0.8.65 → 0.8.67

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.
@@ -1,4 +1,4 @@
1
- import { cp, mkdir, mkdtemp, rm, stat, writeFile } from 'node:fs/promises';
1
+ import { cp, mkdir, mkdtemp, readdir, rm, stat, writeFile } from 'node:fs/promises';
2
2
  import { tmpdir } from 'node:os';
3
3
  import { dirname, join, relative, resolve } from 'node:path';
4
4
  import { realGit } from './git.js';
@@ -12,6 +12,14 @@ async function pathExists(path) {
12
12
  return false;
13
13
  }
14
14
  }
15
+ async function statIfExists(path) {
16
+ try {
17
+ return await stat(path);
18
+ }
19
+ catch {
20
+ return undefined;
21
+ }
22
+ }
15
23
  function expandHome(path) {
16
24
  if (path === '~')
17
25
  return process.env.HOME ?? path;
@@ -61,6 +69,25 @@ function isExcluded(relativePath, excludes) {
61
69
  const normalized = relativePath.split('\\').join('/');
62
70
  return excludes.some((pattern) => normalized === pattern || normalized.startsWith(`${pattern}/`));
63
71
  }
72
+ async function removeDestinationTypeConflicts(sourcePath, destinationPath, excludes) {
73
+ async function visit(source) {
74
+ const rel = relative(sourcePath, source);
75
+ if (rel && isExcluded(rel, excludes))
76
+ return;
77
+ const sourceStat = await stat(source);
78
+ const destination = rel ? join(destinationPath, rel) : destinationPath;
79
+ const destinationStat = await statIfExists(destination);
80
+ if (destinationStat && sourceStat.isDirectory() !== destinationStat.isDirectory()) {
81
+ await rm(destination, { recursive: true, force: true });
82
+ }
83
+ if (!sourceStat.isDirectory()) {
84
+ return;
85
+ }
86
+ const entries = await readdir(source);
87
+ await Promise.all(entries.map((entry) => visit(join(source, entry))));
88
+ }
89
+ await visit(sourcePath);
90
+ }
64
91
  async function copyDirectory(options, checkedOut) {
65
92
  const selectedSourceSubdir = await selectSourceSubdir(options, checkedOut.root);
66
93
  const sourcePath = selectedSourceSubdir ? join(checkedOut.root, selectedSourceSubdir) : checkedOut.root;
@@ -72,6 +99,7 @@ async function copyDirectory(options, checkedOut) {
72
99
  }
73
100
  const excludes = [...defaultExcludes, ...(options.exclude ?? [])];
74
101
  await mkdir(destinationPath, { recursive: true });
102
+ await removeDestinationTypeConflicts(sourcePath, destinationPath, excludes);
75
103
  await cp(sourcePath, destinationPath, {
76
104
  recursive: true,
77
105
  force: true,
package/dist/templates.js CHANGED
@@ -1,3 +1,7 @@
1
+ import { packageName, packageVersion } from './version.js';
2
+ function fallbackPackageSpec() {
3
+ return `${packageName()}@${packageVersion()}`;
4
+ }
1
5
  export function defaultCommunityAddons(product) {
2
6
  return [product];
3
7
  }
@@ -218,7 +222,7 @@ exposes them through \`/mnt/wpmoo-addons\`.
218
222
  \`./moo\` routes day-to-day service and module workflows to local scripts in
219
223
  \`./scripts/\` (for example \`start\`, \`logs\`, \`update\`, \`test\`, \`snapshot\`).
220
224
  \`./moo status\` and \`./moo doctor\` are package fallback commands that run via
221
- \`npx --yes @wpmoo/odoo@latest ...\`.
225
+ \`npx --yes ${fallbackPackageSpec()} ...\`.
222
226
 
223
227
  ### Start And Inspect Services
224
228
 
@@ -547,7 +551,7 @@ case "$command" in
547
551
  run_script ./scripts/pot.sh "$@"
548
552
  ;;
549
553
  *)
550
- exec npx --yes @wpmoo/odoo@latest "$@"
554
+ exec npx --yes ${fallbackPackageSpec()} "$@"
551
555
  ;;
552
556
  esac
553
557
  `;
@@ -705,7 +709,7 @@ Useful maintenance commands:
705
709
 
706
710
  Daily script delegation vs package fallback:
707
711
  - \`./moo start\`, \`logs\`, \`install\`, \`update\`, \`test\`, \`snapshot\`, and related runtime tasks delegate to local \`./scripts/*.sh\`.
708
- - \`./moo status\` and \`./moo doctor\` are package fallback commands routed to \`npx --yes @wpmoo/odoo@latest ...\`.
712
+ - \`./moo status\` and \`./moo doctor\` are package fallback commands routed to \`npx --yes ${fallbackPackageSpec()} ...\`.
709
713
 
710
714
  Only report completion after the relevant update/test/lint command exits cleanly.
711
715
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpmoo/odoo",
3
- "version": "0.8.65",
3
+ "version": "0.8.67",
4
4
  "description": "WPMoo Odoo lifecycle tooling for development, staging, and production workflows.",
5
5
  "type": "module",
6
6
  "repository": {