Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jest, typescript, babel, eslint-config-seek and minimum node version requirement #709

Merged
merged 14 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/few-bees-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'sku': minor
---

Update to eslint-config-seek v10

This update involves a few major version jumps, so be sure to read the following release notes for all the breaking changes:
- [v8.0.0](https://github.com/seek-oss/eslint-config-seek/releases/tag/v8.0.0)
- [v9.0.0](https://github.com/seek-oss/eslint-config-seek/releases/tag/v9.0.0)
- [v10.0.0](https://github.com/seek-oss/eslint-config-seek/releases/tag/v10.0.0)

You should be able to automatically fix most lint warnings/errors by running `yarn sku format`.
25 changes: 25 additions & 0 deletions .changeset/funny-lemons-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
'sku': minor
---

Upgrade from jest v27 to v29

Please take a look at the following upgrade guides as there may be breaking changes that affect your tests:
- [v27 to v28 upgrade guide](https://jestjs.io/docs/28.x/upgrading-to-jest28)
- [v28 to v29 upgrade guide](https://jestjs.io/docs/upgrading-to-jest29)

Likely the most significant change is the new default snapshot format:

```diff
- Expected: \\"a\\"
+ Expected: "a"

- Object {
- Array []
- }
+ {
+ []
+ }
```

This may require you to update your snapshots.
8 changes: 8 additions & 0 deletions .changeset/swift-sloths-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'sku': minor
---

Drop support for Node v12

Sku now only supports Node v14 and above.
Although sku itself does not depend on any Node v14 APIs, Node v12 is [no longer officially supported](https://github.com/nodejs/Release#end-of-life-releases), and many of sku's dependencies no longer support it either.
9 changes: 9 additions & 0 deletions .changeset/yellow-rats-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'sku': minor
---

Update typescript dependency

Sku now has a `typescript` dependency of `^4.5.0`.
Previously the version was restricted due to a type issue with `braid-design-system` and `[email protected]`.
Please take a look at the release notes for recent typescript versions as there may be breaking changes that need to be addressed.
2 changes: 1 addition & 1 deletion config/jest/cssModulesTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ module.exports = {
cssModule[className] = `${fileName}__${className}`;
});

return `module.exports = ${JSON.stringify(cssModule)}`;
return { code: `module.exports = ${JSON.stringify(cssModule)}` };
},
};
1 change: 0 additions & 1 deletion config/jest/jestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module.exports = {
// the default, which normally excludes everything in node_modules.
`node_modules${slash}(?!(${compilePackagesRegex}))`,
],
testURL: 'http://localhost', // @see https://github.com/facebook/jest/issues/6766
watchPlugins: [
require.resolve('jest-watch-typeahead/filename'),
require.resolve('jest-watch-typeahead/testname'),
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const path = require('path');
module.exports = {
setupFilesAfterEnv: [path.resolve(__dirname, 'test/utils/jestSetup.js')],
testURL: 'http://localhost',
testMatch: ['**/*.test.js'],
testPathIgnorePatterns: ['test/.*/src'],
preset: 'jest-puppeteer',
Expand Down
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sku": "./bin/sku.js"
},
"engines": {
"node": ">=12.13.0"
"node": ">=14"
},
"scripts": {
"lint": "npm run format-check && eslint .",
Expand Down Expand Up @@ -56,14 +56,14 @@
"react": "^16.14.0 || ^17.0.0 || ^18.0.0"
},
"dependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-transform-react-constant-elements": "^7.12.1",
"@babel/plugin-transform-react-inline-elements": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.12.10",
"@babel/preset-typescript": "^7.12.7",
"@babel/runtime": "^7.12.5",
"@babel/core": "^7.18.0",
"@babel/plugin-transform-react-constant-elements": "^7.18.0",
"@babel/plugin-transform-react-inline-elements": "^7.18.0",
"@babel/plugin-transform-runtime": "^7.18.0",
"@babel/preset-env": "^7.18.0",
"@babel/preset-react": "^7.18.0",
"@babel/preset-typescript": "^7.18.0",
"@babel/runtime": "^7.18.0",
"@loadable/babel-plugin": "^5.13.2",
"@loadable/component": "^5.14.1",
"@loadable/server": "^5.14.0",
Expand All @@ -72,7 +72,7 @@
"@storybook/builder-webpack5": "^6.3.6",
"@storybook/manager-webpack5": "^6.3.6",
"@storybook/react": "^6.3.4",
"@types/jest": "^27.0.0",
"@types/jest": "^29.0.0",
"@types/loadable__component": "^5.13.1",
"@vanilla-extract/babel-plugin": "^1.0.0",
"@vanilla-extract/webpack-plugin": "^2.0.0",
Expand All @@ -81,7 +81,7 @@
"@vocab/pseudo-localize": "^1.0.0",
"@vocab/webpack": "^1.1.0",
"autoprefixer": "^10.3.1",
"babel-jest": "^27.0.6",
"babel-jest": "^29.0.0",
"babel-loader": "^8.2.2",
"babel-plugin-add-react-displayname": "^0.0.5",
"babel-plugin-dynamic-import-node": "^2.3.3",
Expand Down Expand Up @@ -111,7 +111,7 @@
"esbuild-register": "^3.2.0",
"escape-string-regexp": "^4.0.0",
"eslint": "^7.18.0",
"eslint-config-seek": "^7.0.8",
"eslint-config-seek": "^10.0.0",
"exception-formatter": "^2.1.2",
"express": "^4.16.3",
"fast-glob": "^3.2.5",
Expand All @@ -124,8 +124,9 @@
"identity-obj-proxy": "^3.0.0",
"indent-string": "^4.0.0",
"inquirer": "^8.2.3",
"jest": "^27.0.6",
"jest-watch-typeahead": "^0.6.1",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.0.0",
"jest-watch-typeahead": "^2.2.0",
"less": "^4.1.0",
"less-loader": "^5.0.0",
"lint-staged": "^11.1.1",
Expand All @@ -152,7 +153,7 @@
"traverse": "^0.6.6",
"treat": "^2.0.4",
"tree-kill": "^1.2.1",
"typescript": ">=4.1.3 <4.5.0",
"typescript": "^4.5.0",
Copy link
Contributor

@mrm007 mrm007 Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes straight to latest, 4.8.4. Do we want to use ~4.5.0 to stay on 4.5.x?

sku/yarn.lock

Lines 16975 to 16976 in b03adb4

typescript@^4.5.0:
version "4.8.4"

Copy link
Contributor Author

@askoufis askoufis Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skuba does this, though I'm not exactly sure of the benefit in the case of sku. If anything, I feel like we'd want to restrict the upper limit, since typescript doesn't adhere to semver, just in case something breaks, but I'm not sure about restricting to a specific minor version as that feels a bit too limiting.

"validate-npm-package-name": "^4.0.0",
"webpack": "^5.47.1",
"webpack-bundle-analyzer": "^4.4.2",
Expand Down
1 change: 0 additions & 1 deletion scripts/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable-next-line jest/no-jest-import */
const jest = require('jest');

const isCI = require('../lib/isCI');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`braid-design-system build should generate the expected files 1`] = `
Object {
{
"390-e3f9ef0d56d30d89e84e.css": ._1brbmfo0 {
-webkit-tap-highlight-color: transparent;
border: 0;
Expand Down Expand Up @@ -2284,21 +2284,21 @@ svg.jhxt971g {
}
,
"externals.json": "[
\\"crypto\\",
\\"fs\\",
\\"os\\",
\\"path\\",
\\"stream\\",
\\"tty\\",
\\"url\\",
\\"util\\"
"crypto",
"fs",
"os",
"path",
"stream",
"tty",
"url",
"util"
]",
"jobStreet/index.html": SCRIPTS: Array [
"jobStreet/index.html": SCRIPTS: [
"/runtime-ae2f6dcdc04100e89075.js",
"/main-b6c861ef5c179035a5cf.js",
"/themes-jobStreet-b1176f00543604c725c8.js",
]
CSS: Array [
CSS: [
"/390-e3f9ef0d56d30d89e84e.css",
"/themes-jobStreet-3bdb23b17052d463b1d1.css",
]
Expand Down Expand Up @@ -2502,12 +2502,12 @@ SOURCE HTML: <!DOCTYPE html>
</html>,
"main-b6c861ef5c179035a5cf.js": "CONTENTS IGNORED IN SNAPSHOT TEST",
"runtime-ae2f6dcdc04100e89075.js": "CONTENTS IGNORED IN SNAPSHOT TEST",
"seekAnz/index.html": SCRIPTS: Array [
"seekAnz/index.html": SCRIPTS: [
"/runtime-ae2f6dcdc04100e89075.js",
"/main-b6c861ef5c179035a5cf.js",
"/themes-seekAnz-1fb19a0d260b74ab2f4d.js",
]
CSS: Array [
CSS: [
"/390-e3f9ef0d56d30d89e84e.css",
"/themes-seekAnz-5fff494d64baabdd84a9.css",
]
Expand Down Expand Up @@ -4854,12 +4854,12 @@ SOURCE HTML: <!DOCTYPE html>
`;

exports[`braid-design-system build should return built jobStreet site 1`] = `
SCRIPTS: Array [
SCRIPTS: [
"/runtime-ae2f6dcdc04100e89075.js",
"/main-b6c861ef5c179035a5cf.js",
"/themes-jobStreet-b1176f00543604c725c8.js",
]
CSS: Array [
CSS: [
"/390-e3f9ef0d56d30d89e84e.css",
"/themes-jobStreet-3bdb23b17052d463b1d1.css",
]
Expand Down Expand Up @@ -5082,12 +5082,12 @@ POST HYDRATE DIFFS:
`;

exports[`braid-design-system build should return built seekAnz site 1`] = `
SCRIPTS: Array [
SCRIPTS: [
"/runtime-ae2f6dcdc04100e89075.js",
"/main-b6c861ef5c179035a5cf.js",
"/themes-seekAnz-1fb19a0d260b74ab2f4d.js",
]
CSS: Array [
CSS: [
"/390-e3f9ef0d56d30d89e84e.css",
"/themes-seekAnz-5fff494d64baabdd84a9.css",
]
Expand Down Expand Up @@ -5310,14 +5310,14 @@ POST HYDRATE DIFFS:
`;

exports[`braid-design-system start should return development jobStreet site 1`] = `
SCRIPTS: Array [
SCRIPTS: [
"/runtime.js",
"/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_client_ErrorOverlayEntry_js_sockPath-36a6de.js",
"/main.js",
"/vendors-node_modules_braid-design-system_themes_jobStreet_ts.js",
"/themes-jobStreet.js",
]
CSS: Array [
CSS: [
"/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_client_ErrorOverlayEntry_js_sockPath-36a6de.css",
"/vendors-node_modules_braid-design-system_themes_jobStreet_ts.css",
"/themes-jobStreet.css",
Expand Down Expand Up @@ -5565,14 +5565,14 @@ POST HYDRATE DIFFS:
`;

exports[`braid-design-system start should return development seekAnz site 1`] = `
SCRIPTS: Array [
SCRIPTS: [
"/runtime.js",
"/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_client_ErrorOverlayEntry_js_sockPath-36a6de.js",
"/main.js",
"/vendors-node_modules_braid-design-system_themes_seekAnz_ts.js",
"/themes-seekAnz.js",
]
CSS: Array [
CSS: [
"/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_client_ErrorOverlayEntry_js_sockPath-36a6de.css",
"/vendors-node_modules_braid-design-system_themes_seekAnz_ts.css",
"/themes-seekAnz.css",
Expand Down
2 changes: 1 addition & 1 deletion test/test-cases/braid-design-system/app/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('braid-design-system', () => {
</BraidTestProvider>,
),
).toMatchInlineSnapshot(
`"<style type=\\"text/css\\">body{margin:0;padding:0;background:#eee}</style><div class=\\"seekAnzTheme_default__1kubmhw0\\"><div class=\\"reset_base__1brbmfo0 sprinkles_paddingTop_large_mobile__8t4tri40\\"></div></div>"`,
`"<style type="text/css">body{margin:0;padding:0;background:#eee}</style><div class="seekAnzTheme_default__1kubmhw0"><div class="reset_base__1brbmfo0 sprinkles_paddingTop_large_mobile__8t4tri40"></div></div>"`,
);
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`custom-src-paths build should create valid app 1`] = `
SCRIPTS: Array [
SCRIPTS: [
"/some-static-place/runtime-d71e61b408567c9bf4a8.js",
"/some-static-place/75-b89c2c633438cd967ef8.js",
"/some-static-place/main-fa05ee4f9a94c0959e73.js",
]
CSS: Array []
CSS: []
SOURCE HTML: <!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -70,14 +70,14 @@ POST HYDRATE DIFFS: NO DIFF
`;

exports[`custom-src-paths build should generate the expected files 1`] = `
Object {
{
"75-b89c2c633438cd967ef8.js": "CONTENTS IGNORED IN SNAPSHOT TEST",
"index.html": SCRIPTS: Array [
"index.html": SCRIPTS: [
"/some-static-place/runtime-d71e61b408567c9bf4a8.js",
"/some-static-place/75-b89c2c633438cd967ef8.js",
"/some-static-place/main-fa05ee4f9a94c0959e73.js",
]
CSS: Array []
CSS: []
SOURCE HTML: <!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -143,12 +143,12 @@ SOURCE HTML: <!DOCTYPE html>
`;

exports[`custom-src-paths start should start a development server 1`] = `
SCRIPTS: Array [
SCRIPTS: [
"/runtime.js",
"/vendors-node_modules_babel_runtime_helpers_taggedTemplateLiteral_js-node_modules_loadable_com-369be7.js",
"/main.js",
]
CSS: Array []
CSS: []
SOURCE HTML: <!DOCTYPE html>
<html>
<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`library-build build should generate the expected files 1`] = `
Object {
{
"366-a586b0033bd4452aa86e.js": "CONTENTS IGNORED IN SNAPSHOT TEST",
"683-f95da917178e36045996.js": "CONTENTS IGNORED IN SNAPSHOT TEST",
"MyLibrary.css": .P_SjFKG {
Expand All @@ -19,10 +19,10 @@ Object {
`;

exports[`library-build start should start a development server 1`] = `
SCRIPTS: Array [
SCRIPTS: [
"/MyLibrary.js",
]
CSS: Array [
CSS: [
"/MyLibrary.css",
]
SOURCE HTML: <!DOCTYPE html>
Expand Down
Loading