Skip to content

Commit

Permalink
fix #23 = don't abuse extension config for local stuff. Safe Last gen…
Browse files Browse the repository at this point in the history
…erated versions to the ide-helper folder
  • Loading branch information
panstromek committed Mar 28, 2020
1 parent e9fe2f3 commit 5634038
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/generators/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ module.exports.generateAll = generateAll
function generateIfNeeded (api, appDir) {
const quasarVersion = api.getPackageVersion('quasar')
const ideHelperVersion = api.getPackageVersion('quasar-app-extension-ide-helper')
const persistentConfig = api.getPersistentConf()
if (persistentConfig.lastQuasarVersion !== quasarVersion ||
let persistentConfig
const configFilePath = `${appDir}/.quasar-ide-helper/ide-helper-config.json`
if (fs.existsSync(configFilePath)) {
try {
persistentConfig = JSON.parse(fs.readFileSync(configFilePath).toString())
} catch (e) {
console.error('Failed to parse ide helper config file, regenerating everything from scratch.')
}
}
if (
!persistentConfig ||
persistentConfig.lastQuasarVersion !== quasarVersion ||
persistentConfig.lastIdeHelperVersion !== ideHelperVersion ||
!fs.existsSync(`${appDir}/.quasar-ide-helper`)
) {
Expand All @@ -34,8 +44,8 @@ function generateAll (api) {
console.log('')
console.log('Note: You may need to close and reopen the project for some changes to take effect.')
console.log('If you don\'t see changes even then, try to run the script without opened project.')
api.mergePersistentConf({
fs.writeFileSync(`${appDir}/.quasar-ide-helper/ide-helper-config.json`, JSON.stringify({
lastQuasarVersion: api.getPackageVersion('quasar'),
lastIdeHelperVersion: api.getPackageVersion('quasar-app-extension-ide-helper')
})
}))
}

0 comments on commit 5634038

Please sign in to comment.