sku 12.4.0 → 12.4.2

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/bin/sku.js +1 -1
  3. package/config/babel/babelConfig.js +1 -1
  4. package/config/eslint/importOrderConfig.js +1 -1
  5. package/config/jest/cssModulesTransform.js +1 -1
  6. package/config/storybook/index.js +2 -2
  7. package/config/webpack/plugins/metrics-plugin/index.js +1 -1
  8. package/config/webpack/resolveModules.js +1 -1
  9. package/config/webpack/utils/resolvePackage.js +2 -2
  10. package/config/webpack/utils/resolvePackage.test.js +3 -1
  11. package/config/webpack/webpack.config.js +1 -1
  12. package/config/webpack/webpack.config.ssr.js +1 -1
  13. package/context/defaultCompilePackages.js +1 -3
  14. package/context/defaultSkuConfig.js +1 -1
  15. package/context/index.js +2 -2
  16. package/entry/csp.js +2 -2
  17. package/entry/server/index.js +3 -3
  18. package/entry/server/server.js +1 -1
  19. package/lib/buildFileUtils.js +2 -2
  20. package/lib/certificate.js +8 -2
  21. package/lib/configure.js +2 -2
  22. package/lib/copyDirContents.js +2 -2
  23. package/lib/createServer.js +2 -2
  24. package/lib/cwd.js +1 -1
  25. package/lib/exists.js +1 -1
  26. package/lib/gracefulSpawn.js +1 -1
  27. package/lib/hosts.js +1 -1
  28. package/lib/openBrowser/index.js +1 -1
  29. package/lib/runBin.js +1 -1
  30. package/lib/runESLint.js +4 -1
  31. package/lib/runPrettier.js +1 -1
  32. package/lib/serverManager.js +1 -1
  33. package/lib/storybook.js +2 -2
  34. package/lib/toPosixPath.js +1 -1
  35. package/lib/validateLessFiles.js +2 -2
  36. package/lib/validatePeerDeps.js +1 -1
  37. package/package.json +4 -3
  38. package/scripts/build-ssr.js +1 -1
  39. package/scripts/build.js +1 -1
  40. package/scripts/init.js +2 -2
  41. package/scripts/postinstall.js +1 -1
  42. package/scripts/serve.js +1 -1
  43. package/scripts/start-ssr.js +1 -1
  44. package/scripts/test.js +1 -1
  45. package/sku-types.d.ts +8 -8
  46. package/telemetry/index.js +1 -1
  47. package/tsconfig.json +4 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # sku
2
2
 
3
+ ## 12.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Better support for setting `displayName` on React components when [`displayNamesProd`](https://seek-oss.github.io/sku/#/./docs/configuration?id=displaynamesprod) is true. ([#894](https://github.com/seek-oss/sku/pull/894))
8
+
9
+ ## 12.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Update eslint-config-seek to version 12, which includes the major bump to ESLint 7 and typescript-eslint 6. ([#892](https://github.com/seek-oss/sku/pull/892))
14
+ You can view the specific changes over in [eslint-config-seek].
15
+
16
+ The majority of changes should automatically fix when running `sku format`.
17
+
18
+ [eslint-config-seek]: https://github.com/seek-oss/eslint-config-seek/blob/master/CHANGELOG.md#1200
19
+
3
20
  ## 12.4.0
4
21
 
5
22
  ### Minor Changes
package/bin/sku.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const fs = require('fs');
2
+ const fs = require('node:fs');
3
3
  const debug = require('debug');
4
4
  const args = require('../config/args');
5
5
  const _validatePeerDeps = require('../lib/validatePeerDeps');
@@ -51,7 +51,7 @@ module.exports = ({
51
51
  );
52
52
 
53
53
  if (displayNamesProd) {
54
- plugins.push(require.resolve('babel-plugin-add-react-displayname'));
54
+ plugins.push(require.resolve('@zendesk/babel-plugin-react-displayname'));
55
55
  }
56
56
 
57
57
  if (removeAssertionsInProduction) {
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const { paths, rootResolution } = require('../../context');
3
3
 
4
4
  const internalRegex = `^(${paths.src
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const getClassNames = require('./getClassNames');
3
3
 
4
4
  module.exports = {
@@ -3,8 +3,8 @@
3
3
  * https://github.com/storybookjs/storybook/pull/23018
4
4
  */
5
5
 
6
- const fs = require('fs');
7
- const path = require('path');
6
+ const fs = require('node:fs');
7
+ const path = require('node:path');
8
8
  const {
9
9
  paths,
10
10
  storybookAddons,
@@ -1,4 +1,4 @@
1
- const { performance } = require('perf_hooks');
1
+ const { performance } = require('node:perf_hooks');
2
2
  const prettyMilliseconds = require('pretty-ms');
3
3
  const debug = require('debug')('sku:metrics');
4
4
  const track = require('../../../../telemetry');
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
 
3
3
  const modules = ['node_modules'];
4
4
 
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const memoize = require('memoizee');
3
3
  const debug = require('debug')('sku:resolvePackage');
4
4
  const { cwd } = require('../../../lib/cwd');
@@ -75,6 +75,6 @@ const createPackageResolver = (fs, resolve) => {
75
75
  };
76
76
 
77
77
  module.exports = {
78
- resolvePackage: createPackageResolver(require('fs'), require.resolve),
78
+ resolvePackage: createPackageResolver(require('node:fs'), require.resolve),
79
79
  createPackageResolver,
80
80
  };
@@ -3,7 +3,9 @@ const { cwd } = require('../../../lib/cwd');
3
3
 
4
4
  describe('webpack utils', () => {
5
5
  describe('resolvePackage()', () => {
6
- let resolvePackage, fs, resolve;
6
+ let resolvePackage;
7
+ let fs;
8
+ let resolve;
7
9
 
8
10
  beforeEach(() => {
9
11
  fs = {
@@ -1,7 +1,7 @@
1
1
  const webpack = require('webpack');
2
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
3
3
  const nodeExternals = require('webpack-node-externals');
4
- const path = require('path');
4
+ const path = require('node:path');
5
5
  const LoadablePlugin = require('@loadable/webpack-plugin');
6
6
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
7
7
  const TerserPlugin = require('terser-webpack-plugin');
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const webpack = require('webpack');
3
3
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
4
  const nodeExternals = require('webpack-node-externals');
@@ -1,4 +1,4 @@
1
- const { posix: path } = require('path');
1
+ const { posix: path } = require('node:path');
2
2
  const chalk = require('chalk');
3
3
  const glob = require('fast-glob');
4
4
 
@@ -14,8 +14,6 @@ try {
14
14
  const globs = ['node_modules/@seek/*/package.json'];
15
15
  const cwd = skuCwd();
16
16
 
17
- // `rootDir` is nullable, but while we have `strict: false` in our TSConfig it won't appear nullable
18
- // It will be null during sku init, but we don't really care about detecting compile packages at that point anyway
19
17
  if (isPnpm && rootDir) {
20
18
  const pnpmVirtualStorePath = path.join(
21
19
  toPosixPath(rootDir),
@@ -1,5 +1,5 @@
1
1
  const supportedBrowsers = require('browserslist-config-seek');
2
- const path = require('path');
2
+ const path = require('node:path');
3
3
  const isCompilePackage = require('../lib/isCompilePackage');
4
4
 
5
5
  const defaultDecorator = (a) => a;
package/context/index.js CHANGED
@@ -1,5 +1,5 @@
1
- const fs = require('fs');
2
- const path = require('path');
1
+ const fs = require('node:fs');
2
+ const path = require('node:path');
3
3
  const chalk = require('chalk');
4
4
  const { register } = require('esbuild-register/dist/node');
5
5
  const { getPathFromCwd } = require('../lib/cwd');
package/entry/csp.js CHANGED
@@ -1,6 +1,6 @@
1
- import { createHash } from 'crypto';
1
+ import { createHash } from 'node:crypto';
2
2
  import { parse, valid } from 'node-html-parser';
3
- import { URL } from 'url';
3
+ import { URL } from 'node:url';
4
4
 
5
5
  const scriptTypeIgnoreList = ['application/json', 'application/ld+json'];
6
6
 
@@ -1,6 +1,6 @@
1
- import fs from 'fs';
2
- import http from 'http';
3
- import https from 'https';
1
+ import fs from 'node:fs';
2
+ import http from 'node:http';
3
+ import https from 'node:https';
4
4
  import commandLineArgs from 'command-line-args';
5
5
  import { app, onStart } from './server';
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { getChunkName } from '@vocab/webpack/chunk-name';
2
- import path from 'path';
2
+ import path from 'node:path';
3
3
  import express from 'express';
4
4
  import makeExtractor from '../makeExtractor';
5
5
  import createCSPHandler from '../csp';
@@ -1,5 +1,5 @@
1
- const path = require('path');
2
- const fs = require('fs/promises');
1
+ const path = require('node:path');
2
+ const fs = require('node:fs/promises');
3
3
  const { rimraf } = require('rimraf');
4
4
 
5
5
  const { paths } = require('../context');
@@ -1,11 +1,17 @@
1
1
  const selfsigned = require('selfsigned');
2
2
  const { blue } = require('chalk');
3
3
  const exists = require('./exists');
4
- const { mkdir, unlink, writeFile, stat, readFile } = require('fs/promises');
4
+ const {
5
+ mkdir,
6
+ unlink,
7
+ writeFile,
8
+ stat,
9
+ readFile,
10
+ } = require('node:fs/promises');
5
11
 
6
12
  const { getPathFromCwd } = require('../lib/cwd');
7
13
  const { hosts } = require('../context');
8
- const { performance } = require('perf_hooks');
14
+ const { performance } = require('node:perf_hooks');
9
15
  const track = require('../telemetry');
10
16
 
11
17
  const certificateTtl = 1000 * 60 * 60 * 24;
package/lib/configure.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { writeFile, rm } = require('fs/promises');
4
- const path = require('path');
3
+ const { writeFile, rm } = require('node:fs/promises');
4
+ const path = require('node:path');
5
5
 
6
6
  const ensureGitignore = require('ensure-gitignore');
7
7
  const { cwd, getPathFromCwd } = require('./cwd');
@@ -1,5 +1,5 @@
1
- const path = require('path');
2
- const fs = require('fs/promises');
1
+ const path = require('node:path');
2
+ const fs = require('node:fs/promises');
3
3
  const exists = require('./exists');
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- const http = require('http');
2
- const https = require('https');
1
+ const http = require('node:http');
2
+ const https = require('node:https');
3
3
 
4
4
  const { httpsDevServer } = require('../context');
5
5
  const getCertificate = require('./certificate');
package/lib/cwd.js CHANGED
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
 
3
3
  let currentCwd = process.cwd();
4
4
 
package/lib/exists.js CHANGED
@@ -1,4 +1,4 @@
1
- const { access } = require('fs/promises');
1
+ const { access } = require('node:fs/promises');
2
2
 
3
3
  /**
4
4
  * Convenience wrapper for fs.access that returns `true` if the access check was successful and `false` otherwise
@@ -1,4 +1,4 @@
1
- const { promisify } = require('util');
1
+ const { promisify } = require('node:util');
2
2
  const spawn = require('cross-spawn');
3
3
  const treeKillAsync = promisify(require('tree-kill'));
4
4
  const onDeath = require('death');
package/lib/hosts.js CHANGED
@@ -1,4 +1,4 @@
1
- const { promisify } = require('util');
1
+ const { promisify } = require('node:util');
2
2
  const hostile = require('hostile');
3
3
  const { red, yellow, bold } = require('chalk');
4
4
 
@@ -1,7 +1,7 @@
1
1
  // Inspired by create-react-app
2
2
  // https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/openBrowser.js
3
3
 
4
- const execSync = require('child_process').execSync;
4
+ const execSync = require('node:child_process').execSync;
5
5
  const defaultBrowser = require('x-default-browser');
6
6
  const open = require('open');
7
7
 
package/lib/runBin.js CHANGED
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const spawn = require('cross-spawn');
3
3
 
4
4
  /**
package/lib/runESLint.js CHANGED
@@ -3,6 +3,7 @@ const { yellow, cyan, gray } = require('chalk');
3
3
  const { ESLint } = require('eslint');
4
4
  const eslintConfig = require('../config/eslint/eslintConfig');
5
5
  const { lintExtensions } = require('./lint');
6
+ const assert = require('node:assert');
6
7
 
7
8
  const extensions = lintExtensions.map((ext) => `.${ext}`);
8
9
 
@@ -57,7 +58,9 @@ const runESLint = async ({ fix = false, paths }) => {
57
58
  }
58
59
  }
59
60
  } catch (e) {
60
- if (e && e.message && e.message.includes('No files matching')) {
61
+ assert(e instanceof Error);
62
+
63
+ if (e.message.includes('No files matching')) {
61
64
  console.warn(yellow(`Warning: ${e.message}`));
62
65
  } else {
63
66
  console.warn(yellow('ESLint encountered an error:'));
@@ -1,5 +1,5 @@
1
1
  const exists = require('./exists');
2
- const path = require('path');
2
+ const path = require('node:path');
3
3
  const chalk = require('chalk');
4
4
  const { runBin } = require('./runBin');
5
5
  const { getPathFromCwd } = require('./cwd');
@@ -1,5 +1,5 @@
1
1
  const debug = require('debug')('sku:server-watcher');
2
- const cluster = require('cluster');
2
+ const cluster = require('node:cluster');
3
3
 
4
4
  /**
5
5
  * @param {string} serverFilePath
package/lib/storybook.js CHANGED
@@ -1,5 +1,5 @@
1
- const path = require('path');
2
- const fs = require('fs/promises');
1
+ const path = require('node:path');
2
+ const fs = require('node:fs/promises');
3
3
  const debug = require('debug');
4
4
 
5
5
  const log = debug('sku:storybook');
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- const path = require('path');
2
+ const path = require('node:path');
3
3
 
4
4
  /**
5
5
  * Replaces all win32 path separators (\) with posix path separators (/)
@@ -1,5 +1,5 @@
1
- const fs = require('fs');
2
- const path = require('path');
1
+ const fs = require('node:fs');
2
+ const path = require('node:path');
3
3
  const glob = require('fast-glob');
4
4
  const chalk = require('chalk');
5
5
 
@@ -1,6 +1,6 @@
1
1
  const { getWhyCommand } = require('./packageManager');
2
2
 
3
- const { readFile } = require('fs/promises');
3
+ const { readFile } = require('node:fs/promises');
4
4
  const glob = require('fast-glob');
5
5
  const semver = require('semver');
6
6
  const chalk = require('chalk');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sku",
3
- "version": "12.4.0",
3
+ "version": "12.4.2",
4
4
  "description": "Front-end development toolkit, powered by Webpack, Babel, CSS Modules, Less and Jest",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -52,10 +52,10 @@
52
52
  "@vocab/phrase": "^1.2.4",
53
53
  "@vocab/pseudo-localize": "^1.0.1",
54
54
  "@vocab/webpack": "^1.2.1",
55
+ "@zendesk/babel-plugin-react-displayname": "zendesk/babel-plugin-react-displayname#7a837f2",
55
56
  "autoprefixer": "^10.3.1",
56
57
  "babel-jest": "^29.0.0",
57
58
  "babel-loader": "^9.1.2",
58
- "babel-plugin-add-react-displayname": "^0.0.5",
59
59
  "babel-plugin-macros": "^3.1.0",
60
60
  "babel-plugin-module-resolver": "^5.0.0",
61
61
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
@@ -81,7 +81,7 @@
81
81
  "esbuild-register": "^3.3.3",
82
82
  "escape-string-regexp": "^4.0.0",
83
83
  "eslint": "^8.41.0",
84
- "eslint-config-seek": "^11.3.1",
84
+ "eslint-config-seek": "^12.0.1",
85
85
  "exception-formatter": "^2.1.2",
86
86
  "express": "^4.16.3",
87
87
  "fast-glob": "^3.2.5",
@@ -128,6 +128,7 @@
128
128
  "x-default-browser": "^0.5.0"
129
129
  },
130
130
  "devDependencies": {
131
+ "@types/cross-spawn": "^6.0.3",
131
132
  "@types/dedent": "^0.7.0",
132
133
  "@types/express": "^4.17.11",
133
134
  "@types/react": "^18.2.3",
@@ -1,7 +1,7 @@
1
1
  // First, ensure the build is running in production mode
2
2
  process.env.NODE_ENV = 'production';
3
3
 
4
- const { performance } = require('perf_hooks');
4
+ const { performance } = require('node:perf_hooks');
5
5
  const prettyMilliseconds = require('pretty-ms');
6
6
  const webpack = require('webpack');
7
7
  const { green, red } = require('chalk');
package/scripts/build.js CHANGED
@@ -4,7 +4,7 @@ process.env.NODE_ENV = 'production';
4
4
  const prettyMilliseconds = require('pretty-ms');
5
5
  const { green, red } = require('chalk');
6
6
  const webpack = require('webpack');
7
- const { performance } = require('perf_hooks');
7
+ const { performance } = require('node:perf_hooks');
8
8
 
9
9
  const {
10
10
  copyPublicFiles,
package/scripts/init.js CHANGED
@@ -8,8 +8,8 @@ const {
8
8
  } = require('../lib/packageManager');
9
9
 
10
10
  const chalk = require('chalk');
11
- const fs = require('fs/promises');
12
- const { posix: path } = require('path');
11
+ const fs = require('node:fs/promises');
12
+ const { posix: path } = require('node:path');
13
13
  const emptyDir = require('empty-dir');
14
14
  const validatePackageName = require('validate-npm-package-name');
15
15
  const dedent = require('dedent');
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const fs = require('fs');
2
+ const fs = require('node:fs');
3
3
  const { setCwd, getPathFromCwd, cwd } = require('../lib/cwd');
4
4
  const debug = require('debug');
5
5
  const banner = require('../lib/banner');
package/scripts/serve.js CHANGED
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const exists = require('../lib/exists');
3
3
  const express = require('express');
4
4
  const handler = require('serve-handler');
@@ -1,6 +1,6 @@
1
1
  process.env.NODE_ENV = 'development';
2
2
 
3
- const path = require('path');
3
+ const path = require('node:path');
4
4
  const WebpackDevServer = require('webpack-dev-server');
5
5
  const webpack = require('webpack');
6
6
  const onDeath = require('death');
package/scripts/test.js CHANGED
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const debug = require('debug');
3
3
  const jest = require('jest');
4
4
 
package/sku-types.d.ts CHANGED
@@ -39,7 +39,7 @@ interface SkuRouteObject {
39
39
  route: string;
40
40
  name?: string;
41
41
  entry?: string;
42
- languages?: ReadonlyArray<string>;
42
+ languages?: readonly string[];
43
43
  }
44
44
 
45
45
  type SkuRoute = string | SkuRouteObject;
@@ -47,8 +47,8 @@ type SkuRoute = string | SkuRouteObject;
47
47
  interface SkuSiteObject {
48
48
  name: string;
49
49
  host?: string;
50
- routes?: ReadonlyArray<SkuRoute>;
51
- languages?: ReadonlyArray<string>;
50
+ routes?: readonly SkuRoute[];
51
+ languages?: readonly string[];
52
52
  }
53
53
 
54
54
  type SkuSite = string | SkuSiteObject;
@@ -159,7 +159,7 @@ export interface SkuConfig {
159
159
  * @default []
160
160
  * @link https://seek-oss.github.io/sku/#/./docs/configuration?id=environments
161
161
  */
162
- environments?: ReadonlyArray<string>;
162
+ environments?: readonly string[];
163
163
 
164
164
  /**
165
165
  * By default, sku compiles all node_modules in builds that target node.
@@ -177,7 +177,7 @@ export interface SkuConfig {
177
177
  * @default ['localhost']
178
178
  * @link https://seek-oss.github.io/sku/#/./docs/configuration?id=hosts
179
179
  */
180
- hosts?: ReadonlyArray<string>;
180
+ hosts?: readonly string[];
181
181
 
182
182
  /**
183
183
  * Whether or not to use https for the local development server with a self-signed certificate.
@@ -202,7 +202,7 @@ export interface SkuConfig {
202
202
  *
203
203
  * @link https://seek-oss.github.io/sku/#/./docs/configuration?id=languages
204
204
  */
205
- languages?: ReadonlyArray<SkuLanguage>;
205
+ languages?: readonly SkuLanguage[];
206
206
 
207
207
  /**
208
208
  * **Only for libraries**
@@ -317,7 +317,7 @@ export interface SkuConfig {
317
317
  * @default ['/']
318
318
  * @link https://seek-oss.github.io/sku/#/./docs/configuration?id=routes
319
319
  */
320
- routes?: ReadonlyArray<SkuRoute>;
320
+ routes?: readonly SkuRoute[];
321
321
 
322
322
  /**
323
323
  * **Only for SSR apps**
@@ -354,7 +354,7 @@ export interface SkuConfig {
354
354
  * @default []
355
355
  * @link https://seek-oss.github.io/sku/#/./docs/configuration?id=sites
356
356
  */
357
- sites?: ReadonlyArray<SkuSite>;
357
+ sites?: readonly SkuSite[];
358
358
 
359
359
  /**
360
360
  * When running `sku build`, sku will compile all your external packages (`node_modules`) through `@babel/preset-env`.
@@ -1,4 +1,4 @@
1
- const os = require('os');
1
+ const os = require('node:os');
2
2
 
3
3
  const { getPathFromCwd } = require('../lib/cwd');
4
4
  const isCI = require('../lib/isCI');
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "include": ["@loadable/**/*", "@storybook/**/*", "sku-types.d.ts"]
4
+ }