@amaster.ai/runtime-cli 1.1.11 → 1.1.13-beta.0

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.cjs CHANGED
@@ -4,6 +4,7 @@
4
4
  var fs = require('fs');
5
5
  var path = require('path');
6
6
  var os = require('os');
7
+ var url = require('url');
7
8
  var commander = require('commander');
8
9
  var chalk3 = require('chalk');
9
10
  var client = require('@amaster.ai/client');
@@ -3191,8 +3192,17 @@ s3Cmd.command("metadata <key>").description("Get file metadata").option("--app <
3191
3192
  format: options.format
3192
3193
  });
3193
3194
  });
3194
- var isMainModule = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)) === new URL(process.argv[1] || "", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href))).href || (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)).endsWith(process.argv[1] || "") || process.argv[1]?.includes("cli.js") || false;
3195
- if (isMainModule) {
3195
+ function isDirectCliExecution(entryArg = process.argv[1]) {
3196
+ if (!entryArg) {
3197
+ return false;
3198
+ }
3199
+ try {
3200
+ return fs.realpathSync(entryArg) === fs.realpathSync(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href))));
3201
+ } catch {
3202
+ return false;
3203
+ }
3204
+ }
3205
+ if (isDirectCliExecution()) {
3196
3206
  program.parseAsync(process.argv).then(
3197
3207
  () => process.exit(0),
3198
3208
  (err) => {
@@ -3203,6 +3213,7 @@ if (isMainModule) {
3203
3213
  }
3204
3214
 
3205
3215
  exports.createAmasterClient = createAmasterClient;
3216
+ exports.isDirectCliExecution = isDirectCliExecution;
3206
3217
  exports.resolveAppCode = resolveAppCode;
3207
3218
  //# sourceMappingURL=cli.cjs.map
3208
3219
  //# sourceMappingURL=cli.cjs.map