Skip to content

Instantly share code, notes, and snippets.

@MiKolka7
Last active November 17, 2019 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MiKolka7/05780ab9d4a5f7fb3f448d40b2a6738f to your computer and use it in GitHub Desktop.
Save MiKolka7/05780ab9d4a5f7fb3f448d40b2a6738f to your computer and use it in GitHub Desktop.
const fs = require('fs')
const pathVuex = './node_modules/vuex/types/index.d.ts'
const pathVue = './node_modules/vuex/types/vue.d.ts'
function exitIfErr(err) {
if (err) {
process.exit(1)
}
}
fs.readFile(pathVuex, 'utf8', (err, data) => {
exitIfErr(err)
const res = data
.replace(/(\(type: string, payload\?: any, options\?)/g, '// $1')
.replace(/(<P extends Payload>\(payloadWithType: P)/g, '// $1')
fs.writeFile(pathVuex, res, exitIfErr)
})
fs.readFile(pathVue, 'utf8', (err, data) => {
exitIfErr(err)
const res = data.replace(/(\$store: Store<any>;)/g, '// $1')
fs.writeFile(pathVue, res, exitIfErr)
})
{
"name": "prjct",
"version": "1.0.0",
"scripts": {
"postinstall": "node ./fix-vendor.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment