Skip to content

Commit

Permalink
Dix build
Browse files Browse the repository at this point in the history
  • Loading branch information
heathsnee committed Jul 20, 2024
1 parent f6d0267 commit bf2e044
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
3 changes: 2 additions & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"start": "vite --mode development",
"build:dev": "DEV_TOOLS=true yarn build:radix",
"build:radix": "RADIX=true yarn build",
"build": "npm_config_build_from_source=true tsc --build && vite build --mode production",
"build": "yarn radix:fix-types && npm_config_build_from_source=true tsc --build && vite build --mode production",
"build:copy-as-firefox": "node src/helpers/firefox",
"build:release": "yarn build:radix && yarn build:copy-as-firefox",
"preview": "vite preview",
"radix:fix-types": "node src/helpers/radix/fix-types",
"check-types": "tsc --noemit",
"eslint": "eslint --fix --ignore-path .eslintignore --ext .js,.ts,.tsx .",
"lint": "yarn eslint && yarn check-types",
Expand Down
16 changes: 16 additions & 0 deletions apps/extension/src/helpers/radix/fix-types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import fs from 'fs'

const content = fs.readFileSync(
'../../node_modules/@radixdlt/connector-extension/src/chrome/background/create-gateway-module.ts',
'utf8',
)

const newContent = content.replace(
'createGatewayModule = (networkId: number) =>',
'createGatewayModule = (networkId: number): GatewayModule =>',
)

fs.writeFileSync(
'../../node_modules/@radixdlt/connector-extension/src/chrome/background/create-gateway-module.ts',
newContent,
)
16 changes: 7 additions & 9 deletions apps/extension/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,28 @@ const config = {
},
resolve: {
alias: {
stream: 'vite-compatible-readable-stream',
config: resolve(__dirname, 'src/config'),
version: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/version'),
'message-router': resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/message-router'),
chrome: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/chrome'),
components: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/components'),
connector: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/connector'),
options: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/options'),
utils: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/utils'),
chrome: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/chrome'),
// have to replace each crypto/[path] otherwise it will error out due to default crypto import
'crypto/blake2b': resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/crypto/blake2b'),
'crypto/curve25519': resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/crypto/curve25519'),
'crypto/encryption': resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/crypto/encryption'),
'crypto/sealbox': resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/crypto/sealbox'),
'crypto/secp256k1': resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/crypto/secp256k1'),
'crypto/secure-random': resolve(__dirname,'../../node_modules/@radixdlt/connector-extension/src/crypto/secure-random'),
'crypto/get-linking-message': resolve(__dirname,'../../node_modules/@radixdlt/connector-extension/src/crypto/get-linking-message'),
'io-types': resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/io-types'),
ledger: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/ledger'),
pairing: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/pairing'),
options: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/options'),
components: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/components'),
ledger: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/ledger'),
queues: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/queues'),
utils: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/utils'),
'chrome/helpers/add-origin-to-wallet-interaction': resolve(__dirname, 'src/radix/add-origin-to-wallet-interaction'),
'chrome/helpers/chrome-storage-sync': resolve(__dirname, 'src/radix/storage-sync'),
'chrome/helpers/chrome-local-store': resolve(__dirname, 'src/radix/storage-local'),
'chrome/background/create-gateway-module': resolve(__dirname, 'src/radix/create-gateway-module'),
'./create-gateway-module': resolve(__dirname, 'src/radix/create-gateway-module'),
},
},
define: {
Expand Down

0 comments on commit bf2e044

Please sign in to comment.