Skip to content

Commit 9207b46

Browse files
authored
fix: upgrade dependencies to resolve dependabot vulnerability alerts (#567)
1 parent 75dcafd commit 9207b46

10 files changed

+10087
-12570
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
node-version: [10.x, 12.x, 14.x]
18+
node-version: [14.x, 16.x, 18.x]
1919
os: [macOS-latest, ubuntu-latest]
2020
runs-on: ${{ matrix.os }}
2121

package.json

+43-43
Original file line numberDiff line numberDiff line change
@@ -16,58 +16,58 @@
1616
"module": "amplitude.esm.js",
1717
"dependencies": {
1818
"@amplitude/ua-parser-js": "0.7.31",
19-
"@amplitude/utils": "^1.10.1",
20-
"@babel/runtime": "^7.3.4",
21-
"blueimp-md5": "^2.10.0",
22-
"query-string": "5",
19+
"@amplitude/utils": "^1.10.2",
20+
"@babel/runtime": "^7.20.6",
21+
"blueimp-md5": "^2.19.0",
22+
"query-string": "8.0.3",
2323
"@amplitude/analytics-connector": "^1.4.6"
2424
},
2525
"devDependencies": {
2626
"@amplitude/eslint-plugin-amplitude": "^1.0.1",
27-
"@babel/core": "^7.3.4",
28-
"@babel/plugin-external-helpers": "^7.2.0",
29-
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
30-
"@babel/plugin-transform-runtime": "^7.3.4",
31-
"@babel/preset-env": "^7.3.4",
32-
"@semantic-release/changelog": "^5.0.1",
33-
"@semantic-release/exec": "^5.0.0",
34-
"@semantic-release/git": "^9.0.0",
35-
"chai": "^4.1.2",
36-
"date-fns": "^1.30.1",
37-
"eslint": "^7.15.0",
38-
"eslint-config-prettier": "^7.0.0",
39-
"eslint-plugin-mocha": "^8.0.0",
40-
"eslint-plugin-prettier": "^3.3.1",
41-
"express": "^4.16.2",
42-
"fs-extra": "^4.0.2",
43-
"husky": "^4.3.6",
44-
"jsdoc": "^3.6.3",
45-
"jsdoc-to-markdown": "^6.0.1",
46-
"karma": "^4.0.0",
27+
"@babel/core": "^7.20.5",
28+
"@babel/plugin-external-helpers": "^7.18.6",
29+
"@babel/plugin-proposal-object-rest-spread": "^7.20.2",
30+
"@babel/plugin-transform-runtime": "^7.19.6",
31+
"@babel/preset-env": "^7.20.2",
32+
"@semantic-release/changelog": "^6.0.2",
33+
"@semantic-release/exec": "^6.0.3",
34+
"@semantic-release/git": "^10.0.1",
35+
"chai": "^4.3.7",
36+
"date-fns": "^2.29.3",
37+
"eslint": "^8.29.0",
38+
"eslint-config-prettier": "^8.5.0",
39+
"eslint-plugin-mocha": "^10.1.0",
40+
"eslint-plugin-prettier": "^4.2.1",
41+
"express": "^4.18.2",
42+
"fs-extra": "^11.1.0",
43+
"husky": "^8.0.2",
44+
"jsdoc": "^4.0.0",
45+
"jsdoc-to-markdown": "^8.0.0",
46+
"karma": "^6.4.1",
4747
"karma-chai": "^0.1.0",
48-
"karma-chrome-launcher": "^2.2.0",
49-
"karma-firefox-launcher": "^1.0.1",
50-
"karma-mocha": "^1.3.0",
48+
"karma-chrome-launcher": "^3.1.1",
49+
"karma-firefox-launcher": "^2.1.2",
50+
"karma-mocha": "^2.0.1",
5151
"karma-mocha-reporter": "^2.2.5",
5252
"karma-mocha-webworker": "^1.3.0",
53-
"karma-sauce-launcher": "^2.0.2",
53+
"karma-sauce-launcher": "^4.3.6",
5454
"karma-sinon": "^1.0.5",
55-
"karma-sourcemap-loader": "^0.3.7",
56-
"lint-staged": "^10.5.3",
57-
"mocha": "^4.0.1",
58-
"prettier": "^2.2.1",
55+
"karma-sourcemap-loader": "^0.3.8",
56+
"lint-staged": "^13.1.0",
57+
"mocha": "^10.2.0",
58+
"prettier": "^2.8.1",
5959
"requirejs": "^2.3.6",
60-
"rollup": "^2.26.3",
61-
"@rollup/plugin-babel": "^5.2.0",
62-
"@rollup/plugin-commonjs": "^15.0.0",
63-
"@rollup/plugin-json": "^4.1.0",
64-
"@rollup/plugin-node-resolve": "^9.0.0",
65-
"@rollup/plugin-replace": "^2.3.3",
66-
"@rollup/plugin-legacy": "^2.2.0",
67-
"rollup-plugin-uglify": "^6.0.2",
68-
"semantic-release": "^17.1.1",
69-
"sinon": "^7.0.0",
70-
"uglify-js": "^3.4.9",
60+
"rollup": "^2.79.1",
61+
"@rollup/plugin-babel": "^6.0.3",
62+
"@rollup/plugin-commonjs": "^23.0.5",
63+
"@rollup/plugin-json": "^5.0.2",
64+
"@rollup/plugin-node-resolve": "^15.0.1",
65+
"@rollup/plugin-replace": "^5.0.1",
66+
"@rollup/plugin-legacy": "^3.0.1",
67+
"rollup-plugin-uglify": "^6.0.4",
68+
"semantic-release": "^19.0.5",
69+
"sinon": "^15.0.0",
70+
"uglify-js": "^3.17.4",
7171
"watch": "^1.0.2"
7272
},
7373
"scripts": {

test/amplitude-client.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('AmplitudeClient', function () {
2727
beforeEach(function () {
2828
amplitude = new AmplitudeClient();
2929
server = sinon.fakeServer.create();
30-
sandbox = sinon.sandbox.create();
30+
sandbox = sinon.createSandbox();
3131
});
3232

3333
afterEach(function () {
@@ -116,13 +116,13 @@ describe('AmplitudeClient', function () {
116116
});
117117

118118
it('should clear the onInitQueue', function () {
119-
let onInitCalled = false;
120-
let onInit2Called = false;
119+
let onInitCalled = false; /* eslint-disable-line no-unused-vars */
120+
let onInit2Called = false; /* eslint-disable-line no-unused-vars */
121121
amplitude.onInit(() => {
122-
onInitCalled = true; /* eslint-disable-line no-unused-vars */
122+
onInitCalled = true;
123123
});
124124
amplitude.onInit(() => {
125-
onInit2Called = true; /* eslint-disable-line no-unused-vars */
125+
onInit2Called = true;
126126
});
127127

128128
amplitude.init(apiKey);
@@ -4506,6 +4506,10 @@ describe('AmplitudeClient', function () {
45064506
amplitude.init(apiKey);
45074507
});
45084508

4509+
afterEach(function () {
4510+
clock.restore();
4511+
});
4512+
45094513
it('should not renew the session id with invalid startNewSession input', function () {
45104514
var amplitude = new AmplitudeClient();
45114515
// set up initial session

test/language.js

+3
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ describe('language', function () {
1111
Object.defineProperty(navigator, 'languages', {
1212
value: null,
1313
configurable: true,
14+
writable: true,
1415
});
1516
}
1617
if (!('language' in navigator)) {
1718
Object.defineProperty(navigator, 'language', {
1819
value: null,
1920
configurable: true,
21+
writable: true,
2022
});
2123
}
2224
if (!('userLanguage' in navigator)) {
2325
Object.defineProperty(navigator, 'userLanguage', {
2426
value: null,
2527
configurable: true,
28+
writable: true,
2629
});
2730
}
2831

test/web-worker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-undef */
22
importScripts('/base/amplitude.js');
33
importScripts('/base/node_modules/sinon/pkg/sinon.js');
4-
const { sandbox } = sinon;
4+
const { createSandbox } = sinon;
55
/* eslint-enable no-undef */
66

77
var isTrue = function (a) {
@@ -13,7 +13,7 @@ var isTrue = function (a) {
1313
describe('web worker', function () {
1414
let sbox;
1515
beforeEach(function () {
16-
sbox = sandbox.create();
16+
sbox = createSandbox();
1717
});
1818

1919
afterEach(function () {

website/docusaurus.config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module.exports = {
88
organizationName: 'Amplitude',
99
projectName: 'Amplitude-JavaScript',
1010
themeConfig: {
11-
sidebarCollapsible: false,
1211
navbar: {
1312
logo: {
1413
alt: 'Amplitude Logo',
@@ -39,11 +38,11 @@ module.exports = {
3938
'@docusaurus/preset-classic',
4039
{
4140
docs: {
42-
homePageId: 'AmplitudeClient',
4341
path: 'docs',
4442
routeBasePath: '/',
4543
sidebarPath: require.resolve('./sidebars.js'),
4644
editUrl: 'https://github.com/amplitude/Amplitude-JavaScript/website',
45+
sidebarCollapsible: false,
4746
},
4847
theme: {
4948
customCss: require.resolve('./src/css/custom.css'),

website/generate-jsdoc.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const fs = require('fs');
33
const path = require('path');
44
const prettier = require('prettier');
55
const publicClassFiles = ['amplitude-client.js', 'amplitude.js', 'identify.js', 'revenue.js'];
6+
const homeFile = 'amplitude-client.js';
67
const publicTypedefFiles = ['options.js'];
78
const srcDir = path.join(__dirname, '../', 'src');
89
const outputDir = path.join(__dirname, 'docs');
@@ -25,7 +26,15 @@ function generateClassMarkdown(inputFile) {
2526
(e) => e.kind === 'constructor' || (e.access === 'public' && (e.kind === 'function' || e.kind === 'member')),
2627
);
2728

28-
const markdownOutput = filteredData.map((item) => documentClassFile(item)).join('\n');
29+
let markdownOutput = filteredData.map((item) => documentClassFile(item)).join('\n');
30+
if (inputFile === homeFile) {
31+
markdownOutput =
32+
`\
33+
---
34+
slug: /
35+
---
36+
` + markdownOutput;
37+
}
2938
fs.writeFileSync(path.join(outputDir, `${className}.md`), prettier.format(markdownOutput, { parser: 'mdx' }));
3039
}
3140

website/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"serve": "docusaurus build --out-dir build/Amplitude-JavaScript && yarn run docusaurus serve"
1313
},
1414
"dependencies": {
15-
"@docusaurus/core": "^2.0.0-alpha.61",
16-
"@docusaurus/preset-classic": "^2.0.0-alpha.61",
17-
"@mdx-js/react": "^1.5.8",
18-
"clsx": "^1.1.1",
19-
"react": "^16.8.4",
20-
"react-dom": "^16.8.4"
15+
"@docusaurus/core": "^2.2.0",
16+
"@docusaurus/preset-classic": "^2.2.0",
17+
"@mdx-js/react": "^1.6.22",
18+
"clsx": "^1.2.1",
19+
"react": "^18.2.0",
20+
"react-dom": "^18.2.0"
2121
},
2222
"browserslist": {
2323
"production": [
@@ -31,4 +31,4 @@
3131
"last 2 safari version"
3232
]
3333
}
34-
}
34+
}

0 commit comments

Comments
 (0)