From 6191d0c5660a98dc10899b6028970ff6626f3044 Mon Sep 17 00:00:00 2001 From: Kami Date: Mon, 25 Nov 2024 08:36:39 +0330 Subject: [PATCH] fix: add set data path --- package.json | 2 ++ packages/dapp/package.json | 6 ++-- packages/dapp/pro package.json | 57 ---------------------------------- packages/dapp/setDappPath.js | 9 ++++++ scripts/publish.sh | 2 +- yarn.lock | 50 ++++++++++++++--------------- 6 files changed, 41 insertions(+), 85 deletions(-) delete mode 100644 packages/dapp/pro package.json create mode 100644 packages/dapp/setDappPath.js diff --git a/package.json b/package.json index 070f2d5..863b120 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "packages/*" ], "scripts": { + "dev": "cd packages/dapp && yarn dev && cd ../.. && yarn install", + "preinstall": "cd packages/dapp && yarn preinstall", "build": "yarn workspaces foreach --parallel --topological --verbose run build", "install-chrome": "./scripts/install-chrome.sh", "lint": "yarn lint:eslint && yarn lint:misc --check", diff --git a/packages/dapp/package.json b/packages/dapp/package.json index 206b7f7..714e682 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -14,7 +14,7 @@ "@polkadot/api-derive": "^12.1.1", "@polkadot/apps-config": "^0.141.1", "@polkadot/extension-inject": "^0.48.2", - "@polkagate/extension-dapp": "../../../polkadot-js-extension/packages/extension-dapp/build", + "@polkagate/extension-dapp": "^0.48.2", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -30,6 +30,8 @@ "web-vitals": "^2.1.4" }, "scripts": { + "preinstall": "NODE_ENV=production node ./setDappPath.js", + "dev": "NODE_ENV=development node ./setDappPath.js ", "start": "PORT=8000 react-scripts start", "build": "react-scripts build", "test": "react-scripts test", @@ -54,4 +56,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file diff --git a/packages/dapp/pro package.json b/packages/dapp/pro package.json deleted file mode 100644 index 26deafa..0000000 --- a/packages/dapp/pro package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "polkamask_dapp", - "version": "0.1.0", - "private": true, - "dependencies": { - "@emotion/react": "^11.11.3", - "@emotion/styled": "^11.11.0", - "@metamask/detect-provider": "^2.0.0", - "@metamask/providers": "^14.0.2", - "@mui/icons-material": "^5.15.4", - "@mui/lab": "^5.0.0-alpha.160", - "@mui/material": "^5.15.4", - "@polkadot/api": "^12.1.1", - "@polkadot/api-derive": "^12.1.1", - "@polkadot/apps-config": "^0.141.1", - "@polkadot/extension-inject": "^0.48.2", - "@polkagate/extension-dapp": "^0.48.2", - "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^13.4.0", - "@testing-library/user-event": "^13.5.0", - "@types/jest": "^27.5.2", - "@types/node": "^16.18.66", - "@types/react": "^18.2.40", - "@types/react-dom": "^18.2.17", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-i18next": "^14.0.0", - "react-scripts": "5.0.1", - "typescript": "^4.9.5", - "web-vitals": "^2.1.4" - }, - "scripts": { - "start": "PORT=8000 react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject", - "clean": "yarn cache clean --all" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - } -} diff --git a/packages/dapp/setDappPath.js b/packages/dapp/setDappPath.js new file mode 100644 index 0000000..7451b20 --- /dev/null +++ b/packages/dapp/setDappPath.js @@ -0,0 +1,9 @@ +const fs = require('fs'); +const packageJson = require('./package.json'); + +const isProduction = process.env.NODE_ENV === 'production'; +packageJson.dependencies['@polkagate/extension-dapp'] = isProduction + ? '^0.48.2' + : '../../../polkadot-js-extension/packages/extension-dapp/build'; + +fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2)); \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 62d92a7..1340223 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -13,7 +13,7 @@ cd packages/snap/ # $1: patch | minor | major (passed as an argument) npm version "$1" -# Step 4-1: Apply version in snao,manifest,json and update the shasum +# Step 4-1: Apply version in snap,manifest,json and update the shasum yarn yarn build diff --git a/yarn.lock b/yarn.lock index 894007e..a6521c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6715,12 +6715,12 @@ __metadata: linkType: hard "@polkadot/x-bigint@npm:^13.0.2": - version: 13.2.2 - resolution: "@polkadot/x-bigint@npm:13.2.2" + version: 13.2.3 + resolution: "@polkadot/x-bigint@npm:13.2.3" dependencies: - "@polkadot/x-global": 13.2.2 + "@polkadot/x-global": 13.2.3 tslib: ^2.8.0 - checksum: 983001a8b12ed3f4f226c7a58726fcb762c6bc93c451892fb8a998e6c22057cf6f35d909cd5435ca0baddebcdc389f0adae1f3106a5190b602e9d426eaaed884 + checksum: 7d4708159e2066ccb96569994ee7dd3b621b1b786be2489e390efd05163b54489097ad31b08826c67c52a171fc9ccb27939c181b13ba674c2ff854ef4d1dffd6 languageName: node linkType: hard @@ -6748,13 +6748,13 @@ __metadata: linkType: hard "@polkadot/x-fetch@npm:^13.0.2": - version: 13.2.2 - resolution: "@polkadot/x-fetch@npm:13.2.2" + version: 13.2.3 + resolution: "@polkadot/x-fetch@npm:13.2.3" dependencies: - "@polkadot/x-global": 13.2.2 + "@polkadot/x-global": 13.2.3 node-fetch: ^3.3.2 tslib: ^2.8.0 - checksum: 53d3e279cae86fe0b5ef929049fbec85b40c13e8c8de1601e68bd036090085e3edc964cf2cc1d7a9022ca4e15e6353b905b32d95d8b8ba760278de2e52fee67a + checksum: 5c13a22f0f98d2dcb1c7fe408fd931ad01af5106fdbf08e8724e1845be7bb28094389e25207baaa477b056736daeda44eb306a507b208978873ae958b567fee5 languageName: node linkType: hard @@ -6797,12 +6797,12 @@ __metadata: languageName: node linkType: hard -"@polkadot/x-global@npm:13.2.2, @polkadot/x-global@npm:^13.0.2": - version: 13.2.2 - resolution: "@polkadot/x-global@npm:13.2.2" +"@polkadot/x-global@npm:13.2.3, @polkadot/x-global@npm:^13.0.2": + version: 13.2.3 + resolution: "@polkadot/x-global@npm:13.2.3" dependencies: tslib: ^2.8.0 - checksum: e779b89dc9aa2fcb56d82b7f98bf213abca90c0176c9e1c40931c3c98f5a4a95ceebc826024f479a897ac408323ed8de71735b2f5513a98a0c50afacbd48d9cb + checksum: 52098fe8f677c61832e8e015c0fb0efad567be11f1373af8fa746bb835efd67c2f6efad2971cf626d66fbaa5b178dc30540aea7403ee0bd94d80dfe2df399a85 languageName: node linkType: hard @@ -7053,13 +7053,13 @@ __metadata: linkType: hard "@polkadot/x-ws@npm:^13.0.2": - version: 13.2.2 - resolution: "@polkadot/x-ws@npm:13.2.2" + version: 13.2.3 + resolution: "@polkadot/x-ws@npm:13.2.3" dependencies: - "@polkadot/x-global": 13.2.2 + "@polkadot/x-global": 13.2.3 tslib: ^2.8.0 ws: ^8.18.0 - checksum: b488d524ae12ff19d7bab28a5cbc8e58a0cfe44dc829f7d3bdc949936af566f2737500d3c0cd33e8434d5b389d26670ed0c856a3eb5dd3df3f5bd193e2396b2a + checksum: fffec50094367cac54640d32490ffcf19f791c9445476ddda59b9aecdc13dc3deda7414c16a608c5d23673d8491d56ccc65f19784511b9ebcd2f4451eda87153 languageName: node linkType: hard @@ -7680,9 +7680,9 @@ __metadata: linkType: hard "@substrate/connect-known-chains@npm:^1.1.5": - version: 1.6.0 - resolution: "@substrate/connect-known-chains@npm:1.6.0" - checksum: f4cc6eac1f8ec59654394823b87b9433320cb11a555f9036e6beda6cd4c94ff6861fc552bc442517a8f6cfc2046caeb8465a8e62adca47870f9722581bb4b3eb + version: 1.7.0 + resolution: "@substrate/connect-known-chains@npm:1.7.0" + checksum: deb958c6fc6d6d21d5294860184c4493a416016384951c9aa5fb30a488d87eca604f26230362f0b22bcf263aeb721570fe5f099af33a150031b089a13422e564 languageName: node linkType: hard @@ -18490,13 +18490,13 @@ __metadata: linkType: hard "nock@npm:^13.5.4": - version: 13.5.5 - resolution: "nock@npm:13.5.5" + version: 13.5.6 + resolution: "nock@npm:13.5.6" dependencies: debug: ^4.1.0 json-stringify-safe: ^5.0.1 propagate: ^2.0.0 - checksum: 91947b683992096a694140714323f11493b8ad9961c172e3e574c4801131fea259755e95c48e7e01527c14209967c20f151ff03b6bf6700471f0f76fa4071d32 + checksum: 82d31ef7a428e8a6bc430b2772745ecb1f9c8835170789bbcc29c9036614adf3b7112daeb6d59edd93f4340a9a96acee401021572d469a7a0e09a669679f2794 languageName: node linkType: hard @@ -23399,9 +23399,9 @@ __metadata: linkType: hard "tslib@npm:^2.6.3, tslib@npm:^2.8.0": - version: 2.8.0 - resolution: "tslib@npm:2.8.0" - checksum: de852ecd81adfdb4870927e250763345f07dc13fe7f395ce261424966bb122a0992ad844c3ec875c9e63e72afe2220a150712984e44dfd1a8a7e538a064e3d46 + version: 2.8.1 + resolution: "tslib@npm:2.8.1" + checksum: e4aba30e632b8c8902b47587fd13345e2827fa639e7c3121074d5ee0880723282411a8838f830b55100cbe4517672f84a2472667d355b81e8af165a55dc6203a languageName: node linkType: hard