Skip to content

Commit 123ab63

Browse files
committed
fix(wrapped-keys-lit-actions): sync script
1 parent 1cd03ad commit 123ab63

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

packages/wrapped-keys-lit-actions/sync-actions-to-ipfs.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
1+
const path = require('path');
12
const axios = require('axios');
23
const FormData = require('form-data');
34

5+
function loadLitActionExports() {
6+
const candidates = [
7+
path.resolve(
8+
__dirname,
9+
'../../dist/packages/wrapped-keys-lit-actions/src/index.js'
10+
),
11+
path.resolve(
12+
__dirname,
13+
'../../dist/out-tsc/packages/wrapped-keys-lit-actions/src/index.js'
14+
),
15+
];
16+
17+
for (const candidate of candidates) {
18+
try {
19+
return require(candidate);
20+
} catch (error) {
21+
if (error.code !== 'MODULE_NOT_FOUND') {
22+
throw error;
23+
}
24+
}
25+
}
26+
27+
throw new Error(
28+
'Unable to locate built Lit action exports. Please build the package first (e.g. `pnpm nx build wrapped-keys-lit-actions`).'
29+
);
30+
}
31+
432
const {
533
litActionRepository,
634
litActionRepositoryCommon,
7-
} = require('./dist/src/index');
35+
} = loadLitActionExports();
836

937
/** Usage:
1038
* 1. Ensure you have a valid Pinata IPFS JWT in `LIT_IPFS_JWT` env var

0 commit comments

Comments
 (0)