@novacraft-engineering/pulsar-cli 1.2.3 → 1.2.4

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/pulsar.js +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novacraft-engineering/pulsar-cli",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Pulsar OTA release CLI — bundle, hash, and ship React Native updates over-the-air.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,7 +26,7 @@
26
26
  "node": ">=18"
27
27
  },
28
28
  "scripts": {
29
- "test": "node test/hash.test.js && node test/security.test.js && node test/signing.test.js"
29
+ "test": "node test/hash.test.js && node test/security.test.js && node test/signing.test.js && node test/entry.test.js"
30
30
  },
31
31
  "keywords": [
32
32
  "cli",
package/pulsar.js CHANGED
@@ -6,6 +6,7 @@ import readline from 'node:readline';
6
6
  import http from 'node:http';
7
7
  import {execFileSync} from 'node:child_process';
8
8
  import crypto from 'node:crypto';
9
+ import {fileURLToPath} from 'node:url';
9
10
  import {computePackageHash, fileHashes} from './hash.js';
10
11
 
11
12
  // Code signing: sign the package hash into an RS256 JWT the client verifies against its
@@ -614,7 +615,16 @@ async function cmdKeys(args) {
614
615
  export {saveConfig, browserLogin, signCodePushJWT, SIGNATURE_PATH};
615
616
 
616
617
  // Only dispatch when run as the CLI — importing the module (e.g. from tests) must not execute a command.
617
- if (import.meta.url === `file://${process.argv[1]}`) {
618
+ // Compare real paths: a global install runs through a bin symlink, so argv[1] is not this file's path.
619
+ function invokedAsCli() {
620
+ try {
621
+ return Boolean(process.argv[1]) && fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
622
+ } catch {
623
+ return false;
624
+ }
625
+ }
626
+
627
+ if (invokedAsCli()) {
618
628
  const [command, ...rest] = process.argv.slice(2);
619
629
  const commands = {
620
630
  login: cmdLogin,