added version tag to config files for later migration

This commit is contained in:
jash
2018-12-06 20:06:48 +01:00
committed by kexkey
parent 5cb9f4e380
commit 5f64a1b936

View File

@@ -16,6 +16,8 @@ const userRegexp = /^[a-zA-Z0-9\._\-]+$/;
const reset = '\u001B8\u001B[u';
const clear = '\u001Bc';
const configFileVersion='0.0.1';
const defaultAPIProperties = `
# Watcher can:
@@ -156,6 +158,7 @@ module.exports = class extends Generator {
try {
this.props = JSON.parse(r.value);
this.props.__version = this.props.__version || configFileVersion;
} catch( err ) {
console.log(chalk.bold.red('config archive is corrupt.'));
process.exit(1);
@@ -185,10 +188,16 @@ module.exports = class extends Generator {
}
this.configurationPassword = r.password0;
this.props = {};
this.props = {
__version: configFileVersion
};
}
if( this.props.__version !== configFileVersion ) {
// migrate here
}
this._assignConfigDefaults();
for( let c of this.featureChoices ) {
c.checked = this._isChecked( 'features', c.value );