sku 11.13.0 → 12.0.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/@storybook/react/index.ts +1 -12
- package/CHANGELOG.md +119 -0
- package/bin/sku.js +9 -7
- package/config/babel/babelConfig.js +0 -3
- package/config/eslint/importOrderConfig.js +1 -1
- package/config/jest/jestConfig.js +0 -8
- package/config/storybook/build/main.js +1 -1
- package/config/storybook/config.js +36 -5
- package/config/storybook/start/main.js +1 -1
- package/config/webpack/plugins/createHtmlRenderPlugin.js +0 -3
- package/config/webpack/plugins/metrics-plugin/index.js +1 -43
- package/config/webpack/plugins/sku-webpack-plugin/index.js +2 -12
- package/config/webpack/utils/loaders.js +0 -1
- package/config/webpack/webpack.config.js +1 -3
- package/config/webpack/webpack.config.ssr.js +1 -1
- package/context/configSchema.js +3 -0
- package/context/defaultCompilePackages.js +1 -6
- package/context/defaultSkuConfig.js +1 -0
- package/context/index.js +1 -0
- package/lib/configure.js +1 -38
- package/lib/validateLessFiles.js +38 -0
- package/lib/validatePeerDeps.js +1 -1
- package/package.json +18 -23
- package/scripts/build-storybook.js +2 -1
- package/scripts/init.js +3 -8
- package/scripts/postinstall.js +16 -5
- package/scripts/storybook.js +6 -4
- package/sku-types.d.ts +10 -0
- package/config/webpack/plugins/createTreatPlugin.js +0 -55
- package/react-treat/index.ts +0 -3
- package/treat/index.ts +0 -42
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
// This is provided so consumers can import `sku/@storybook/react`,
|
|
2
2
|
// since they don't depend on `@storybook/react` directly.
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
addDecorator,
|
|
6
|
-
addParameters,
|
|
7
|
-
configure,
|
|
8
|
-
setAddon,
|
|
9
|
-
storiesOf,
|
|
10
|
-
forceReRender,
|
|
11
|
-
getStorybook,
|
|
12
|
-
type Meta,
|
|
13
|
-
type StoryObj,
|
|
14
|
-
type DecoratorFn,
|
|
15
|
-
} from '@storybook/react';
|
|
4
|
+
export * from '@storybook/react';
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,124 @@
|
|
|
1
1
|
# sku
|
|
2
2
|
|
|
3
|
+
## 12.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Check that paths exist before looking for `*.less` files in them ([#817](https://github.com/seek-oss/sku/pull/817))
|
|
8
|
+
|
|
9
|
+
## 12.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- Drop support for styling with [treat]. Please [migrate] styles to [Vanilla Extract]. ([#809](https://github.com/seek-oss/sku/pull/809))
|
|
14
|
+
|
|
15
|
+
[treat]: https://seek-oss.github.io/treat/
|
|
16
|
+
[migrate]: https://github.com/seek-oss/braid-design-system/blob/e42c6f9168904f6b607c74157cafebf9b0147489/docs/treat%20to%20vanilla-extract%20migration.md
|
|
17
|
+
[Vanilla Extract]: https://vanilla-extract.style/documentation/getting-started
|
|
18
|
+
|
|
19
|
+
- Remove workaround for `classnames` package issue ([#803](https://github.com/seek-oss/sku/pull/803))
|
|
20
|
+
|
|
21
|
+
A workaround for [a bug in the `classnames`][bug] package has been removed now that the bug has been fixed.
|
|
22
|
+
|
|
23
|
+
Please evaluate whether you need to use `classnames` library in your app.
|
|
24
|
+
Prefer using [Braid's `Box` component, which supports the full `clsx` API][box], instead.
|
|
25
|
+
If you need to construct class name strings for components other than `Box`, prefer [the `clsx` package][clsx] over the `classnames` package.
|
|
26
|
+
|
|
27
|
+
[bug]: https://github.com/JedWatson/classnames/issues/240
|
|
28
|
+
[box]: https://seek-oss.github.io/braid-design-system/components/Box/#dynamic-css-classes
|
|
29
|
+
[clsx]: https://github.com/lukeed/clsx
|
|
30
|
+
|
|
31
|
+
- `sku init` no longer installs and configures husky for you ([#804](https://github.com/seek-oss/sku/pull/804))
|
|
32
|
+
|
|
33
|
+
BREAKING CHANGE
|
|
34
|
+
|
|
35
|
+
`sku init` no longer adds `husky` as a dependecy nor does it configure husky for you out of the box.
|
|
36
|
+
For instructions on how to set up `husky` to use sku's pre-commit hook, see [the docs].
|
|
37
|
+
|
|
38
|
+
[the docs]: https://seek-oss.github.io/sku/#/./docs/extra-features?id=pre-commit-hook
|
|
39
|
+
|
|
40
|
+
- Support Storybook v7 ([#810](https://github.com/seek-oss/sku/pull/810))
|
|
41
|
+
|
|
42
|
+
sku now supports Storybook v7. Please read [the Storybook migration guide] for a high-level overview of what has changed. For a more detailed list of changes, take a look at [the full migration notes].
|
|
43
|
+
**NOTE**: Since sku installs and configures Storybook for you, a lot of the changes will not be relevant to users.
|
|
44
|
+
|
|
45
|
+
**BREAKING CHANGE**
|
|
46
|
+
|
|
47
|
+
As of Storybook v7, stories that use the `storiesOf` API will not work by default. The `storiesOf` API is deprecated and will be removed in Storybook v8, so it is highly encouraged to migrate your stories to the [Component Story Format (CSF)][csf].
|
|
48
|
+
|
|
49
|
+
Migration can be done automatically via the migration tools provided by Storybook:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npx storybook@7 migrate storiesof-to-csf --glob="src/**/*.stories.tsx"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
After doing this migration, your stories may need some manual cleanup to function correctly, such as adding [a default metadata export][meta].
|
|
56
|
+
|
|
57
|
+
When your stories are working, you can also optionally migrate to the newer [CSF 3]:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npx storybook@7 migrate csf-2-to-3 --glob="src/**/*.stories.tsx"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If you cannot migrate your stories to CSF, or you need to dynamically generate stories with `storiesOf` (see [this issue][storiesof issue] for more info on the future of the `storiesOf` API), you can set the `storybookStoryStore` flag to `false` in your sku config:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { type SkuConfig } from 'sku';
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
storybookStoryStore: false,
|
|
70
|
+
} satisfies SkuConfig;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
[the storybook migration guide]: https://storybook.js.org/docs/react/migration-guide#page-top
|
|
74
|
+
[the full migration notes]: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-65x-to-700
|
|
75
|
+
[csf]: https://storybook.js.org/docs/react/api/csf
|
|
76
|
+
[meta]: https://storybook.js.org/docs/react/api/csf#default-export
|
|
77
|
+
[csf 3]: https://storybook.js.org/blog/storybook-csf3-is-here/
|
|
78
|
+
[storiesof issue]: https://github.com/storybookjs/storybook/issues/9828#issuecomment-1370291568
|
|
79
|
+
|
|
80
|
+
- Drop support for [`seek-style-guide`] ([#803](https://github.com/seek-oss/sku/pull/803))
|
|
81
|
+
|
|
82
|
+
BREAKING CHANGE
|
|
83
|
+
|
|
84
|
+
`seek-style-guide` is no longer supported by sku. Flow support was already removed from sku in [v11], so
|
|
85
|
+
any `seek-style-guide` components that use flow currently don't work with sku. However, there were remnants
|
|
86
|
+
of `seek-style-guide` still present in sku's codebase. Specifically, import optimization and
|
|
87
|
+
component mocking. These features have now been removed. Please migrate to [`braid-design-system`].
|
|
88
|
+
|
|
89
|
+
[`seek-style-guide`]: https://github.com/seek-oss/seek-style-guide
|
|
90
|
+
[v11]: https://github.com/seek-oss/sku/releases/tag/v11.0.0
|
|
91
|
+
[`braid-design-system`]: https://seek-oss.github.io/braid-design-system/
|
|
92
|
+
|
|
93
|
+
- Require Node.js 18.12+ ([#805](https://github.com/seek-oss/sku/pull/805))
|
|
94
|
+
|
|
95
|
+
**BREAKING CHANGE**
|
|
96
|
+
|
|
97
|
+
Node 14 has already reached end of life as of April 2023, and Node.js 16 had its end of life date [brought forward to September 2023][node 16 eol], so in the interest of preventing another breaking change in 4 months time, we're pre-emptively dropping support for Node.js 16 in addition to Node.js 14.
|
|
98
|
+
We've chosen to support Node.js versions from v18.12 onwards as this version was the first [Node.js 18 LTS release][node 18.12 release].
|
|
99
|
+
|
|
100
|
+
Consider upgrading the Node.js version for your project across:
|
|
101
|
+
|
|
102
|
+
- `.nvmrc`
|
|
103
|
+
- `package.json#/engines/node`
|
|
104
|
+
- `@types/node` package version
|
|
105
|
+
- CI/CD configuration (`.buildkite/pipeline.yml`, `Dockerfile`, etc.)
|
|
106
|
+
|
|
107
|
+
[node 16 eol]: https://nodejs.org/en/blog/announcements/nodejs16-eol
|
|
108
|
+
[node 18.12 release]: https://nodejs.org/en/blog/release/v18.12.0
|
|
109
|
+
|
|
110
|
+
### Minor Changes
|
|
111
|
+
|
|
112
|
+
- Re-export all of `@storybook/react` ([#810](https://github.com/seek-oss/sku/pull/810))
|
|
113
|
+
|
|
114
|
+
Previously, only specific APIs were re-exported under `sku/@storybook/react`. All APIs are now re-exported.
|
|
115
|
+
|
|
116
|
+
- Upgrade to TypeScript 5.0 ([#813](https://github.com/seek-oss/sku/pull/813))
|
|
117
|
+
|
|
118
|
+
This major release includes breaking changes. See the [TypeScript 5.0 announcement][ts5] for more information.
|
|
119
|
+
|
|
120
|
+
[ts5]: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/
|
|
121
|
+
|
|
3
122
|
## 11.13.0
|
|
4
123
|
|
|
5
124
|
### Minor Changes
|
package/bin/sku.js
CHANGED
|
@@ -3,6 +3,7 @@ const fs = require('fs');
|
|
|
3
3
|
const debug = require('debug');
|
|
4
4
|
const args = require('../config/args');
|
|
5
5
|
const _validatePeerDeps = require('../lib/validatePeerDeps');
|
|
6
|
+
const validateLessFiles = require('../lib/validateLessFiles');
|
|
6
7
|
const { getPathFromCwd } = require('../lib/cwd');
|
|
7
8
|
const log = debug('sku:bin');
|
|
8
9
|
|
|
@@ -62,8 +63,10 @@ log(`Starting script: ${script}`);
|
|
|
62
63
|
case 'setup-hosts':
|
|
63
64
|
case 'init':
|
|
64
65
|
case 'configure': {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
if (script !== 'init') {
|
|
67
|
+
validateLessFiles();
|
|
68
|
+
}
|
|
69
|
+
return runScript(script);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
case 'test':
|
|
@@ -72,8 +75,8 @@ log(`Starting script: ${script}`);
|
|
|
72
75
|
case 'pre-commit':
|
|
73
76
|
case 'translations': {
|
|
74
77
|
await configureProject();
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
validateLessFiles();
|
|
79
|
+
return runScript(script);
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
case 'start':
|
|
@@ -84,10 +87,9 @@ log(`Starting script: ${script}`);
|
|
|
84
87
|
case 'build-ssr':
|
|
85
88
|
case 'serve': {
|
|
86
89
|
await configureProject();
|
|
87
|
-
|
|
90
|
+
validateLessFiles();
|
|
88
91
|
validatePeerDeps();
|
|
89
|
-
runScript(script);
|
|
90
|
-
break;
|
|
92
|
+
return runScript(script);
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
default: {
|
|
@@ -23,7 +23,6 @@ module.exports = ({
|
|
|
23
23
|
],
|
|
24
24
|
require.resolve('babel-plugin-macros'),
|
|
25
25
|
require.resolve('@loadable/babel-plugin'),
|
|
26
|
-
[require.resolve('babel-plugin-treat'), { alias: 'sku/treat' }],
|
|
27
26
|
require.resolve('@babel/plugin-transform-runtime'),
|
|
28
27
|
];
|
|
29
28
|
|
|
@@ -36,8 +35,6 @@ module.exports = ({
|
|
|
36
35
|
|
|
37
36
|
if (isJest) {
|
|
38
37
|
plugins.push(require.resolve('babel-plugin-dynamic-import-node'));
|
|
39
|
-
} else {
|
|
40
|
-
plugins.push(require.resolve('babel-plugin-seek-style-guide'));
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
if (isProductionBuild) {
|
|
@@ -25,14 +25,6 @@ module.exports = {
|
|
|
25
25
|
moduleNameMapper: {
|
|
26
26
|
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|svg)$':
|
|
27
27
|
require.resolve('./fileMock'),
|
|
28
|
-
|
|
29
|
-
// Mock seek-style-guide components
|
|
30
|
-
// with a proxy object that echoes back the import name as a string,
|
|
31
|
-
// e.g. `import { Text } from 'seek-style-guide/react'` resolves
|
|
32
|
-
// to the string 'Text'. This way, snapshot tests won't break when
|
|
33
|
-
// these packages get updated, which happens regularly. There's
|
|
34
|
-
// still room for debate about whether this is a good idea or not...
|
|
35
|
-
'^seek-style-guide/react': require.resolve('identity-obj-proxy'),
|
|
36
28
|
},
|
|
37
29
|
transform: {
|
|
38
30
|
'\\.less$': require.resolve('./cssModulesTransform.js'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../config';
|
|
@@ -1,13 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
import { paths, storybookAddons, storybookStoryStore } from '../../context';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
|
|
8
|
+
/** @type {import("@storybook/react-webpack5").StorybookConfig} */
|
|
9
|
+
export default {
|
|
6
10
|
stories: paths.src
|
|
7
11
|
.filter((srcPath) => fs.statSync(srcPath).isDirectory())
|
|
8
12
|
.map((srcPath) => path.join(srcPath, '**/*.stories.@(js|ts|tsx)')),
|
|
9
13
|
addons: storybookAddons,
|
|
14
|
+
framework: {
|
|
15
|
+
name: '@storybook/react-webpack5',
|
|
16
|
+
options: {},
|
|
17
|
+
},
|
|
10
18
|
core: {
|
|
11
|
-
builder:
|
|
19
|
+
builder: {
|
|
20
|
+
name: '@storybook/builder-webpack5',
|
|
21
|
+
options: {
|
|
22
|
+
fsCache: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
features: {
|
|
27
|
+
storyStoreV7: storybookStoryStore,
|
|
12
28
|
},
|
|
29
|
+
babel: (config) => ({
|
|
30
|
+
...config,
|
|
31
|
+
presets: [
|
|
32
|
+
...config.presets,
|
|
33
|
+
[
|
|
34
|
+
require.resolve('@babel/preset-env'),
|
|
35
|
+
{
|
|
36
|
+
targets: {
|
|
37
|
+
chrome: 100,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
require.resolve('@babel/preset-typescript'),
|
|
42
|
+
],
|
|
43
|
+
}),
|
|
13
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../config';
|
|
@@ -121,9 +121,6 @@ module.exports = () => {
|
|
|
121
121
|
transformFilePath: transformOutputPath,
|
|
122
122
|
mapStatsToParams,
|
|
123
123
|
extraGlobals: {
|
|
124
|
-
// This fixes an issue where one of treats deps (@hapi/joek)
|
|
125
|
-
// accesses Buffer globally. Not great...
|
|
126
|
-
Buffer,
|
|
127
124
|
// Allows Date serialization checks to work in render e.g. `myDate instance Date`
|
|
128
125
|
Date,
|
|
129
126
|
},
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
const { performance } = require('perf_hooks');
|
|
2
2
|
const prettyMilliseconds = require('pretty-ms');
|
|
3
3
|
const debug = require('debug')('sku:metrics');
|
|
4
|
-
const chalk = require('chalk');
|
|
5
|
-
|
|
6
|
-
const { persistentCache } = require('../../../../context');
|
|
7
|
-
const banner = require('../../../../lib/banner');
|
|
8
4
|
const track = require('../../../../telemetry');
|
|
9
5
|
|
|
10
6
|
const smp = 'sku-metrics-plugin';
|
|
@@ -14,7 +10,6 @@ class MetricsPlugin {
|
|
|
14
10
|
this.initial = true;
|
|
15
11
|
this.target = target;
|
|
16
12
|
this.type = type;
|
|
17
|
-
this.builtTreatFiles = new Set();
|
|
18
13
|
this.builtLessFiles = new Set();
|
|
19
14
|
}
|
|
20
15
|
|
|
@@ -32,10 +27,6 @@ class MetricsPlugin {
|
|
|
32
27
|
target: this.target,
|
|
33
28
|
type: this.type,
|
|
34
29
|
});
|
|
35
|
-
track.gauge('start.files.initial.treat', this.builtTreatFiles.size, {
|
|
36
|
-
target: this.target,
|
|
37
|
-
type: this.type,
|
|
38
|
-
});
|
|
39
30
|
track.gauge('start.files.initial.less', this.builtLessFiles.size, {
|
|
40
31
|
target: this.target,
|
|
41
32
|
type: this.type,
|
|
@@ -51,56 +42,23 @@ class MetricsPlugin {
|
|
|
51
42
|
target: this.target,
|
|
52
43
|
type: this.type,
|
|
53
44
|
});
|
|
54
|
-
track.gauge('start.files.rebuild.treat', this.builtTreatFiles.size, {
|
|
55
|
-
target: this.target,
|
|
56
|
-
type: this.type,
|
|
57
|
-
});
|
|
58
45
|
track.gauge('start.files.rebuild.less', this.builtLessFiles.size, {
|
|
59
46
|
target: this.target,
|
|
60
47
|
type: this.type,
|
|
61
48
|
});
|
|
62
49
|
}
|
|
63
50
|
|
|
64
|
-
this.builtTreatFiles.clear();
|
|
65
51
|
this.builtLessFiles.clear();
|
|
66
52
|
});
|
|
67
53
|
|
|
68
54
|
compiler.hooks.thisCompilation.tap(smp, (compilation) => {
|
|
69
55
|
compilation.hooks.buildModule.tap(smp, (module) => {
|
|
70
56
|
if (module.resource) {
|
|
71
|
-
if (module.resource.endsWith('.
|
|
72
|
-
this.builtTreatFiles.add(module.resource);
|
|
73
|
-
} else if (module.resource.endsWith('.less')) {
|
|
57
|
+
if (module.resource.endsWith('.less')) {
|
|
74
58
|
this.builtLessFiles.add(module.resource);
|
|
75
59
|
}
|
|
76
60
|
}
|
|
77
61
|
});
|
|
78
|
-
|
|
79
|
-
if (persistentCache) {
|
|
80
|
-
compilation.hooks.finishModules.tap(smp, () => {
|
|
81
|
-
const internalTreatFiles = Array.from(this.builtTreatFiles).filter(
|
|
82
|
-
(treatFile) => !treatFile.match(/node_modules|braid-design-system/),
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
if (internalTreatFiles.length > 0) {
|
|
86
|
-
const treatFileNumMsg =
|
|
87
|
-
internalTreatFiles.length > 1
|
|
88
|
-
? `${internalTreatFiles.length} treat files were`
|
|
89
|
-
: `A treat file was`;
|
|
90
|
-
|
|
91
|
-
banner(
|
|
92
|
-
'error',
|
|
93
|
-
`${treatFileNumMsg} detected within your project while using 'persistentCache' mode.`,
|
|
94
|
-
[
|
|
95
|
-
`Set '${chalk.bold(
|
|
96
|
-
'persistentCache: false',
|
|
97
|
-
)}' in your sku.config.js until all treat files have been removed from the project.`,
|
|
98
|
-
],
|
|
99
|
-
);
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
62
|
});
|
|
105
63
|
}
|
|
106
64
|
}
|
|
@@ -14,7 +14,6 @@ const {
|
|
|
14
14
|
SVG,
|
|
15
15
|
resolvePackage,
|
|
16
16
|
} = require('../../utils');
|
|
17
|
-
const createTreatPlugin = require('../createTreatPlugin');
|
|
18
17
|
const defaultCompilePackages = require('../../../../context/defaultCompilePackages');
|
|
19
18
|
const validateOptions = require('./validateOptions');
|
|
20
19
|
|
|
@@ -50,7 +49,6 @@ class SkuWebpackPlugin {
|
|
|
50
49
|
generateCSSTypes,
|
|
51
50
|
browserslist,
|
|
52
51
|
mode = compiler.options.mode,
|
|
53
|
-
libraryName,
|
|
54
52
|
displayNamesProd,
|
|
55
53
|
removeAssertionsInProduction,
|
|
56
54
|
MiniCssExtractPlugin,
|
|
@@ -65,7 +63,7 @@ class SkuWebpackPlugin {
|
|
|
65
63
|
include: this.include,
|
|
66
64
|
oneOf: [
|
|
67
65
|
{
|
|
68
|
-
compiler: /(vanilla-extract
|
|
66
|
+
compiler: /(vanilla-extract)/,
|
|
69
67
|
use: makeJsLoaders({
|
|
70
68
|
target: 'node',
|
|
71
69
|
lang: 'ts',
|
|
@@ -94,7 +92,7 @@ class SkuWebpackPlugin {
|
|
|
94
92
|
include: this.include,
|
|
95
93
|
oneOf: [
|
|
96
94
|
{
|
|
97
|
-
compiler: /(vanilla-extract
|
|
95
|
+
compiler: /(vanilla-extract)/,
|
|
98
96
|
use: makeJsLoaders({
|
|
99
97
|
target: 'node',
|
|
100
98
|
lang: 'js',
|
|
@@ -204,14 +202,6 @@ class SkuWebpackPlugin {
|
|
|
204
202
|
}
|
|
205
203
|
}
|
|
206
204
|
|
|
207
|
-
createTreatPlugin({
|
|
208
|
-
target,
|
|
209
|
-
isProductionBuild,
|
|
210
|
-
libraryName,
|
|
211
|
-
browserslist,
|
|
212
|
-
MiniCssExtractPlugin,
|
|
213
|
-
}).apply(compiler);
|
|
214
|
-
|
|
215
205
|
new VanillaExtractPlugin({
|
|
216
206
|
identifiers: isProductionBuild ? 'short' : 'debug',
|
|
217
207
|
outputCss: target === 'browser',
|
|
@@ -275,14 +275,12 @@ const makeWebpackConfig = ({
|
|
|
275
275
|
externalizeNodeModules
|
|
276
276
|
? nodeExternals({
|
|
277
277
|
allowlist: [
|
|
278
|
-
'classnames', // Workaround for https://github.com/JedWatson/classnames/issues/240
|
|
279
|
-
|
|
280
278
|
// Include '@babel/runtime' in render builds to workaround ESM imports in html-render-webpack-plugin
|
|
281
279
|
/@babel\/runtime/,
|
|
282
280
|
|
|
283
281
|
// webpack-node-externals compares the `import` or `require` expression to this list,
|
|
284
282
|
// not the package name, so we map each packageName to a pattern. This ensures it
|
|
285
|
-
// matches when importing a file within a package e.g. import {
|
|
283
|
+
// matches when importing a file within a package e.g. import { MyComponent } from '@seek/my-component-package'.
|
|
286
284
|
...paths.compilePackages.map(
|
|
287
285
|
(packageName) => new RegExp(`^(${packageName})`),
|
|
288
286
|
),
|
|
@@ -232,7 +232,7 @@ const makeWebpackConfig = ({
|
|
|
232
232
|
allowlist: [
|
|
233
233
|
// webpack-node-externals compares the `import` or `require` expression to this list,
|
|
234
234
|
// not the package name, so we map each packageName to a pattern. This ensures it
|
|
235
|
-
// matches when importing a file within a package e.g. import {
|
|
235
|
+
// matches when importing a file within a package e.g. import { MyComponent } from '@seek/my-component-package'.
|
|
236
236
|
...paths.compilePackages.map(
|
|
237
237
|
(packageName) => new RegExp(`^(${packageName})`),
|
|
238
238
|
),
|
package/context/configSchema.js
CHANGED
package/context/index.js
CHANGED
package/lib/configure.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { writeFile, rm } = require('fs/promises');
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const glob = require('fast-glob');
|
|
5
|
-
const fs = require('fs');
|
|
6
4
|
|
|
7
5
|
const ensureGitignore = require('ensure-gitignore');
|
|
8
6
|
const { cwd, getPathFromCwd } = require('./cwd');
|
|
@@ -11,8 +9,6 @@ const { paths, httpsDevServer, languages } = require('../context');
|
|
|
11
9
|
const {
|
|
12
10
|
bundleReportFolder,
|
|
13
11
|
} = require('../config/webpack/plugins/bundleAnalyzer');
|
|
14
|
-
const printBanner = require('../lib/banner');
|
|
15
|
-
const chalk = require('chalk');
|
|
16
12
|
const prettierConfig = require('../config/prettier/prettierConfig');
|
|
17
13
|
const eslintConfig = require('../config/eslint/eslintConfig');
|
|
18
14
|
const createTSConfig = require('../config/typescript/tsconfig.js');
|
|
@@ -32,12 +28,7 @@ const writeFileToCWD = async (fileName, content, { banner = true } = {}) => {
|
|
|
32
28
|
await writeFile(outPath, contentStr);
|
|
33
29
|
};
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
* @typedef {object} Options
|
|
37
|
-
* @property {boolean | undefined} isPostInit
|
|
38
|
-
* @param {Options}
|
|
39
|
-
*/
|
|
40
|
-
module.exports = async ({ isPostInit } = {}) => {
|
|
31
|
+
module.exports = async () => {
|
|
41
32
|
// Ignore webpack bundle report output
|
|
42
33
|
const gitIgnorePatterns = [
|
|
43
34
|
addSep(bundleReportFolder),
|
|
@@ -118,32 +109,4 @@ module.exports = async ({ isPostInit } = {}) => {
|
|
|
118
109
|
comment: 'managed by sku',
|
|
119
110
|
patterns: gitIgnorePatterns.map(convertToForwardSlashPaths),
|
|
120
111
|
});
|
|
121
|
-
|
|
122
|
-
// Check for `.less` files only if we haven't just done an init
|
|
123
|
-
if (!isPostInit) {
|
|
124
|
-
const lessFileGlobResults = await Promise.all(
|
|
125
|
-
paths.src
|
|
126
|
-
.filter((srcPath) => fs.statSync(srcPath).isDirectory())
|
|
127
|
-
.map(async (srcPath) => await glob(path.join(srcPath, '**/*.less'))),
|
|
128
|
-
);
|
|
129
|
-
const srcHasLessFiles = lessFileGlobResults.some(
|
|
130
|
-
(fileArray) => fileArray.length > 0,
|
|
131
|
-
);
|
|
132
|
-
if (srcHasLessFiles) {
|
|
133
|
-
printBanner('warning', 'LESS styles detected', [
|
|
134
|
-
`Support for ${chalk.bold('LESS')} has been deprecated.`,
|
|
135
|
-
`${chalk.bold(
|
|
136
|
-
'Vanilla Extract',
|
|
137
|
-
)} is the preferred styling solution supported by ${chalk.bold(
|
|
138
|
-
'sku',
|
|
139
|
-
)}, and support for ${chalk.bold(
|
|
140
|
-
'LESS',
|
|
141
|
-
)} will be removed in a future release.`,
|
|
142
|
-
`Consumers are encouraged to migrate to ${chalk.bold(
|
|
143
|
-
'Vanilla Extract',
|
|
144
|
-
)} at the earliest opportunity.`,
|
|
145
|
-
'https://seek-oss.github.io/sku/#/./docs/styling?id=vanilla-extract',
|
|
146
|
-
]);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
112
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const glob = require('fast-glob');
|
|
4
|
+
const chalk = require('chalk');
|
|
5
|
+
|
|
6
|
+
const printBanner = require('./banner');
|
|
7
|
+
const exists = require('./exists');
|
|
8
|
+
const { paths } = require('../context');
|
|
9
|
+
|
|
10
|
+
module.exports = async () => {
|
|
11
|
+
const srcPathsExist = await Promise.all(
|
|
12
|
+
paths.src.map(async (srcPath) => (await exists(srcPath)) && srcPath),
|
|
13
|
+
);
|
|
14
|
+
const lessFileGlobResults = await Promise.all(
|
|
15
|
+
srcPathsExist
|
|
16
|
+
.filter((srcPath) => srcPath && fs.statSync(srcPath).isDirectory())
|
|
17
|
+
.map(async (srcPath) => await glob(path.join(srcPath, '**/*.less'))),
|
|
18
|
+
);
|
|
19
|
+
const srcHasLessFiles = lessFileGlobResults.some(
|
|
20
|
+
(fileArray) => fileArray.length > 0,
|
|
21
|
+
);
|
|
22
|
+
if (srcHasLessFiles) {
|
|
23
|
+
printBanner('warning', 'LESS styles detected', [
|
|
24
|
+
`Support for ${chalk.bold('LESS')} has been deprecated.`,
|
|
25
|
+
`${chalk.bold(
|
|
26
|
+
'Vanilla Extract',
|
|
27
|
+
)} is the preferred styling solution supported by ${chalk.bold(
|
|
28
|
+
'sku',
|
|
29
|
+
)}, and support for ${chalk.bold(
|
|
30
|
+
'LESS',
|
|
31
|
+
)} will be removed in a future release.`,
|
|
32
|
+
`Consumers are encouraged to migrate to ${chalk.bold(
|
|
33
|
+
'Vanilla Extract',
|
|
34
|
+
)} at the earliest opportunity.`,
|
|
35
|
+
'https://seek-oss.github.io/sku/#/./docs/styling?id=vanilla-extract',
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
};
|
package/lib/validatePeerDeps.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sku",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "Front-end development toolkit, powered by Webpack, Babel, CSS Modules, Less and Jest",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"sku": "./bin/sku.js"
|
|
8
8
|
},
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=18.12"
|
|
11
11
|
},
|
|
12
12
|
"types": "./sku-types.d.ts",
|
|
13
13
|
"repository": {
|
|
@@ -25,22 +25,23 @@
|
|
|
25
25
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@babel/core": "^7.
|
|
29
|
-
"@babel/plugin-transform-react-constant-elements": "^7.
|
|
30
|
-
"@babel/plugin-transform-react-inline-elements": "^7.
|
|
31
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
32
|
-
"@babel/preset-env": "^7.
|
|
33
|
-
"@babel/preset-react": "^7.18.
|
|
34
|
-
"@babel/preset-typescript": "^7.
|
|
35
|
-
"@babel/runtime": "^7.
|
|
28
|
+
"@babel/core": "^7.21.8",
|
|
29
|
+
"@babel/plugin-transform-react-constant-elements": "^7.21.3",
|
|
30
|
+
"@babel/plugin-transform-react-inline-elements": "^7.21.0",
|
|
31
|
+
"@babel/plugin-transform-runtime": "^7.21.4",
|
|
32
|
+
"@babel/preset-env": "^7.21.5",
|
|
33
|
+
"@babel/preset-react": "^7.18.6",
|
|
34
|
+
"@babel/preset-typescript": "^7.21.5",
|
|
35
|
+
"@babel/runtime": "^7.21.0",
|
|
36
36
|
"@loadable/babel-plugin": "^5.13.2",
|
|
37
37
|
"@loadable/component": "^5.14.1",
|
|
38
38
|
"@loadable/server": "^5.14.0",
|
|
39
39
|
"@loadable/webpack-plugin": "^5.14.0",
|
|
40
40
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
41
|
-
"@storybook/builder-webpack5": "^
|
|
42
|
-
"@storybook/
|
|
43
|
-
"@storybook/react": "^
|
|
41
|
+
"@storybook/builder-webpack5": "^7.0.17",
|
|
42
|
+
"@storybook/cli": "^7.0.17",
|
|
43
|
+
"@storybook/react": "^7.0.17",
|
|
44
|
+
"@storybook/react-webpack5": "^7.0.17",
|
|
44
45
|
"@types/jest": "^29.0.0",
|
|
45
46
|
"@types/loadable__component": "^5.13.1",
|
|
46
47
|
"@vanilla-extract/jest-transform": "^1.1.0",
|
|
@@ -51,14 +52,12 @@
|
|
|
51
52
|
"@vocab/webpack": "^1.2.1",
|
|
52
53
|
"autoprefixer": "^10.3.1",
|
|
53
54
|
"babel-jest": "^29.0.0",
|
|
54
|
-
"babel-loader": "^
|
|
55
|
+
"babel-loader": "^9.1.2",
|
|
55
56
|
"babel-plugin-add-react-displayname": "^0.0.5",
|
|
56
57
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
57
58
|
"babel-plugin-macros": "^3.1.0",
|
|
58
|
-
"babel-plugin-module-resolver": "^
|
|
59
|
-
"babel-plugin-seek-style-guide": "^1.0.0",
|
|
59
|
+
"babel-plugin-module-resolver": "^5.0.0",
|
|
60
60
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
61
|
-
"babel-plugin-treat": "^1.6.2",
|
|
62
61
|
"babel-plugin-unassert": "^3.1.0",
|
|
63
62
|
"browserslist": "^4.16.1",
|
|
64
63
|
"browserslist-config-seek": "^2.1.0",
|
|
@@ -89,7 +88,6 @@
|
|
|
89
88
|
"get-port": "^5.0.0",
|
|
90
89
|
"hostile": "^1.3.3",
|
|
91
90
|
"html-render-webpack-plugin": "^3.0.1",
|
|
92
|
-
"identity-obj-proxy": "^3.0.0",
|
|
93
91
|
"indent-string": "^4.0.0",
|
|
94
92
|
"jest": "^29.0.0",
|
|
95
93
|
"jest-environment-jsdom": "^29.0.0",
|
|
@@ -109,7 +107,6 @@
|
|
|
109
107
|
"prettier": "^2.8.8",
|
|
110
108
|
"pretty-ms": "^7.0.1",
|
|
111
109
|
"react-refresh": "^0.14.0",
|
|
112
|
-
"react-treat": "^2.0.1",
|
|
113
110
|
"require-from-string": "^2.0.2",
|
|
114
111
|
"rimraf": "^5.0.0",
|
|
115
112
|
"selfsigned": "^2.1.1",
|
|
@@ -119,10 +116,9 @@
|
|
|
119
116
|
"svgo-loader": "^4.0.0",
|
|
120
117
|
"terser-webpack-plugin": "^5.1.4",
|
|
121
118
|
"traverse": "^0.6.6",
|
|
122
|
-
"treat": "^2.0.4",
|
|
123
119
|
"tree-kill": "^1.2.1",
|
|
124
|
-
"typescript": "
|
|
125
|
-
"validate-npm-package-name": "^
|
|
120
|
+
"typescript": "~5.0.0",
|
|
121
|
+
"validate-npm-package-name": "^5.0.0",
|
|
126
122
|
"webpack": "^5.52.0",
|
|
127
123
|
"webpack-bundle-analyzer": "^4.6.1",
|
|
128
124
|
"webpack-dev-server": "4.11.1",
|
|
@@ -144,7 +140,6 @@
|
|
|
144
140
|
"react-dom": "^18.2.0",
|
|
145
141
|
"react-helmet": "^6.1.0",
|
|
146
142
|
"react-router-dom": "^5.2.0",
|
|
147
|
-
"seek-style-guide": "^42.0.0",
|
|
148
143
|
"webpack-cli": "^5.0.0"
|
|
149
144
|
},
|
|
150
145
|
"scripts": {
|
|
@@ -6,7 +6,7 @@ const { rimraf } = require('rimraf');
|
|
|
6
6
|
const { argv } = require('../config/args');
|
|
7
7
|
const gracefulSpawn = require('../lib/gracefulSpawn');
|
|
8
8
|
const { storybookTarget } = require('../context');
|
|
9
|
-
const buildStorybookPath = require.resolve('@storybook/
|
|
9
|
+
const buildStorybookPath = require.resolve('@storybook/cli/bin/index');
|
|
10
10
|
const configDir = path.resolve(__dirname, '../config/storybook/build');
|
|
11
11
|
const { runVocabCompile } = require('../lib/runVocab');
|
|
12
12
|
const { setUpStorybookPreviewFile } = require('../lib/storybook');
|
|
@@ -16,6 +16,7 @@ const { setUpStorybookPreviewFile } = require('../lib/storybook');
|
|
|
16
16
|
await rimraf(storybookTarget);
|
|
17
17
|
await setUpStorybookPreviewFile(configDir);
|
|
18
18
|
|
|
19
|
+
argv.push('build');
|
|
19
20
|
argv.push('--config-dir', configDir);
|
|
20
21
|
argv.push('--output-dir', storybookTarget);
|
|
21
22
|
argv.push('--quiet');
|
package/scripts/init.js
CHANGED
|
@@ -140,11 +140,6 @@ const getTemplateFileDestinationFromRoot =
|
|
|
140
140
|
lint: 'sku lint',
|
|
141
141
|
format: 'sku format',
|
|
142
142
|
},
|
|
143
|
-
husky: {
|
|
144
|
-
hooks: {
|
|
145
|
-
'pre-commit': 'sku pre-commit',
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
143
|
};
|
|
149
144
|
const packageJsonString = JSON.stringify(packageJson, null, 2);
|
|
150
145
|
|
|
@@ -198,11 +193,11 @@ const getTemplateFileDestinationFromRoot =
|
|
|
198
193
|
}),
|
|
199
194
|
);
|
|
200
195
|
|
|
201
|
-
const deps = ['braid-design-system', '
|
|
196
|
+
const deps = ['braid-design-system', 'react', 'react-dom'];
|
|
202
197
|
|
|
203
198
|
const devDeps = [
|
|
204
199
|
'@vanilla-extract/css',
|
|
205
|
-
'
|
|
200
|
+
'sku',
|
|
206
201
|
'@types/react',
|
|
207
202
|
'@types/react-dom',
|
|
208
203
|
];
|
|
@@ -219,7 +214,7 @@ const getTemplateFileDestinationFromRoot =
|
|
|
219
214
|
await install({ deps, verbose, useYarn });
|
|
220
215
|
await install({ deps: devDeps, type: 'dev', exact: false, verbose, useYarn });
|
|
221
216
|
|
|
222
|
-
await configure(
|
|
217
|
+
await configure();
|
|
223
218
|
await esLintFix();
|
|
224
219
|
await prettierWrite();
|
|
225
220
|
|
package/scripts/postinstall.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const { setCwd, getPathFromCwd, cwd } = require('../lib/cwd');
|
|
4
4
|
const debug = require('debug');
|
|
5
|
+
const banner = require('../lib/banner');
|
|
6
|
+
const chalk = require('chalk');
|
|
5
7
|
|
|
6
8
|
const log = debug('sku:postinstall');
|
|
7
9
|
|
|
@@ -28,11 +30,9 @@ if (packageJsonExists) {
|
|
|
28
30
|
} = require(packageJson);
|
|
29
31
|
|
|
30
32
|
const skipPostInstall = skuSkipPostInstall || skuSkipPostinstall;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Boolean(dependencies?.sku);
|
|
35
|
-
|
|
33
|
+
const hasSkuDep = Boolean(dependencies?.sku);
|
|
34
|
+
// sku should always be a dev dependency now that sku init installs it as one, but some repos may still have it as a regular dependency
|
|
35
|
+
const hasSku = Boolean(devDependencies?.sku) || hasSkuDep;
|
|
36
36
|
// Don't run configure script on sku itself
|
|
37
37
|
// Don't run configure script if sku is not installed
|
|
38
38
|
// Ignore projects that are opting out of sku's postinstall script
|
|
@@ -40,6 +40,17 @@ if (packageJsonExists) {
|
|
|
40
40
|
process.exit();
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
if (hasSkuDep) {
|
|
44
|
+
banner('warning', 'sku dependency detected', [
|
|
45
|
+
`${chalk.bold('sku')} is present as a ${chalk.bold(
|
|
46
|
+
'dependency',
|
|
47
|
+
)} in ${chalk.bold(packageJson)}.`,
|
|
48
|
+
`${chalk.bold('sku')} should be installed in ${chalk.bold(
|
|
49
|
+
'devDependencies',
|
|
50
|
+
)}.`,
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
log('postinstall', 'configuring');
|
|
44
55
|
let configure;
|
|
45
56
|
try {
|
package/scripts/storybook.js
CHANGED
|
@@ -2,14 +2,16 @@ const path = require('path');
|
|
|
2
2
|
const { argv } = require('../config/args');
|
|
3
3
|
const gracefulSpawn = require('../lib/gracefulSpawn');
|
|
4
4
|
const { storybookPort } = require('../context');
|
|
5
|
-
const startStorybookPath = require.resolve('@storybook/
|
|
5
|
+
const startStorybookPath = require.resolve('@storybook/cli/bin/index');
|
|
6
6
|
const configDir = path.resolve(__dirname, '../config/storybook/start');
|
|
7
7
|
const { watchVocabCompile } = require('../lib/runVocab');
|
|
8
8
|
const { setUpStorybookPreviewFile } = require('../lib/storybook');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
argv.
|
|
12
|
-
argv.
|
|
10
|
+
// Unshift args to allow pushing --ci as an arg during storybook-config tests
|
|
11
|
+
argv.unshift('--quiet');
|
|
12
|
+
argv.unshift('--config-dir', configDir);
|
|
13
|
+
argv.unshift('--port', storybookPort);
|
|
14
|
+
argv.unshift('dev');
|
|
13
15
|
|
|
14
16
|
(async () => {
|
|
15
17
|
await watchVocabCompile();
|
package/sku-types.d.ts
CHANGED
|
@@ -242,6 +242,16 @@ export interface SkuConfig {
|
|
|
242
242
|
*/
|
|
243
243
|
persistentCache?: boolean;
|
|
244
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Allows disabling Storybook's `storyStoreV7` feature flag. This will result in all stories being
|
|
247
|
+
* loaded upfront instead of on demand. Disabling this feature will allow stories that use the
|
|
248
|
+
* deprecated `storiesOf` API to work, however it's highly recommended to migrate off `storiesOf`
|
|
249
|
+
* to the Component Story Format (CSF) instead.
|
|
250
|
+
* @default true
|
|
251
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=storybookStoryStore
|
|
252
|
+
*/
|
|
253
|
+
storybookStoryStore?: boolean;
|
|
254
|
+
|
|
245
255
|
/**
|
|
246
256
|
* An array of polyfills to be included into all client entry points.
|
|
247
257
|
*
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const { TreatPlugin } = require('treat/webpack-plugin');
|
|
2
|
-
|
|
3
|
-
const braidThemes = [
|
|
4
|
-
'apac',
|
|
5
|
-
'jobStreet',
|
|
6
|
-
'jobStreetClassic',
|
|
7
|
-
'jobsDb',
|
|
8
|
-
'seekAnz',
|
|
9
|
-
'seekBusiness',
|
|
10
|
-
'seekUnifiedBeta',
|
|
11
|
-
'occ',
|
|
12
|
-
'catho',
|
|
13
|
-
'docs',
|
|
14
|
-
'wireframe',
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
module.exports = ({
|
|
18
|
-
target,
|
|
19
|
-
isProductionBuild,
|
|
20
|
-
libraryName,
|
|
21
|
-
browserslist,
|
|
22
|
-
MiniCssExtractPlugin,
|
|
23
|
-
}) => {
|
|
24
|
-
const libraryPrefix = libraryName ? `${libraryName}_` : '';
|
|
25
|
-
|
|
26
|
-
const localIdentName = `${libraryPrefix}${
|
|
27
|
-
isProductionBuild ? '' : 'BRAID__[name]-[local]_'
|
|
28
|
-
}[hash:base64:5]`;
|
|
29
|
-
|
|
30
|
-
const themeIdentFallback = '[hash:base64:3]';
|
|
31
|
-
|
|
32
|
-
const devThemeIdent = (theme) =>
|
|
33
|
-
theme.name ? `_${theme.name}` : themeIdentFallback;
|
|
34
|
-
|
|
35
|
-
const prodThemeIdent = (theme) => {
|
|
36
|
-
const braidThemeIndex = braidThemes.indexOf(theme.name);
|
|
37
|
-
|
|
38
|
-
if (braidThemeIndex >= 0) {
|
|
39
|
-
return `${braidThemeIndex}`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return themeIdentFallback;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const themeIdentName = isProductionBuild ? prodThemeIdent : devThemeIdent;
|
|
46
|
-
|
|
47
|
-
return new TreatPlugin({
|
|
48
|
-
test: /\.treat\.ts$/,
|
|
49
|
-
outputCSS: target === 'browser',
|
|
50
|
-
outputLoaders: [MiniCssExtractPlugin.loader],
|
|
51
|
-
localIdentName,
|
|
52
|
-
themeIdentName,
|
|
53
|
-
browsers: browserslist,
|
|
54
|
-
});
|
|
55
|
-
};
|
package/react-treat/index.ts
DELETED
package/treat/index.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// This is provided so consumers can import `sku/treat`,
|
|
2
|
-
// since they don't depend on `treat` directly.
|
|
3
|
-
|
|
4
|
-
// We can't re-export directly because eslint-plugin-import doesn't understand :(
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
createTheme,
|
|
8
|
-
style,
|
|
9
|
-
styleMap,
|
|
10
|
-
styleTree,
|
|
11
|
-
globalStyle,
|
|
12
|
-
resolveStyles,
|
|
13
|
-
resolveClassName,
|
|
14
|
-
} from 'treat';
|
|
15
|
-
|
|
16
|
-
import type {
|
|
17
|
-
Style,
|
|
18
|
-
GlobalStyle,
|
|
19
|
-
CSSProperties,
|
|
20
|
-
ThemeRef,
|
|
21
|
-
ClassRef,
|
|
22
|
-
TreatModule,
|
|
23
|
-
} from 'treat';
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
createTheme,
|
|
27
|
-
style,
|
|
28
|
-
styleMap,
|
|
29
|
-
styleTree,
|
|
30
|
-
resolveStyles,
|
|
31
|
-
resolveClassName,
|
|
32
|
-
globalStyle,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type {
|
|
36
|
-
Style,
|
|
37
|
-
GlobalStyle,
|
|
38
|
-
CSSProperties,
|
|
39
|
-
ThemeRef,
|
|
40
|
-
ClassRef,
|
|
41
|
-
TreatModule,
|
|
42
|
-
};
|