Added script to patch old vuex package

This commit is contained in:
Tornado Contrib 2024-05-06 15:52:06 +00:00
parent bf3d37dad6
commit 1221aad973
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
2 changed files with 28 additions and 3 deletions

@ -7,10 +7,11 @@
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .", "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "yarn lint", "precommit": "yarn lint",
"test": "jest", "test": "jest",
"fix:vuex": "node ./scripts/vuex.js",
"dev": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt", "dev": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt",
"dev:lts": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt", "dev:lts": "yarn fix:vuex && cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt",
"build": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt build", "build": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt build",
"build:lts": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt build", "build:lts": "yarn fix:vuex && cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt build",
"start": "nuxt start", "start": "nuxt start",
"update:zip": "node -r esm scripts/updateZip.js", "update:zip": "node -r esm scripts/updateZip.js",
"update:events": "node -r esm scripts/updateEvents.js --network", "update:events": "node -r esm scripts/updateEvents.js --network",
@ -18,7 +19,7 @@
"update:tree": "node -r esm scripts/updateTree.js --network", "update:tree": "node -r esm scripts/updateTree.js --network",
"update:copy": "node -r esm scripts/copyFile.js dist/404.html dist/ipfs-404.html", "update:copy": "node -r esm scripts/copyFile.js dist/404.html dist/ipfs-404.html",
"generate": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt generate && yarn update:copy", "generate": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" nuxt generate && yarn update:copy",
"generate:lts": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt generate && yarn update:copy", "generate:lts": "yarn fix:vuex && cross-env NODE_OPTIONS=\"--max_old_space_size=8192 --openssl-legacy-provider\" nuxt generate && yarn update:copy",
"check:sync": "node -r esm scripts/checkEventsSync.js", "check:sync": "node -r esm scripts/checkEventsSync.js",
"ipfsUpload": "node scripts/ipfsUpload.js", "ipfsUpload": "node scripts/ipfsUpload.js",
"deploy:ipfs": "yarn generate && yarn ipfsUpload" "deploy:ipfs": "yarn generate && yarn ipfsUpload"

24
scripts/vuex.js Normal file

@ -0,0 +1,24 @@
/**
* Manually patch vuex to support Node.js >= 18.x
*
* See issue https://github.com/vuejs/vuex/issues/2160
* https://github.com/vuejs/vuex/commit/397e9fba45c8b4ec0c4a33d2578e34829bd348d7
*/
const fs = require('fs')
const pkgJson = JSON.parse(fs.readFileSync('./node_modules/vuex/package.json', { encoding: 'utf8' }))
const backupJson = JSON.stringify(pkgJson, null, 2)
let changes = false
if (!pkgJson.exports['./*']) {
pkgJson.exports['./*'] = './*'
changes = true
}
if (changes) {
fs.writeFileSync('./node_modules/vuex/package.backup.json', backupJson + '\n')
fs.writeFileSync('./node_modules/vuex/package.json', JSON.stringify(pkgJson, null, 2) + '\n')
}