Skip to content

Commit 82b0cbd

Browse files
committed
fix(e2e): resolve CLI entry from package.json instead of hardcoded lib/index.js
CLI refactored in ebd5a45 moved command dispatch from index.ts to bin.ts, but e2e script still pointed at lib/index.js which only re-exports. pushy bundle exited with code 0 without producing .ppk files. Read the bin field from the CLI's package.json for forward-compatibility.
1 parent 7df1727 commit 82b0cbd

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

Example/e2etest/scripts/prepare-local-update-artifacts.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ function resolveCliRoot() {
4141
].filter(Boolean) as string[];
4242

4343
for (const candidate of candidates) {
44-
const cliEntry = path.join(candidate, 'lib/index.js');
45-
if (fs.existsSync(cliEntry)) {
44+
if (fs.existsSync(path.join(candidate, 'package.json'))) {
4645
return candidate;
4746
}
4847
}
@@ -53,7 +52,19 @@ function resolveCliRoot() {
5352
}
5453

5554
const cliRoot = resolveCliRoot();
56-
const cliEntry = path.join(cliRoot, 'lib/index.js');
55+
const cliPkg = JSON.parse(
56+
fs.readFileSync(path.join(cliRoot, 'package.json'), 'utf8'),
57+
);
58+
const binRelative =
59+
typeof cliPkg.bin === 'string'
60+
? cliPkg.bin
61+
: cliPkg.bin?.pushy ?? Object.values(cliPkg.bin ?? {})[0];
62+
if (!binRelative) {
63+
throw new Error(
64+
`react-native-update-cli package.json has no bin entry. Tried: ${cliRoot}`,
65+
);
66+
}
67+
const cliEntry = path.join(cliRoot, binRelative);
5768
const { diffCommands } = require(path.join(cliRoot, 'lib/diff.js')) as {
5869
diffCommands: DiffCommandRunner;
5970
};

0 commit comments

Comments
 (0)