sku 12.6.2 → 12.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # sku
2
2
 
3
+ ## 12.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update TypeScript from 5.3 to 5.5 ([#1003](https://github.com/seek-oss/sku/pull/1003))
8
+
9
+ Both the 5.4 and 5.5 releases include breaking changes. See the [TypeScript 5.4 announcement] and [TypeScript 5.5 announcement] for more information.
10
+
11
+ [typescript 5.4 announcement]: https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/
12
+ [typeScript 5.5 announcement]: https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/
13
+
14
+ - Add support for `--watch` flag to `sku translations compile` ([#989](https://github.com/seek-oss/sku/pull/989))
15
+
16
+ The `sku translations compile` command now accepts a `--watch` flag. When this flag is provided, `translations.json` files will be re-compiled whenever changes are detected.
17
+
18
+ **EXAMPLE USAGE**:
19
+
20
+ ```sh
21
+ sku translations compile --watch
22
+ ```
23
+
24
+ ### Patch Changes
25
+
26
+ - Update all `@vocab/*` dependencies ([#989](https://github.com/seek-oss/sku/pull/989))
27
+
28
+ - Fixes a bug where the project name was not being reported correctly when sending telemetry ([#1001](https://github.com/seek-oss/sku/pull/1001))
29
+
30
+ - Enable `babel-loader` cache ([#990](https://github.com/seek-oss/sku/pull/990))
31
+
32
+ Sku's webpack configuration now configures `babel-loader` to emit a cache to `node_modules/.cache/babel-loader`. The primary use case for this cache is speeding up production builds. It can also speed up local development in situations where the webpack cache is invalidated.
33
+
34
+ - Minify build output with [SWC] ([#992](https://github.com/seek-oss/sku/pull/992))
35
+
36
+ Minification of production build output is now performed by [SWC]. Previously this was performed by [Terser]. This should result in a noticeable reduction in build times for larger projects, as well as a slight decrease in bundle size.
37
+
38
+ [swc]: https://swc.rs/docs/configuration/minification
39
+ [terser]: https://terser.org/
40
+
3
41
  ## 12.6.2
4
42
 
5
43
  ### Patch Changes
@@ -94,6 +94,13 @@ module.exports = ({
94
94
  return {
95
95
  babelrc: false,
96
96
  sourceType: isBrowser ? 'unambiguous' : 'module',
97
+ // `babel-jest` does not support the `cacheDirectory` option.
98
+ // It is only used by `babel-loader`.
99
+ ...(!isJest
100
+ ? {
101
+ cacheDirectory: true,
102
+ }
103
+ : {}),
97
104
  presets,
98
105
  plugins,
99
106
  };
@@ -134,7 +134,17 @@ const makeWebpackConfig = ({
134
134
  // The 'TerserPlugin' is actually the default minimizer for webpack
135
135
  // We add a custom one to ensure licence comments stay inside the final JS assets
136
136
  // Without this a '*.js.LICENSE.txt' file would be created alongside
137
- minimizer: [new TerserPlugin({ extractComments: false })],
137
+ minimizer: [
138
+ new TerserPlugin({
139
+ extractComments: false,
140
+ minify: TerserPlugin.swcMinify,
141
+ parallel: true,
142
+ terserOptions: {
143
+ compress: true,
144
+ mangle: true,
145
+ },
146
+ }),
147
+ ],
138
148
  concatenateModules: isProductionBuild,
139
149
  ...(!isLibrary
140
150
  ? {
@@ -176,6 +186,7 @@ const makeWebpackConfig = ({
176
186
  loader: require.resolve('babel-loader'),
177
187
  options: {
178
188
  babelrc: false,
189
+ cacheDirectory: true,
179
190
  presets: [
180
191
  [
181
192
  require.resolve('@babel/preset-env'),
@@ -97,7 +97,17 @@ const makeWebpackConfig = ({
97
97
  // The 'TerserPlugin' is actually the default minimizer for webpack
98
98
  // We add a custom one to ensure licence comments stay inside the final JS assets
99
99
  // Without this a '*.js.LICENSE.txt' file would be created alongside
100
- minimizer: [new TerserPlugin({ extractComments: false })],
100
+ minimizer: [
101
+ new TerserPlugin({
102
+ extractComments: false,
103
+ minify: TerserPlugin.swcMinify,
104
+ parallel: true,
105
+ terserOptions: {
106
+ compress: true,
107
+ mangle: true,
108
+ },
109
+ }),
110
+ ],
101
111
  concatenateModules: isProductionBuild,
102
112
  splitChunks: {
103
113
  chunks: 'all',
@@ -138,6 +148,7 @@ const makeWebpackConfig = ({
138
148
  loader: require.resolve('babel-loader'),
139
149
  options: {
140
150
  babelrc: false,
151
+ cacheDirectory: true,
141
152
  presets: [
142
153
  [
143
154
  require.resolve('@babel/preset-env'),
package/lib/parseArgs.js CHANGED
@@ -44,6 +44,7 @@ module.exports = (processArgv) => {
44
44
  'debug',
45
45
  // Passed to Vocab in the `translations` script
46
46
  'delete-unused-keys',
47
+ 'watch',
47
48
  ],
48
49
  // `minimist` does not push unknown flags to `_` even if this function returns `true`, so we
49
50
  // need to track them ourselves
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sku",
3
- "version": "12.6.2",
3
+ "version": "12.7.0",
4
4
  "description": "Front-end development toolkit, powered by Webpack, Babel, CSS Modules, Less and Jest",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -44,14 +44,15 @@
44
44
  "@storybook/cli": "^7.0.17",
45
45
  "@storybook/react": "^7.0.17",
46
46
  "@storybook/react-webpack5": "^7.0.17",
47
+ "@swc/core": "^1.5.25",
47
48
  "@types/jest": "^29.0.0",
48
49
  "@types/loadable__component": "^5.13.1",
49
50
  "@vanilla-extract/jest-transform": "^1.1.0",
50
51
  "@vanilla-extract/webpack-plugin": "^2.2.0",
51
- "@vocab/core": "^1.3.0",
52
- "@vocab/phrase": "^1.2.4",
52
+ "@vocab/core": "^1.6.2",
53
+ "@vocab/phrase": "^2.0.0",
53
54
  "@vocab/pseudo-localize": "^1.0.1",
54
- "@vocab/webpack": "^1.2.1",
55
+ "@vocab/webpack": "^1.2.9",
55
56
  "@zendesk/babel-plugin-react-displayname": "zendesk/babel-plugin-react-displayname#7a837f2",
56
57
  "autoprefixer": "^10.3.1",
57
58
  "babel-jest": "^29.0.0",
@@ -114,7 +115,7 @@
114
115
  "svgo-loader": "^4.0.0",
115
116
  "terser-webpack-plugin": "^5.1.4",
116
117
  "tree-kill": "^1.2.1",
117
- "typescript": "~5.3.0",
118
+ "typescript": "~5.5.0",
118
119
  "webpack": "^5.52.0",
119
120
  "webpack-bundle-analyzer": "^4.6.1",
120
121
  "webpack-dev-server": "^5.0.2",
@@ -134,7 +135,7 @@
134
135
  "@types/react-dom": "^18.2.3",
135
136
  "@types/which": "^3.0.0",
136
137
  "@vanilla-extract/css": "^1.0.0",
137
- "@vocab/react": "^1.0.1",
138
+ "@vocab/react": "^1.1.11",
138
139
  "braid-design-system": "^32.0.0",
139
140
  "react": "^18.2.0",
140
141
  "react-dom": "^18.2.0",
@@ -2,7 +2,11 @@ const envCi = require('env-ci');
2
2
 
3
3
  const { branch } = envCi();
4
4
  const chalk = require('chalk');
5
- const args = require('../config/args').argv;
5
+ const {
6
+ argv: args,
7
+ watch,
8
+ 'delete-unused-keys': deleteUnusedKeys,
9
+ } = require('../config/args');
6
10
  const { compile, validate } = require('@vocab/core');
7
11
  const { push, pull } = require('@vocab/phrase');
8
12
  const { getVocabConfig } = require('../config/vocab/vocab');
@@ -51,16 +55,13 @@ const ensureBranch = () => {
51
55
 
52
56
  try {
53
57
  if (translationSubCommand === 'compile') {
54
- compile({ watch: false }, vocabConfig);
58
+ console.log('Watching for changes to translations');
59
+ compile({ watch }, vocabConfig);
55
60
  }
56
61
  if (translationSubCommand === 'validate') {
57
62
  validate(vocabConfig);
58
63
  }
59
64
  if (translationSubCommand === 'push') {
60
- const deleteUnusedKeys = commandArguments.includes(
61
- '--delete-unused-keys',
62
- );
63
-
64
65
  ensureBranch();
65
66
  push({ branch, deleteUnusedKeys }, vocabConfig);
66
67
  }
@@ -75,5 +76,8 @@ const ensureBranch = () => {
75
76
 
76
77
  process.exit(1);
77
78
  }
78
- console.log(chalk.cyan('Translations complete'));
79
+
80
+ if (!watch) {
81
+ console.log(chalk.cyan('Translations complete'));
82
+ }
79
83
  })();
@@ -10,7 +10,7 @@ const { languages } = require('../context');
10
10
  let projectName = 'unknown';
11
11
  let braidVersion = 'unknown';
12
12
  try {
13
- const packageJson = requireFromCwd('package.json');
13
+ const packageJson = requireFromCwd('./package.json');
14
14
 
15
15
  if (packageJson.name) {
16
16
  projectName = packageJson.name;