@wpmoo/odoo 0.8.46 → 0.8.47
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/dist/cli.js +15 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { confirm, intro, isCancel, note, outro, select, text } from '@clack/prompts';
|
|
3
|
+
import { realpathSync } from 'node:fs';
|
|
3
4
|
import { resolve } from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
6
|
import { commandFromArgs, defaultTargetForProduct, isHelpRequested, isVersionRequested, optionsFromArgs, parseArgs, stripInternalFlags, } from './args.js';
|
|
6
7
|
import { detectDevelopmentEnvironment } from './environment.js';
|
|
7
8
|
import { commandOdooVersion } from './environment-version.js';
|
|
@@ -723,7 +724,19 @@ export async function runCli(cliArgv = process.argv.slice(2), cwd = process.cwd(
|
|
|
723
724
|
}
|
|
724
725
|
outro(`Created Odoo dev overlay in ${resolvedOptions.target}. Review staged changes, then commit.`);
|
|
725
726
|
}
|
|
726
|
-
|
|
727
|
+
export function isCliEntrypoint(metaUrl, argvPath = process.argv[1]) {
|
|
728
|
+
if (!argvPath)
|
|
729
|
+
return false;
|
|
730
|
+
try {
|
|
731
|
+
const entrypointUrl = pathToFileURL(realpathSync(fileURLToPath(metaUrl))).href;
|
|
732
|
+
const argvUrl = pathToFileURL(realpathSync(argvPath)).href;
|
|
733
|
+
return entrypointUrl === argvUrl;
|
|
734
|
+
}
|
|
735
|
+
catch {
|
|
736
|
+
return metaUrl === pathToFileURL(argvPath).href;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
if (isCliEntrypoint(import.meta.url)) {
|
|
727
740
|
runCli().catch((error) => {
|
|
728
741
|
const message = error instanceof Error ? error.message : String(error);
|
|
729
742
|
console.error(message);
|