Skip to content

Commit 7345544

Browse files
committed
chore(package.json): update build scripts and update generate-abi-signatures script to be inside a shared directory
1 parent 61fe370 commit 7345544

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"scripts": {
66
"reset": "bun unlink-all && rimraf dist node_modules doc tmp yarn-error.log yarn.lock package-lock.json bun.lockb learn-debug.log tmp .nx lit-auth-storage pkp-tokens lit-auth-local ./e2e/dist ./e2e/node_modules",
77
"go": "bun run build && bun link-all",
8-
"build": "bun unlink-all && bun scripts/auto-fix-deps.mjs && nx run-many --parallel=false --target=build --all --exclude=wrapped-keys,wrapped-keys-lit-actions && bun run prettier",
9-
"build:affected": "bun scripts/auto-fix-deps.mjs && nx affected --target=build --exclude=wrapped-keys,wrapped-keys-lit-actions",
8+
"build": "bun unlink-all && nx run-many --parallel=false --target=build --all --exclude=wrapped-keys,wrapped-keys-lit-actions && bun run prettier",
9+
"build:affected": "nx affected --target=build --exclude=wrapped-keys,wrapped-keys-lit-actions",
1010
"auto-fix-deps": "bun scripts/auto-fix-deps.mjs",
1111
"check-deps": "npx nx run-many --target=check-deps --exclude=wrapped-keys,wrapped-keys-lit-actions",
1212
"validate": "npm run check-deps && npm run build",
@@ -16,7 +16,7 @@
1616
"show:affected": "npx nx show projects --affected --uncommitted",
1717
"build:tinny": "node ./local-tests/build.mjs",
1818
"publish:tinny": "cd ./local-tests && npm publish",
19-
"gen:local-network-context": "bun run packages/networks/src/networks/vNaga/envs/naga-local/scripts/00-generate-abi-signatures.ts",
19+
"gen:local-network-context": "NETWORK_NAME=naga-develop DIRECTORY_NAME=naga-local bun run packages/networks/src/networks/vNaga/shared/scripts/generate-abi-signatures.ts",
2020
"gen:docs": "node ./tools/scripts/gen-doc.mjs",
2121
"gen:readme": "node ./tools/scripts/gen-readme.mjs",
2222
"prettier": "npx nx format:write --all",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Command: NETWORK_CONFIG=<path-to-lit-assets>/lit-assets/blockchain/contracts/networkContext.json bun run gen:local-network-context
2+
3+
import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures';
4+
5+
const NETWORK_CONFIG = process.env['NETWORK_CONFIG'] as string;
6+
const NETWORK_NAME = process.env['NETWORK_NAME'] as string;
7+
const DIRECTORY_NAME = process.env['DIRECTORY_NAME'] as string;
8+
9+
if (!NETWORK_CONFIG) {
10+
throw new Error(
11+
'❌ NETWORK_CONFIG is not set. Please set it in your .env file. This is where your locally generated networkContext.json is located, usually in ./lit-assets/blockchain/contracts/networkContext.json.'
12+
);
13+
}
14+
15+
if (!NETWORK_NAME) {
16+
throw new Error(
17+
'❌ NETWORK_NAME is not set. Please set it in your .env file. Usually it is `naga-develop` for local development.'
18+
);
19+
}
20+
21+
if (!DIRECTORY_NAME) {
22+
throw new Error(
23+
'❌ DIRECTORY_NAME is not set. Please set it in your .env file. Usually this is inside the ./env directory inside your network (eg. vNaga) directory.'
24+
);
25+
}
26+
27+
console.log('✅ NETWORK_CONFIG:', NETWORK_CONFIG);
28+
console.log('✅ NETWORK_NAME:', NETWORK_NAME);
29+
console.log('✅ DIRECTORY_NAME:', DIRECTORY_NAME);
30+
31+
async function main() {
32+
await generateSignaturesFromContext({
33+
jsonFilePath: NETWORK_CONFIG,
34+
networkName: NETWORK_NAME,
35+
outputDir: `../../envs/${DIRECTORY_NAME}/generated`,
36+
useScriptDirectory: true,
37+
38+
// @ts-ignore
39+
callerPath: import.meta.url,
40+
});
41+
}
42+
43+
// gogogo!
44+
main().catch(console.error);

0 commit comments

Comments
 (0)