Autogenerate version number

The version number is now generated from package.json instead of needing
to be manually updated in multiple places.
This commit is contained in:
Guangcong Luo
2016-11-29 18:45:43 -05:00
parent 15fc14856d
commit 23751a93f2
2 changed files with 11 additions and 2 deletions

View File

@@ -23,6 +23,17 @@ const rootDir = path.resolve(thisDir, '..');
const Tools = require('../data/Pokemon-Showdown/tools').includeData();
const toId = Tools.getId;
// update version
process.stdout.write("Updating version... ");
let version = require('../package.json').version;
let configBuf = fs.readFileSync(path.resolve(rootDir, 'config/config.js'), {encoding: 'utf8'});
configBuf = configBuf.replace(/\/\* version \*\/[^;\n]*;/, `/* version */ Config.version = ${JSON.stringify(version)};`);
fs.writeFileSync(path.resolve(rootDir, 'config/config.js'), configBuf);
console.log("DONE");
function updateIndex() {
let indexContents = fs.readFileSync(path.resolve(rootDir, 'index.template.html'), {encoding: 'utf8'});

View File

@@ -1,7 +1,5 @@
(function ($) {
Config.version = '0.10.2';
Config.sockjsprefix = '/showdown';
Config.root = '/';