Skip to content

Commit

Permalink
build!: use node 18
Browse files Browse the repository at this point in the history
fix: update exported types to remove anys
refactor: remove casts and anys and improve internal types
build: update all deps
test: update tests
chore: improve pre-commit script
chore: add missing licenses and update thirdparties

BREAKING CHANGE: use node 18
Refs: SHELL-191 (#383)
  • Loading branch information
beawar authored Mar 13, 2024
1 parent 8d0594b commit 529260e
Show file tree
Hide file tree
Showing 46 changed files with 4,482 additions and 18,886 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ module.exports = {
'testing-library/prefer-user-event': 'warn',
'import/no-extraneous-dependencies': 'off'
}
},
{
files: ['carbonio.webpack.ts'],
rules: {
'import/no-extraneous-dependencies': 'off'
}
}
],
ignorePatterns: ['src/constants/locales.js']
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

npx commitlint --edit $1
16 changes: 11 additions & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

npm run type-check
npm run lint -- --quiet
# reuse lint
npm run lint
if command -v pipx > /dev/null 2>&1; then
pipx run reuse download --all && pipx run reuse lint
else
if command -v reuse > /dev/null 2>&1; then
reuse download --all && reuse lint
else
echo "install reuse or pipx to enable license check"
exit 1
fi
fi
npm test
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

npm run build:clean
npm run build
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
12 changes: 10 additions & 2 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Files: package-lock.json
Copyright: 2021 Zextras <https://www.zextras.com>
License: AGPL-3.0-only

Files: tsconfig.json
Files: tsconfig*.json
Copyright: 2021 Zextras <https://www.zextras.com>
License: AGPL-3.0-only

Expand All @@ -48,4 +48,12 @@ License: AGPL-3.0-only

Files: assets/*
Copyright: 2021 Zextras <https://www.zextras.com>
License: CC-BY-NC-SA-4.0
License: CC-BY-NC-SA-4.0

Files: .github/*
Copyright: 2024 Zextras <https://www.zextras.com>
License: CC0-1.0

Files: THIRDPARTIES
Copyright: 2024 Zextras <https://www.zextras.com>
License: CC0-1.0
11 changes: 5 additions & 6 deletions THIRDPARTIES
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MIT License (MIT) applies to:
@babel/preset-typescript, Copyright (c) 2014-present Sebastian McKenzie and other contributors
@commitlint/cli, Copyright (c) 2016 - present Mario Nebl
@commitlint/config-conventional, Copyright (c) 2016 - present Mario Nebl
@faker-js/faker, Faker - Copyright (c) 2022-2023, faker.js - Copyright (c) 2020 Marak Squires
@faker-js/faker, Faker - Copyright (c) 2022-2024, faker.js - Copyright (c) 2020 Marak Squires
@reduxjs/toolkit, Copyright (c) 2018 Mark Erikson
@sentry/browser, Copyright (c) 2019 Sentry (https://sentry.io) and individual contributors. All rights reserved.
@svgr/webpack, Copyright 2017 Smooth Code
Expand All @@ -29,9 +29,9 @@ babel-loader, Copyright (c) 2014-2019 Luís Couto <[email protected]>
babel-plugin-i18next-extract, Copyright 2019 Gilbert Gilb's <[email protected]>
babel-plugin-styled-components, Copyright (c) 2016-present Vladimir Danchenkov and Maximilian Stoiber
copy-webpack-plugin, Copyright JS Foundation and other contributors
core-js, Copyright (c) 2014-2023 Denis Pushkarev
core-js, Copyright (c) 2014-2024 Denis Pushkarev
css-loader, Copyright JS Foundation and other contributors
darkreader, Copyright (c) 2021 Dark Reader Ltd.
darkreader, Copyright (c) 2024 Dark Reader Ltd.
eslint-plugin-notice, Copyright (c) 2017 Nick Deis
history, Copyright (c) React Training 2016-2020. Copyright (c) Remix Software 2020-2021
html-webpack-plugin, Copyright JS Foundation and other contributors
Expand All @@ -43,7 +43,7 @@ immer, Copyright (c) 2017 Michel Weststrate
is-ci, Copyright (c) 2016-2021 Thomas Watson Steen
jest-environment-jsdom, Copyright (c) Meta Platforms, Inc. and affiliates.
jest-fail-on-console, Copyright (c) 2022 Valentin Hervieu
jest-styled-components, Copyright (c) 2017 Michele Bertoli
jest-styled-components, Copyright (c) 2017 - present Michele Bertoli
jest, Copyright (c) Meta Platforms, Inc. and affiliates.
lodash, Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
mini-css-extract-plugin, Copyright JS Foundation and other contributors
Expand All @@ -58,12 +58,11 @@ react, Copyright (c) Facebook, Inc. and its affiliates.
styled-components, Copyright (c) 2016-present Glen Maddern and Maximilian Stoiber
tinymce, Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
ts-node, Copyright (c) 2014 Blake Embrey ([email protected])
ua-parser-js, Copyright (c) 2012-2021 Faisal Salman <<[email protected]>>
ua-parser-js, Copyright (c) 2012-2023 Faisal Salman <<[email protected]>>
webpack-cli, Copyright JS Foundation and other contributors
webpack-dev-server, Copyright JS Foundation and other contributors
webpack-merge, Copyright (c) 2015 Juho Vepsalainen
webpack, Copyright JS Foundation and other contributors
whatwg-fetch, Copyright (c) 2014-2023 GitHub, Inc.
zustand, Copyright (c) 2019 Paul Henschel

MIT License
Expand Down
8 changes: 2 additions & 6 deletions carbonio.webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
/* eslint-disable import/no-import-module-exports */

import { execSync } from 'child_process';
import path from 'path';

import CopyPlugin from 'copy-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path';
import { ContextReplacementPlugin, DefinePlugin } from 'webpack';
import { WebpackConfiguration } from 'webpack-cli';

Expand Down Expand Up @@ -138,6 +136,4 @@ const configFn = (
return conf;
};

export default configFn;
// required to keep the compatibility with the sdk
module.exports = configFn;
export = configFn;
47 changes: 35 additions & 12 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { Config } from 'jest';

export default {
const config: Config = {
// All imported modules in your tests should be mocked automatically
// automock: false,

Expand Down Expand Up @@ -48,14 +49,14 @@ export default {
coverageReporters: ['text', 'cobertura'],

// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
// global: {
// branches: 75,
// functions: 75,
// lines: 75,
// statements: 75
// }
},
// coverageThreshold: {
// global: {
// branches: 75,
// functions: 75,
// lines: 75,
// statements: 75
// }
// },

// A path to a custom dependency extractor
// dependencyExtractor: undefined,
Expand All @@ -65,7 +66,8 @@ export default {

// The default configuration for fake timers
fakeTimers: {
enableGlobally: true
enableGlobally: true,
doNotFake: ['queueMicrotask']
},

// Force coverage collection from ignored files using an array of glob patterns
Expand Down Expand Up @@ -160,10 +162,29 @@ export default {
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: 'jsdom',
/**
* @note Override test environment to set again Request, Response, TextEncoder and other
* fields
* @see https://mswjs.io/docs/migrations/1.x-to-2.x#requestresponsetextencoder-is-not-defined-jest
* @see https://github.com/mswjs/msw/issues/1916#issuecomment-1919965699
*/
testEnvironment: '<rootDir>/src/test/jsdom-extended.ts',

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
testEnvironmentOptions: {
/**
* @note Opt-out from JSDOM using browser-style resolution
* for dependencies. This is simply incorrect, as JSDOM is
* not a browser, and loading browser-oriented bundles in
* Node.js will break things.
*
* Consider migrating to a more modern test runner if you
* don't want to deal with this.
* @see https://mswjs.io/docs/migrations/1.x-to-2.x#cannot-find-module-mswnode-jsdom
* @see https://github.com/mswjs/msw/issues/1786#issuecomment-1782559851
*/
customExportConditions: ['']
},

// Adds a location field to test results
// testLocationInResults: false,
Expand Down Expand Up @@ -208,3 +229,5 @@ export default {
// Whether to use watchman for file crawling
// watchman: true,
};

export default config;
Loading

0 comments on commit 529260e

Please sign in to comment.