Browse Source

chore(gui-v2): update nuxt package after install to work with hash based routing

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3375/head
Pranav C 2 years ago
parent
commit
cfd57fd47f
  1. 1
      packages/nc-gui-v2/package-lock.json
  2. 3
      packages/nc-gui-v2/package.json
  3. 20
      packages/nc-gui-v2/scripts/updateNuxtRouting.js

1
packages/nc-gui-v2/package-lock.json generated

@ -4,6 +4,7 @@
"requires": true,
"packages": {
"": {
"hasInstallScript": true,
"dependencies": {
"@ckpack/vue-color": "^1.2.0",
"@vuelidate/core": "^2.0.0-alpha.44",

3
packages/nc-gui-v2/package.json

@ -10,7 +10,8 @@
"test:ui": "vitest -c test/vite.config.ts --ui",
"coverage": "vitest -c test/vite.config.ts run --coverage",
"build:copy": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/",
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/; npm publish ../nc-lib-gui-v2"
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/; npm publish ../nc-lib-gui-v2",
"postinstall": "node scripts/updateNuxtRouting.js"
},
"dependencies": {
"@ckpack/vue-color": "^1.2.0",

20
packages/nc-gui-v2/scripts/updateNuxtRouting.js

@ -0,0 +1,20 @@
/** A temporary solution to enable hash based routing until
* nuxt-team merges - https://github.com/nuxt/framework/pull/6980
*/
const fs = require('fs')
const path = require('path')
const filePath = path.join(__dirname, '..', 'node_modules', 'nuxt', 'dist', 'pages', 'runtime', 'router.mjs')
/** Read file content to be updated */
const content = fs.readFileSync(filePath, 'utf8')
/** Replace `createWebHistory` with `createWebHashHistory` */
const updatedContent = content.replace(
/createWebHistory(\s*,\s*)createMemoryHistory/,
`createWebHashHistory as createWebHistory$1createMemoryHistory`,
)
/** Update file content with updated code */
fs.writeFileSync(filePath, updatedContent, 'utf8')
Loading…
Cancel
Save