From 23751a93f235494343fbde99cf77b355d29e253c Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Tue, 29 Nov 2016 18:45:43 -0500 Subject: [PATCH] Autogenerate version number The version number is now generated from package.json instead of needing to be manually updated in multiple places. --- githooks/update | 11 +++++++++++ js/client.js | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/githooks/update b/githooks/update index 5470f00d8..638253928 100755 --- a/githooks/update +++ b/githooks/update @@ -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'}); diff --git a/js/client.js b/js/client.js index 9203887aa..a5f7e0d4e 100644 --- a/js/client.js +++ b/js/client.js @@ -1,7 +1,5 @@ (function ($) { - Config.version = '0.10.2'; - Config.sockjsprefix = '/showdown'; Config.root = '/';