Skip to content

Commit 0a08f4b

Browse files
authored
Merge pull request #698 from LIT-Protocol/feature/lit-3902-build-publish-pipeline-for-wk-las
feat: build lit actions and update cids when building sdk
2 parents ddb497c + 16a4d33 commit 0a08f4b

File tree

14 files changed

+160
-28
lines changed

14 files changed

+160
-28
lines changed

.nxignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages/wrapped-keys/update-ipfs-cids.js

nx.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
}
1313
},
1414
"targetDefaults": {
15+
"prebuild": {
16+
"dependsOn": ["^prebuild"],
17+
"inputs": ["production", "^production"]
18+
},
1519
"build": {
1620
"dependsOn": ["^build"],
1721
"inputs": ["production", "^production"]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"eslint-plugin-import": "^2.29.1",
112112
"eslint-plugin-jsx-a11y": "6.9.0",
113113
"inquirer": "^9.2.21",
114+
"ipfs-only-hash": "^4.0.0",
114115
"ipfs-unixfs-importer": "12.0.1",
115116
"jest": "27.5.1",
116117
"lerna": "^5.4.3",

packages/wrapped-keys-lit-actions/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
"genReact": false
2525
},
2626
"scripts": {
27-
"generate-lit-actions": "yarn node ./esbuild.config.js"
27+
"prepublishOnly": "yarn generate-lit-actions && yarn publish-lit-actions",
28+
"generate-lit-actions": "yarn node ./esbuild.config.js",
29+
"publish-lit-actions": "yarn node ./sync-actions-to-ipfs"
2830
},
2931
"version": "7.1.0",
3032
"main": "./dist/src/index.js",

packages/wrapped-keys-lit-actions/project.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"sourceRoot": "packages/wrapped-keys-lit-actions/src",
55
"projectType": "library",
66
"targets": {
7-
"build-la": {
8-
"cache": false,
7+
"prebuild": {
98
"executor": "nx:run-commands",
109
"options": {
1110
"commands": [
1211
"yarn --cwd ./packages/wrapped-keys-lit-actions generate-lit-actions"
1312
],
1413
"cwd": "."
15-
}
14+
},
15+
"dependsOn": []
1616
},
1717
"build": {
1818
"cache": false,
@@ -32,7 +32,7 @@
3232
],
3333
"updateBuildableProjectDepsInPackageJson": true
3434
},
35-
"dependsOn": ["build-la", "^build"]
35+
"dependsOn": ["wrapped-keys:build"]
3636
},
3737
"lint": {
3838
"executor": "@nx/linter:eslint",

packages/wrapped-keys/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"buildOptions": {
2424
"genReact": false
2525
},
26+
"scripts": {
27+
"prepare": "yarn update-ipfs-cids",
28+
"update-ipfs-cids": "yarn node ./update-ipfs-cids.js"
29+
},
2630
"version": "7.1.0",
2731
"main": "./dist/src/index.js",
2832
"typings": "./dist/src/index.d.ts"

packages/wrapped-keys/project.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
"sourceRoot": "packages/wrapped-keys/src",
55
"projectType": "library",
66
"targets": {
7+
"prebuild": {
8+
"executor": "nx:run-commands",
9+
"options": {
10+
"commands": ["yarn --cwd ./packages/wrapped-keys update-ipfs-cids"],
11+
"cwd": "."
12+
},
13+
"dependsOn": ["wrapped-keys-lit-actions:prebuild"]
14+
},
715
"build": {
816
"executor": "@nx/js:tsc",
917
"outputs": ["{options.outputPath}"],
@@ -13,7 +21,8 @@
1321
"tsConfig": "packages/wrapped-keys/tsconfig.lib.json",
1422
"assets": ["packages/wrapped-keys/*.md"],
1523
"updateBuildableProjectDepsInPackageJson": true
16-
}
24+
},
25+
"dependsOn": ["prebuild", "^build"]
1726
},
1827
"lint": {
1928
"executor": "@nx/linter:eslint",
Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,39 @@
1+
import * as GENERATED_LIT_ACTION_CID_REPOSITORY_COMMON from './lit-action-cid-repository-common.json';
2+
import * as GENERATED_LIT_ACTION_CID_REPOSITORY from './lit-action-cid-repository.json';
13
import { LitCidRepository, LitCidRepositoryCommon } from './types';
24

3-
const LIT_ACTION_CID_REPOSITORY: LitCidRepository = Object.freeze({
4-
signTransaction: Object.freeze({
5-
evm: 'QmRpAgGKEmgeBRhqdC2EH17QUt6puwsbm8Z2nNneVN4uJG',
6-
solana: 'QmR1nPG2tnmC72zuCEMZUZrrMEkbDiMPNHW45Dsm2n7xnk',
7-
}),
8-
signMessage: Object.freeze({
9-
evm: 'QmXi9iqJvXrHoUGSo5WREonrruDhzQ7cFr7Cry3wX2hmue',
10-
solana: 'QmcEJGVqRYtVukjm2prCPT7Fs66GpaqZwmZoxEHMHor6Jz',
11-
}),
12-
generateEncryptedKey: Object.freeze({
13-
evm: 'QmeD6NYCWhUCLgxgpkgSguaKjwnpCnJ6Yf8SdsyPpK4eKK',
14-
solana: 'QmPkVD3hEjMi1T5zQuvdrFCXaGTEMHNdAhAL4WHkqxijrQ',
15-
}),
16-
exportPrivateKey: Object.freeze({
17-
evm: 'QmUJ74pTUqeeHzDGdfwCph1vJVNJ1rRzJdvMiTjS1BMwYj',
18-
solana: 'QmUJ74pTUqeeHzDGdfwCph1vJVNJ1rRzJdvMiTjS1BMwYj',
19-
}),
5+
function deepFreeze<T extends Record<string, any>>(obj: T): T {
6+
Object.freeze(obj);
7+
for (const key in obj) {
8+
if (key in obj && typeof obj[key] === 'object') {
9+
deepFreeze(obj[key]);
10+
}
11+
}
12+
return obj;
13+
}
14+
15+
const LIT_ACTION_CID_REPOSITORY: LitCidRepository = deepFreeze({
16+
signTransaction: {
17+
evm: GENERATED_LIT_ACTION_CID_REPOSITORY.signTransaction.evm,
18+
solana: GENERATED_LIT_ACTION_CID_REPOSITORY.signTransaction.solana,
19+
},
20+
signMessage: {
21+
evm: GENERATED_LIT_ACTION_CID_REPOSITORY.signMessage.evm,
22+
solana: GENERATED_LIT_ACTION_CID_REPOSITORY.signMessage.solana,
23+
},
24+
generateEncryptedKey: {
25+
evm: GENERATED_LIT_ACTION_CID_REPOSITORY.generateEncryptedKey.evm,
26+
solana: GENERATED_LIT_ACTION_CID_REPOSITORY.generateEncryptedKey.solana,
27+
},
28+
exportPrivateKey: {
29+
evm: GENERATED_LIT_ACTION_CID_REPOSITORY.exportPrivateKey.evm,
30+
solana: GENERATED_LIT_ACTION_CID_REPOSITORY.exportPrivateKey.solana,
31+
},
2032
});
2133

2234
const LIT_ACTION_CID_REPOSITORY_COMMON: LitCidRepositoryCommon = Object.freeze({
23-
batchGenerateEncryptedKeys: 'QmR8Zs7ctSEctxBrSnAYhMXFXCC1ub8K1xvMn5Js3NCSAA',
35+
batchGenerateEncryptedKeys:
36+
GENERATED_LIT_ACTION_CID_REPOSITORY_COMMON.batchGenerateEncryptedKeys,
2437
});
2538

2639
export { LIT_ACTION_CID_REPOSITORY, LIT_ACTION_CID_REPOSITORY_COMMON };
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"batchGenerateEncryptedKeys": "QmQB1uSKwuzUWHiAgaGtTf3rFZf42AJWN1XKJSNNPuxKhB"
3+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"signTransaction": {
3+
"evm": "QmYTEJyniRRkTxe3D9mmkURXCFBAXWK7TEGk5LxvWSETWn",
4+
"solana": "QmWUozjthkrjEBGkkEvGTvCaxCaiPMTke6FUpiwhn28k8Z"
5+
},
6+
"signMessage": {
7+
"evm": "Qmdm4mGn6A8RmqeiDgRPXFt2yYEKCUMUVimSb5iPJfs31e",
8+
"solana": "QmS4Y6f2zHriNzioxBbysbuXQbjX7ga468CCyYcuY2AeeH"
9+
},
10+
"generateEncryptedKey": {
11+
"evm": "QmfW6g5PJ8SVS56XwDVC5W4gcUnobEempNkR28bj2g99tk",
12+
"solana": "QmWYcBCZqFmJJzsRfzVRHbPD5Hvuou45sbXPQcQzLbUgKd"
13+
},
14+
"exportPrivateKey": {
15+
"evm": "QmfZ8hYEmNFwHraNieSz25dAp65YBoNjAMC2tXm9oaQCt6",
16+
"solana": "QmfZ8hYEmNFwHraNieSz25dAp65YBoNjAMC2tXm9oaQCt6"
17+
}
18+
}

0 commit comments

Comments
 (0)