sku 12.3.3 → 12.4.1
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 +69 -0
- package/README.md +7 -3
- package/bin/sku.js +1 -1
- package/config/eslint/importOrderConfig.js +1 -1
- package/config/jest/cssModulesTransform.js +1 -1
- package/config/lintStaged/lintStagedConfig.js +5 -2
- package/config/storybook/index.js +75 -0
- package/config/storybook/storybookWebpackConfig.js +10 -10
- package/config/webpack/plugins/metrics-plugin/index.js +1 -1
- package/config/webpack/plugins/sku-webpack-plugin/index.js +3 -5
- package/config/webpack/resolveModules.js +1 -1
- package/config/webpack/utils/resolvePackage.js +2 -2
- package/config/webpack/utils/resolvePackage.test.js +3 -1
- package/config/webpack/webpack.config.js +9 -26
- package/config/webpack/webpack.config.ssr.js +8 -25
- package/context/defaultCompilePackages.js +3 -5
- package/context/defaultSkuConfig.js +1 -1
- package/context/index.js +9 -4
- package/entry/csp.js +2 -2
- package/entry/server/index.js +3 -3
- package/entry/server/server.js +1 -1
- package/lib/buildFileUtils.js +2 -2
- package/lib/certificate.js +8 -2
- package/lib/configure.js +11 -5
- package/lib/copyDirContents.js +2 -2
- package/lib/createServer.js +2 -2
- package/lib/cwd.js +1 -1
- package/lib/env.js +31 -0
- package/lib/exists.js +1 -1
- package/lib/gracefulSpawn.js +1 -1
- package/lib/hosts.js +2 -2
- package/lib/install.js +8 -23
- package/lib/managedConfigBanner.js +1 -0
- package/lib/openBrowser/index.js +1 -1
- package/lib/packageManager.js +152 -0
- package/lib/parseArgs.js +4 -0
- package/lib/runBin.js +1 -1
- package/lib/runESLint.js +5 -1
- package/lib/runPrettier.js +3 -3
- package/lib/serverManager.js +1 -1
- package/lib/storybook.js +23 -58
- package/lib/suggestScript.js +17 -22
- package/lib/toPosixPath.js +1 -1
- package/lib/validateLessFiles.js +2 -2
- package/lib/validatePeerDeps.js +6 -7
- package/package.json +10 -11
- package/scripts/build-ssr.js +1 -1
- package/scripts/build-storybook.js +4 -7
- package/scripts/build.js +1 -1
- package/scripts/init.js +43 -36
- package/scripts/postinstall.js +1 -1
- package/scripts/serve.js +2 -3
- package/scripts/start-ssr.js +15 -2
- package/scripts/storybook.js +4 -7
- package/scripts/test.js +1 -1
- package/sku-types.d.ts +8 -8
- package/telemetry/index.js +1 -1
- package/telemetry/provider.js +7 -1
- package/tsconfig.json +4 -0
- package/config/storybook/build/main.js +0 -1
- package/config/storybook/build/webpack.config.js +0 -4
- package/config/storybook/config.js +0 -45
- package/config/storybook/start/main.js +0 -1
- package/config/storybook/start/middleware.js +0 -10
- package/config/storybook/start/webpack.config.js +0 -4
- package/lib/detectYarn.js +0 -10
- package/lib/isYarn.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# sku
|
|
2
2
|
|
|
3
|
+
## 12.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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))
|
|
8
|
+
You can view the specific changes over in [eslint-config-seek].
|
|
9
|
+
|
|
10
|
+
The majority of changes should automatically fix when running `sku format`.
|
|
11
|
+
|
|
12
|
+
[eslint-config-seek]: https://github.com/seek-oss/eslint-config-seek/blob/master/CHANGELOG.md#1200
|
|
13
|
+
|
|
14
|
+
## 12.4.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- Enable caching for ESLint and Prettier ([#881](https://github.com/seek-oss/sku/pull/881))
|
|
19
|
+
|
|
20
|
+
- Add `--packageManager` flag ([#884](https://github.com/seek-oss/sku/pull/884))
|
|
21
|
+
|
|
22
|
+
Sku detects package managers in the following order: `yarn` -> `pnpm` -> `npm`.
|
|
23
|
+
The `--packageManager` flag can be used to override the package manager used for the `sku init` script.
|
|
24
|
+
This affects what package manager is used to install dependencies, as well as the scripts present in the initialized app template.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
$ pnpm dlx sku init --packageManager pnpm my-app
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- Adds support for Storybook configuration via the `.storybook` directory ([#878](https://github.com/seek-oss/sku/pull/878))
|
|
31
|
+
|
|
32
|
+
sku now supports the standard `.storybook` configuration directory, as documented in [Storybook's configuration documentation].
|
|
33
|
+
Please read [sku's storybook documentation][sku storybook docs] for more info.
|
|
34
|
+
|
|
35
|
+
[Storybook's configuration documentation]: https://storybook.js.org/docs/react/configure/overview
|
|
36
|
+
[sku storybook docs]: https://seek-oss.github.io/sku/#/./docs/storybook
|
|
37
|
+
|
|
38
|
+
- Drop support for running `devServerMiddleware` alongside `sku storybook` ([#878](https://github.com/seek-oss/sku/pull/878))
|
|
39
|
+
|
|
40
|
+
Now that sku supports Storybook configuration via the `.storybook` directory, this feature is unnecessary.
|
|
41
|
+
Storybook middleware can be configured by creating a `middleware.js` file in the `.storybook` directory.
|
|
42
|
+
See [the sku docs][sku storybook middleware] for more info.
|
|
43
|
+
|
|
44
|
+
**NOTE**: While this is technically a breaking change, it does not affect app builds, therefore it has been downgraded to a `minor` release.
|
|
45
|
+
|
|
46
|
+
[sku storybook middleware]: https://seek-oss.github.io/sku/#/./docs/storybook?id=devserver-middleware
|
|
47
|
+
|
|
48
|
+
- Update TypeScript to 5.2 ([#886](https://github.com/seek-oss/sku/pull/886))
|
|
49
|
+
|
|
50
|
+
This release includes breaking changes. See the [TypeScript 5.2 announcement][ts52] for more information.
|
|
51
|
+
|
|
52
|
+
[ts52]: https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Fixes a bug where sku would fail to suggest existing `package.json` scripts before suggesting its own commands ([#876](https://github.com/seek-oss/sku/pull/876))
|
|
57
|
+
|
|
58
|
+
- Remove `lodash` dependency ([#883](https://github.com/seek-oss/sku/pull/883))
|
|
59
|
+
|
|
60
|
+
- Propagate `--config` argument to Storybook process ([#879](https://github.com/seek-oss/sku/pull/879))
|
|
61
|
+
|
|
62
|
+
Fixes a bug where `sku storybook` and `sku build-storybook` would not honour a custom sku config specified via the `--config` flag
|
|
63
|
+
|
|
64
|
+
- Fixes a bug where `pnpm` was not detected correctly when detecting [compile packages](https://seek-oss.github.io/sku/#/./docs/extra-features?id=compile-packages) ([#876](https://github.com/seek-oss/sku/pull/876))
|
|
65
|
+
|
|
66
|
+
- Bump `@pmmmwh/react-refresh-webpack-plugin` and `webpack-dev-server` dependencies. Remove unused dependencies. ([#885](https://github.com/seek-oss/sku/pull/885))
|
|
67
|
+
|
|
68
|
+
- Adds support for `pnpm` when suggesting commands ([#876](https://github.com/seek-oss/sku/pull/876))
|
|
69
|
+
|
|
70
|
+
- Disable Storybook telemetry ([#878](https://github.com/seek-oss/sku/pull/878))
|
|
71
|
+
|
|
3
72
|
## 12.3.3
|
|
4
73
|
|
|
5
74
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -23,13 +23,17 @@ Create a new project and start a local development environment:
|
|
|
23
23
|
```bash
|
|
24
24
|
$ npx sku init my-app
|
|
25
25
|
$ cd my-app
|
|
26
|
-
$
|
|
26
|
+
$ yarn start
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
By default, a new project's dependencies will be installed with the first supported package manager detected on your system.
|
|
30
|
+
Package managers are detected in the following order: `yarn` -> `pnpm` -> `npm`.
|
|
31
|
+
This can be overridden via the `--packageManager` flag:
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
|
-
$
|
|
34
|
+
$ pnpm dlx sku init --packageManager pnpm my-app
|
|
35
|
+
$ cd my-app
|
|
36
|
+
$ pnpm start
|
|
33
37
|
```
|
|
34
38
|
|
|
35
39
|
## [Documentation](https://seek-oss.github.io/sku)
|
package/bin/sku.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const isYarn = require('../../lib/
|
|
1
|
+
const { isYarn } = require('../../lib/packageManager');
|
|
2
2
|
const { lintExtensions } = require('../../lib/lint');
|
|
3
|
+
const { getCommand } = require('@antfu/ni');
|
|
3
4
|
|
|
4
5
|
const steps = {};
|
|
5
6
|
|
|
6
7
|
// Yarn lock integrity check
|
|
7
8
|
if (isYarn) {
|
|
8
|
-
steps['+(package.json|yarn.lock)'] = [
|
|
9
|
+
steps['+(package.json|yarn.lock)'] = [
|
|
10
|
+
() => getCommand('yarn', 'install', ['--check-files']),
|
|
11
|
+
];
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
// Format & lint
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file and all its dependencies must be CJS
|
|
3
|
+
* https://github.com/storybookjs/storybook/pull/23018
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('node:fs');
|
|
7
|
+
const path = require('node:path');
|
|
8
|
+
const {
|
|
9
|
+
paths,
|
|
10
|
+
storybookAddons,
|
|
11
|
+
storybookStoryStore,
|
|
12
|
+
} = require('../../context');
|
|
13
|
+
|
|
14
|
+
const makeStorybookWebpackConfig = require('./storybookWebpackConfig');
|
|
15
|
+
|
|
16
|
+
/** @type {import("@storybook/react-webpack5").StorybookConfig} */
|
|
17
|
+
module.exports = {
|
|
18
|
+
stories: paths.src
|
|
19
|
+
.filter((srcPath) => fs.statSync(srcPath).isDirectory())
|
|
20
|
+
.map((srcPath) => path.join(srcPath, '**/*.stories.@(js|ts|tsx)')),
|
|
21
|
+
addons: storybookAddons,
|
|
22
|
+
framework: {
|
|
23
|
+
// Storybook looks for a `/preset` entrypoint on the framework package,
|
|
24
|
+
// so we give it the dirname of the resolved path to package.json
|
|
25
|
+
// https://github.com/storybookjs/storybook/blob/aecfa1791f982bef6a06b51d20df3e31dd82b5b4/code/lib/core-common/src/utils/validate-config.ts#L34
|
|
26
|
+
name: path.dirname(
|
|
27
|
+
require.resolve('@storybook/react-webpack5/package.json'),
|
|
28
|
+
),
|
|
29
|
+
options: {},
|
|
30
|
+
},
|
|
31
|
+
core: {
|
|
32
|
+
builder: {
|
|
33
|
+
name: require.resolve('@storybook/builder-webpack5'),
|
|
34
|
+
options: {
|
|
35
|
+
fsCache: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
disableTelemetry: true,
|
|
39
|
+
},
|
|
40
|
+
features: {
|
|
41
|
+
storyStoreV7: storybookStoryStore,
|
|
42
|
+
},
|
|
43
|
+
// sku storybook -> configType === 'DEVELOPMENT'
|
|
44
|
+
// sku build-storybook -> configType === 'PRODUCTION'
|
|
45
|
+
webpackFinal: (config, { configType }) =>
|
|
46
|
+
makeStorybookWebpackConfig(config, {
|
|
47
|
+
isDevServer: configType === 'DEVELOPMENT',
|
|
48
|
+
}),
|
|
49
|
+
babel: (config) => ({
|
|
50
|
+
...config,
|
|
51
|
+
presets: [
|
|
52
|
+
// Includes `@babel/preset-react`
|
|
53
|
+
...config.presets,
|
|
54
|
+
|
|
55
|
+
// Storybook as of 7.0 no longer handles babel stuff for you (other than react)
|
|
56
|
+
// We need to configure TypeScript support ourselves, if we want it
|
|
57
|
+
// https://github.com/storybookjs/storybook/issues/22357#issuecomment-1532548058
|
|
58
|
+
[
|
|
59
|
+
require.resolve('@babel/preset-env'),
|
|
60
|
+
{
|
|
61
|
+
targets: {
|
|
62
|
+
chrome: 100,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
require.resolve('@babel/preset-typescript'),
|
|
68
|
+
{
|
|
69
|
+
allExtensions: true,
|
|
70
|
+
isTSX: true,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
],
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
const { paths } = require('../../context');
|
|
2
|
-
const find = require('lodash/find');
|
|
3
2
|
const { merge: webpackMerge } = require('webpack-merge');
|
|
4
3
|
const makeWebpackConfig = require('../webpack/webpack.config');
|
|
5
4
|
const { resolvePackage } = require('../webpack/utils/resolvePackage');
|
|
6
5
|
|
|
7
6
|
const hot = process.env.SKU_HOT !== 'false';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @param {import("webpack").Configuration} config
|
|
10
|
+
* @param {{isDevServer: boolean}}
|
|
11
|
+
*/
|
|
12
|
+
module.exports = (config, { isDevServer }) => {
|
|
13
|
+
const clientWebpackConfig = makeWebpackConfig({
|
|
14
|
+
isIntegration: true,
|
|
15
|
+
isDevServer,
|
|
16
|
+
hot: isDevServer && hot,
|
|
17
|
+
}).find(({ name }) => name === 'client');
|
|
18
18
|
|
|
19
19
|
// Ensure Storybook's webpack loaders ignore our code :(
|
|
20
20
|
if (config && config.module && Array.isArray(config.module.rules)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const webpack = require('webpack');
|
|
2
|
-
const uniq = require('lodash/uniq');
|
|
3
2
|
const defaultSupportedBrowsers = require('browserslist-config-seek');
|
|
4
3
|
const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin');
|
|
5
4
|
const {
|
|
@@ -32,10 +31,9 @@ class SkuWebpackPlugin {
|
|
|
32
31
|
rootResolution: false,
|
|
33
32
|
...options,
|
|
34
33
|
};
|
|
35
|
-
this.compilePackages =
|
|
36
|
-
...defaultCompilePackages,
|
|
37
|
-
|
|
38
|
-
]);
|
|
34
|
+
this.compilePackages = [
|
|
35
|
+
...new Set([...defaultCompilePackages, ...this.options.compilePackages]),
|
|
36
|
+
];
|
|
39
37
|
this.include = [
|
|
40
38
|
...this.options.include,
|
|
41
39
|
...this.compilePackages.map(resolvePackage),
|
|
@@ -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
|
};
|
|
@@ -1,8 +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
|
|
5
|
-
const path = require('path');
|
|
4
|
+
const path = require('node:path');
|
|
6
5
|
const LoadablePlugin = require('@loadable/webpack-plugin');
|
|
7
6
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
8
7
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
@@ -16,6 +15,7 @@ const { VocabWebpackPlugin } = require('@vocab/webpack');
|
|
|
16
15
|
|
|
17
16
|
const utils = require('./utils');
|
|
18
17
|
const { cwd } = require('../../lib/cwd');
|
|
18
|
+
const { stringifyEnvarValues } = require('../../lib/env');
|
|
19
19
|
|
|
20
20
|
const renderEntry = require.resolve('../../entry/render');
|
|
21
21
|
const libraryRenderEntry = require.resolve('../../entry/libraryRender');
|
|
@@ -58,28 +58,11 @@ const makeWebpackConfig = ({
|
|
|
58
58
|
|
|
59
59
|
const vocabOptions = getVocabConfig();
|
|
60
60
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const valueForEnv = value[args.env];
|
|
69
|
-
|
|
70
|
-
if (typeof valueForEnv === 'undefined') {
|
|
71
|
-
console.log(
|
|
72
|
-
`WARNING: Environment variable "${key}" is missing a value for the "${args.env}" environment`,
|
|
73
|
-
);
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return JSON.stringify(valueForEnv);
|
|
78
|
-
})
|
|
79
|
-
.set('SKU_ENV', JSON.stringify(args.env))
|
|
80
|
-
.set('PORT', JSON.stringify(port))
|
|
81
|
-
.mapKeys((value, key) => `process.env.${key}`)
|
|
82
|
-
.value();
|
|
61
|
+
const envars = stringifyEnvarValues({
|
|
62
|
+
...env,
|
|
63
|
+
SKU_ENV: args.env,
|
|
64
|
+
PORT: port,
|
|
65
|
+
});
|
|
83
66
|
|
|
84
67
|
const resolvedPolyfills = polyfills.map((polyfill) => {
|
|
85
68
|
return require.resolve(polyfill, { paths: [cwd()] });
|
|
@@ -220,7 +203,7 @@ const makeWebpackConfig = ({
|
|
|
220
203
|
...(isDevServer || isIntegration
|
|
221
204
|
? []
|
|
222
205
|
: [bundleAnalyzerPlugin({ name: 'client' })]),
|
|
223
|
-
new webpack.DefinePlugin(
|
|
206
|
+
new webpack.DefinePlugin(envars),
|
|
224
207
|
new webpack.DefinePlugin({
|
|
225
208
|
__SKU_CLIENT_PATH__: JSON.stringify(
|
|
226
209
|
path.relative(cwd(), paths.clientEntry),
|
|
@@ -309,7 +292,7 @@ const makeWebpackConfig = ({
|
|
|
309
292
|
},
|
|
310
293
|
plugins: [
|
|
311
294
|
...(htmlRenderPlugin ? [htmlRenderPlugin.rendererPlugin] : []),
|
|
312
|
-
new webpack.DefinePlugin(
|
|
295
|
+
new webpack.DefinePlugin(envars),
|
|
313
296
|
new webpack.DefinePlugin({
|
|
314
297
|
__SKU_LIBRARY_NAME__: JSON.stringify(libraryName),
|
|
315
298
|
__SKU_LIBRARY_FILE__: JSON.stringify(libraryFile),
|
|
@@ -1,7 +1,6 @@
|
|
|
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
|
-
const lodash = require('lodash');
|
|
5
4
|
const nodeExternals = require('webpack-node-externals');
|
|
6
5
|
const findUp = require('find-up');
|
|
7
6
|
const LoadablePlugin = require('@loadable/webpack-plugin');
|
|
@@ -16,6 +15,7 @@ const args = require('../args');
|
|
|
16
15
|
const { bundleAnalyzerPlugin } = require('./plugins/bundleAnalyzer');
|
|
17
16
|
const utils = require('./utils');
|
|
18
17
|
const { cwd } = require('../../lib/cwd');
|
|
18
|
+
const { stringifyEnvarValues } = require('../../lib/env');
|
|
19
19
|
const {
|
|
20
20
|
paths,
|
|
21
21
|
env,
|
|
@@ -48,27 +48,10 @@ const makeWebpackConfig = ({
|
|
|
48
48
|
|
|
49
49
|
const vocabOptions = getVocabConfig();
|
|
50
50
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
return JSON.stringify(value);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const valueForEnv = value[args.env];
|
|
59
|
-
|
|
60
|
-
if (typeof valueForEnv === 'undefined') {
|
|
61
|
-
console.log(
|
|
62
|
-
`WARNING: Environment variable "${key}" is missing a value for the "${args.env}" environment`,
|
|
63
|
-
);
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return JSON.stringify(valueForEnv);
|
|
68
|
-
})
|
|
69
|
-
.set('SKU_ENV', JSON.stringify(args.env))
|
|
70
|
-
.mapKeys((value, key) => `process.env.${key}`)
|
|
71
|
-
.value();
|
|
51
|
+
const envars = stringifyEnvarValues({
|
|
52
|
+
...env,
|
|
53
|
+
SKU_ENV: args.env,
|
|
54
|
+
});
|
|
72
55
|
|
|
73
56
|
const internalInclude = [path.join(__dirname, '../../entry'), ...paths.src];
|
|
74
57
|
|
|
@@ -173,7 +156,7 @@ const makeWebpackConfig = ({
|
|
|
173
156
|
],
|
|
174
157
|
},
|
|
175
158
|
plugins: [
|
|
176
|
-
new webpack.DefinePlugin(
|
|
159
|
+
new webpack.DefinePlugin(envars),
|
|
177
160
|
new LoadablePlugin({
|
|
178
161
|
filename: webpackStatsFilename,
|
|
179
162
|
writeToDisk: true,
|
|
@@ -268,7 +251,7 @@ const makeWebpackConfig = ({
|
|
|
268
251
|
rules: [{ test: /\.mjs$/, type: 'javascript/auto' }],
|
|
269
252
|
},
|
|
270
253
|
plugins: [
|
|
271
|
-
new webpack.DefinePlugin(
|
|
254
|
+
new webpack.DefinePlugin(envars),
|
|
272
255
|
new webpack.DefinePlugin({
|
|
273
256
|
__SKU_DEFAULT_SERVER_PORT__: JSON.stringify(serverPort),
|
|
274
257
|
__SKU_PUBLIC_PATH__: JSON.stringify(publicPath),
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
|
|
5
5
|
const { cwd: skuCwd } = require('../lib/cwd');
|
|
6
6
|
const toPosixPath = require('../lib/toPosixPath');
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { rootDir, isPnpm } = require('../lib/packageManager');
|
|
9
9
|
|
|
10
10
|
/** @type {string[]} */
|
|
11
11
|
let detectedCompilePackages = [];
|
|
@@ -14,9 +14,7 @@ try {
|
|
|
14
14
|
const globs = ['node_modules/@seek/*/package.json'];
|
|
15
15
|
const cwd = skuCwd();
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (tool === 'pnpm') {
|
|
17
|
+
if (isPnpm && rootDir) {
|
|
20
18
|
const pnpmVirtualStorePath = path.join(
|
|
21
19
|
toPosixPath(rootDir),
|
|
22
20
|
'node_modules/.pnpm',
|
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');
|
|
@@ -19,8 +19,10 @@ const getSkuConfig = () => {
|
|
|
19
19
|
const tsPath = getPathFromCwd('sku.config.ts');
|
|
20
20
|
const jsPath = getPathFromCwd('sku.config.js');
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const customSkuConfig = args.config || process.env.SKU_CONFIG;
|
|
23
|
+
|
|
24
|
+
if (customSkuConfig) {
|
|
25
|
+
appSkuConfigPath = getPathFromCwd(customSkuConfig);
|
|
24
26
|
} else if (fs.existsSync(tsPath)) {
|
|
25
27
|
appSkuConfigPath = tsPath;
|
|
26
28
|
} else if (fs.existsSync(jsPath)) {
|
|
@@ -65,6 +67,9 @@ if (isCompilePackage && skuConfig.rootResolution) {
|
|
|
65
67
|
process.exit(1);
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
/**
|
|
71
|
+
* @type {Record<string, unknown>}
|
|
72
|
+
*/
|
|
68
73
|
const env = {
|
|
69
74
|
...skuConfig.env,
|
|
70
75
|
SKU_TENANT: args.tenant,
|
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
|
|
package/entry/server/index.js
CHANGED
|
@@ -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
|
|
package/entry/server/server.js
CHANGED
package/lib/buildFileUtils.js
CHANGED
package/lib/certificate.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
const selfsigned = require('selfsigned');
|
|
2
2
|
const { blue } = require('chalk');
|
|
3
3
|
const exists = require('./exists');
|
|
4
|
-
const {
|
|
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,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const
|
|
2
|
+
|
|
3
|
+
const { writeFile, rm } = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
4
5
|
|
|
5
6
|
const ensureGitignore = require('ensure-gitignore');
|
|
6
7
|
const { cwd, getPathFromCwd } = require('./cwd');
|
|
@@ -13,12 +14,14 @@ const prettierConfig = require('../config/prettier/prettierConfig');
|
|
|
13
14
|
const eslintConfig = require('../config/eslint/eslintConfig');
|
|
14
15
|
const createTSConfig = require('../config/typescript/tsconfig.js');
|
|
15
16
|
const getCertificate = require('./certificate');
|
|
17
|
+
const { storybookMainConfigPath } = require('./storybook');
|
|
18
|
+
const managedConfigBanner = require('./managedConfigBanner.js');
|
|
19
|
+
|
|
16
20
|
const coverageFolder = 'coverage';
|
|
17
21
|
|
|
18
22
|
const convertToForwardSlashPaths = (pathStr) => pathStr.replace(/\\/g, '/');
|
|
19
23
|
const addSep = (p) => `${p}${path.sep}`;
|
|
20
|
-
const prependBanner = (str) =>
|
|
21
|
-
`/** THIS FILE IS GENERATED BY SKU, MANUAL CHANGES WILL BE DISCARDED **/\n${str}`;
|
|
24
|
+
const prependBanner = (str) => `${managedConfigBanner}\n${str}`;
|
|
22
25
|
|
|
23
26
|
const writeFileToCWD = async (fileName, content, { banner = true } = {}) => {
|
|
24
27
|
const outPath = getPathFromCwd(fileName);
|
|
@@ -33,11 +36,13 @@ module.exports = async () => {
|
|
|
33
36
|
const gitIgnorePatterns = [
|
|
34
37
|
addSep(bundleReportFolder),
|
|
35
38
|
addSep(coverageFolder),
|
|
39
|
+
storybookMainConfigPath,
|
|
36
40
|
];
|
|
37
41
|
const lintIgnorePatterns = [
|
|
38
42
|
addSep(bundleReportFolder),
|
|
39
43
|
addSep(coverageFolder),
|
|
40
44
|
'*.less.d.ts',
|
|
45
|
+
storybookMainConfigPath,
|
|
41
46
|
];
|
|
42
47
|
|
|
43
48
|
// Ignore webpack target directories
|
|
@@ -51,8 +56,9 @@ module.exports = async () => {
|
|
|
51
56
|
|
|
52
57
|
// Generate ESLint configuration
|
|
53
58
|
const eslintConfigFilename = '.eslintrc';
|
|
59
|
+
const eslintCacheFilename = '.eslintcache';
|
|
54
60
|
await writeFileToCWD(eslintConfigFilename, eslintConfig);
|
|
55
|
-
gitIgnorePatterns.push(eslintConfigFilename);
|
|
61
|
+
gitIgnorePatterns.push(eslintConfigFilename, eslintCacheFilename);
|
|
56
62
|
|
|
57
63
|
// Generate Prettier configuration
|
|
58
64
|
// NOTE: We are not generating a banner as prettier does not support the `JSON
|
package/lib/copyDirContents.js
CHANGED
package/lib/createServer.js
CHANGED
package/lib/cwd.js
CHANGED