From 83143be82fb31e6fcbeb411ca789d1c72bb9f6fd Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Tue, 16 Aug 2022 13:23:48 +0100 Subject: [PATCH] Fix compatibility with node 18 Fixes #49 --- .github/workflows/tests.yml | 2 +- .gitignore | 1 + src/helpers.js | 2 +- test/utils.js | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8d73f59..c28ae6a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [12, 14, 16] + node: [12, 14, 16, 18] # Only run one Node version on Windows include: - os: windows-latest diff --git a/.gitignore b/.gitignore index 91be464..96d5d02 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist TODO.md +.idea diff --git a/src/helpers.js b/src/helpers.js index 6fedc3a..2a044ce 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -146,7 +146,7 @@ function cacheDir(cacheDirPath) { function cacheFile(tzdata, config, cacheDirPath) { const key = cacheKey(tzdata, config); - const filename = crypto.createHash('md4') + const filename = crypto.createHash('md5') .update(key) .digest('hex') + '.json'; const filepath = path.join(cacheDir(cacheDirPath), filename); diff --git a/test/utils.js b/test/utils.js index 609c957..98f200b 100644 --- a/test/utils.js +++ b/test/utils.js @@ -11,11 +11,12 @@ const rGeneratedFile = /[\\/]node_modules[\\/]\.cache[\\/]moment-timezone-data-w function buildWebpack(pluginOptions, testOptions = {}) { const compilerOptions = { mode: 'development', - devtool: 'hidden-source-map', + devtool: 'eval', entry: path.resolve(__dirname, 'fixtures', 'index.js'), output: { path: __dirname, filename: 'test-output.[filehash].js', + hashFunction: 'md5' }, plugins: [ new MomentTimezoneDataPlugin(pluginOptions),