From 4dcf6090d8be5d3e7be302b5ec797dfeae075755 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Mon, 14 Nov 2022 19:46:30 +0100 Subject: [PATCH] fetch version directly from package.json --- RELEASING.md | 2 +- modules/core/context.js | 4 +++- modules/core/file_fetcher.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index f77d0a83a..87940a028 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -31,7 +31,7 @@ $ git add . && git commit -m 'npm run translations' ``` - Check and finalize `CHANGELOG.md` -- Set release version number in `modules/core/context.js` and `package.json` +- Set release version number in `package.json` ```bash $ git add . && git commit -m 'vA.B.C' diff --git a/modules/core/context.js b/modules/core/context.js index 7f0683255..ddce5cccc 100644 --- a/modules/core/context.js +++ b/modules/core/context.js @@ -4,6 +4,8 @@ import { dispatch as d3_dispatch } from 'd3-dispatch'; import { json as d3_json } from 'd3-fetch'; import { select as d3_select } from 'd3-selection'; +import packageJSON from '../../package.json'; + import { t } from '../core/localizer'; import { fileFetcher } from './file_fetcher'; @@ -25,7 +27,7 @@ export function coreContext() { let context = utilRebind({}, dispatch, 'on'); let _deferred = new Set(); - context.version = '2.24.0-dev'; + context.version = packageJSON.version; context.privacyVersion = '20201202'; // iD will alter the hash so cache the parameters intended to setup the session diff --git a/modules/core/file_fetcher.js b/modules/core/file_fetcher.js index a3204dd59..701777295 100644 --- a/modules/core/file_fetcher.js +++ b/modules/core/file_fetcher.js @@ -1,6 +1,6 @@ import parseVersion from 'vparse'; import { presetsCdnUrl, ociCdnUrl, wmfSitematrixCdnUrl } from '../../config/id.js'; -// Double check this resolves to iD's `package.json` + import packageJSON from '../../package.json'; let _mainFileFetcher = coreFileFetcher(); // singleton