sku 11.1.0 → 11.2.3
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/.github/workflows/validate.yml +1 -1
- package/CHANGELOG.md +65 -0
- package/config/typescript/tsconfig.js +14 -3
- package/config/webpack/cache.js +1 -1
- package/config/webpack/webpack.config.js +1 -2
- package/config/webpack/webpack.config.ssr.js +1 -2
- package/context/index.js +31 -4
- package/docs/docs/configuration.md +75 -57
- package/docs/index.html +2 -0
- package/lib/configure.js +4 -11
- package/lib/parseArgs.js +0 -1
- package/lib/placeholder.ts +7 -0
- package/package.json +4 -2
- package/scripts/build-storybook.js +2 -0
- package/scripts/init.js +0 -10
- package/scripts/lint.js +9 -12
- package/scripts/storybook.js +12 -7
- package/sku-types.d.ts +382 -0
- package/template/{sku.config.js → sku.config.ts} +5 -1
- package/template/src/render.tsx +1 -1
- package/lib/isTypeScript.js +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# sku
|
|
2
2
|
|
|
3
|
+
## 11.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Prevents typescript from being upgraded to 4.5.x ([#662](https://github.com/seek-oss/sku/pull/662))
|
|
8
|
+
|
|
9
|
+
Typescript 4.5 has caused a lot of issues with packages included with sku (braid, vanilla-extract) that are caused by a regression that's been introduced in the type checker.
|
|
10
|
+
It seems to be fixed in 4.6.0-dev, but that won't be available until late February.
|
|
11
|
+
|
|
12
|
+
To prevent things blowing up in the meantime, the version of typescript has been update to keep it below 4.5, at least until a patch is released in 4.5
|
|
13
|
+
|
|
14
|
+
## 11.2.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- The autogenerated tsconfig.json no longer explicitly excludes `node_modules` ([#660](https://github.com/seek-oss/sku/pull/660))
|
|
19
|
+
|
|
20
|
+
## 11.2.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Fix loading of TS config files that use node builtins or external dependencies. ([#657](https://github.com/seek-oss/sku/pull/657))
|
|
25
|
+
|
|
26
|
+
## 11.2.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- Config files can now be in TypeScript ([#655](https://github.com/seek-oss/sku/pull/655))
|
|
31
|
+
|
|
32
|
+
Previously, projects were configured using a `sku.config.js` file, which exported a config object.
|
|
33
|
+
As most projects at SEEK are now TypeScript based, having a JS config file makes it impossible to reuse any of your production code in the config (e.g. routes).
|
|
34
|
+
|
|
35
|
+
This change makes it possible to use a TypeScript config file, by default `sku.config.ts`.
|
|
36
|
+
The easiest way to migrate is to change the module exports to a default export:
|
|
37
|
+
|
|
38
|
+
```diff
|
|
39
|
+
- // sku.config.js
|
|
40
|
+
+ // sku.config.ts
|
|
41
|
+
- module.exports = {
|
|
42
|
+
+ export default {
|
|
43
|
+
clientEntry: 'src/client.tsx',
|
|
44
|
+
// ...
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
But sku also now exports a type for the config object, to make it easier to setup and understand the configuration options.
|
|
49
|
+
|
|
50
|
+
```diff
|
|
51
|
+
+ import type { SkuConfig } from 'sku';
|
|
52
|
+
+
|
|
53
|
+
- module.exports = {
|
|
54
|
+
+ const config: SkuConfig = {
|
|
55
|
+
clientEntry: 'src/client.tsx',
|
|
56
|
+
// ...
|
|
57
|
+
}
|
|
58
|
+
+
|
|
59
|
+
+ export default config;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`sku init` will now create TypeScript config files by default.
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Ensure translations are available when running storybook ([#638](https://github.com/seek-oss/sku/pull/638))
|
|
67
|
+
|
|
3
68
|
## 11.1.0
|
|
4
69
|
|
|
5
70
|
### Minor Changes
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
const { cwd
|
|
1
|
+
const { cwd } = require('../../lib/cwd');
|
|
2
2
|
const { paths, rootResolution } = require('../../context');
|
|
3
|
+
const path = require('path');
|
|
3
4
|
|
|
4
5
|
module.exports = () => {
|
|
6
|
+
const includePaths = paths.src;
|
|
7
|
+
|
|
8
|
+
if (paths.appSkuConfigPath && paths.appSkuConfigPath.endsWith('.ts')) {
|
|
9
|
+
// If the config file is in TypeScript, it needs to be included in the tsconfig
|
|
10
|
+
includePaths.push(paths.appSkuConfigPath);
|
|
11
|
+
} else {
|
|
12
|
+
// If it isn't, the placeholder file needs to be included so we don't break JS only projects.
|
|
13
|
+
// See the comments in placeholder.ts
|
|
14
|
+
includePaths.push(path.join(__dirname, '../../lib/placeholder.ts'));
|
|
15
|
+
}
|
|
16
|
+
|
|
5
17
|
const config = {
|
|
6
18
|
compilerOptions: {
|
|
7
19
|
// This flag allows tsc to be invoked directly by VS Code (via Cmd+Shift+B),
|
|
@@ -21,8 +33,7 @@ module.exports = () => {
|
|
|
21
33
|
lib: ['dom', 'es2015'],
|
|
22
34
|
target: 'es5',
|
|
23
35
|
},
|
|
24
|
-
include:
|
|
25
|
-
exclude: [getPathFromCwd('node_modules')],
|
|
36
|
+
include: includePaths,
|
|
26
37
|
};
|
|
27
38
|
|
|
28
39
|
if (rootResolution) {
|
package/config/webpack/cache.js
CHANGED
|
@@ -16,7 +16,6 @@ const { VocabWebpackPlugin } = require('@vocab/webpack');
|
|
|
16
16
|
|
|
17
17
|
const utils = require('./utils');
|
|
18
18
|
const { cwd } = require('../../lib/cwd');
|
|
19
|
-
const isTypeScript = require('../../lib/isTypeScript');
|
|
20
19
|
|
|
21
20
|
const renderEntry = require.resolve('../../entry/render');
|
|
22
21
|
const libraryRenderEntry = require.resolve('../../entry/libraryRender');
|
|
@@ -236,7 +235,7 @@ const makeWebpackConfig = ({
|
|
|
236
235
|
browserslist: supportedBrowsers,
|
|
237
236
|
mode: webpackMode,
|
|
238
237
|
libraryName,
|
|
239
|
-
generateCSSTypes:
|
|
238
|
+
generateCSSTypes: true,
|
|
240
239
|
displayNamesProd,
|
|
241
240
|
removeAssertionsInProduction: !isIntegration,
|
|
242
241
|
MiniCssExtractPlugin,
|
|
@@ -16,7 +16,6 @@ const args = require('../args');
|
|
|
16
16
|
const { bundleAnalyzerPlugin } = require('./plugins/bundleAnalyzer');
|
|
17
17
|
const utils = require('./utils');
|
|
18
18
|
const { cwd } = require('../../lib/cwd');
|
|
19
|
-
const isTypeScript = require('../../lib/isTypeScript');
|
|
20
19
|
const {
|
|
21
20
|
paths,
|
|
22
21
|
env,
|
|
@@ -189,7 +188,7 @@ const makeWebpackConfig = ({
|
|
|
189
188
|
hot,
|
|
190
189
|
include: internalInclude,
|
|
191
190
|
compilePackages: paths.compilePackages,
|
|
192
|
-
generateCSSTypes:
|
|
191
|
+
generateCSSTypes: true,
|
|
193
192
|
browserslist: supportedBrowsers,
|
|
194
193
|
mode: webpackMode,
|
|
195
194
|
displayNamesProd,
|
package/context/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const chalk = require('chalk');
|
|
4
|
+
const { register } = require('esbuild-register/dist/node');
|
|
4
5
|
const { getPathFromCwd } = require('../lib/cwd');
|
|
5
6
|
const args = require('../config/args');
|
|
6
7
|
const defaultSkuConfig = require('./defaultSkuConfig');
|
|
@@ -9,11 +10,37 @@ const validateConfig = require('./validateConfig');
|
|
|
9
10
|
const defaultCompilePackages = require('./defaultCompilePackages');
|
|
10
11
|
const isCompilePackage = require('../lib/isCompilePackage');
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const getSkuConfig = () => {
|
|
14
|
+
let appSkuConfigPath;
|
|
15
|
+
const tsPath = getPathFromCwd('sku.config.ts');
|
|
16
|
+
const jsPath = getPathFromCwd('sku.config.js');
|
|
17
|
+
|
|
18
|
+
if (args.config) {
|
|
19
|
+
appSkuConfigPath = getPathFromCwd(args.config);
|
|
20
|
+
} else if (fs.existsSync(tsPath)) {
|
|
21
|
+
appSkuConfigPath = tsPath;
|
|
22
|
+
} else if (fs.existsSync(jsPath)) {
|
|
23
|
+
appSkuConfigPath = jsPath;
|
|
24
|
+
} else {
|
|
25
|
+
return {
|
|
26
|
+
appSkuConfig: {},
|
|
27
|
+
appSkuConfigPath: null,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { unregister } = register({ target: 'node14' });
|
|
32
|
+
|
|
33
|
+
const newConfig = require(appSkuConfigPath);
|
|
34
|
+
|
|
35
|
+
unregister();
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
appSkuConfig: newConfig.default || newConfig,
|
|
39
|
+
appSkuConfigPath,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
13
42
|
|
|
14
|
-
const appSkuConfig =
|
|
15
|
-
? require(appSkuConfigPath)
|
|
16
|
-
: {};
|
|
43
|
+
const { appSkuConfig, appSkuConfigPath } = getSkuConfig();
|
|
17
44
|
|
|
18
45
|
const skuConfig = {
|
|
19
46
|
...defaultSkuConfig,
|
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
# Configuration
|
|
2
2
|
|
|
3
|
-
If you need to configure sku, first create a `sku.config.
|
|
3
|
+
If you need to configure sku, first create a `sku.config.ts` file in your project root:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
$ touch sku.config.
|
|
6
|
+
$ touch sku.config.ts
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
While sku has a zero configuration mode, the equivalent manual configuration would look like this:
|
|
10
10
|
|
|
11
|
-
```
|
|
12
|
-
|
|
11
|
+
```ts
|
|
12
|
+
import type { SkuConfig } from 'sku';
|
|
13
|
+
|
|
14
|
+
const skuConfig: SkuConfig = {
|
|
13
15
|
clientEntry: 'src/client.js',
|
|
14
16
|
renderEntry: 'src/render.js',
|
|
15
17
|
public: 'src/public',
|
|
16
18
|
publicPath: '/',
|
|
17
19
|
target: 'dist',
|
|
18
20
|
};
|
|
21
|
+
|
|
22
|
+
export default skuConfig;
|
|
19
23
|
```
|
|
20
24
|
|
|
21
25
|
If you need to specify a different config file you can do so with the `--config` parameter.
|
|
22
26
|
|
|
23
27
|
```bash
|
|
24
|
-
$ sku start --config sku.custom.config.
|
|
28
|
+
$ sku start --config sku.custom.config.ts
|
|
25
29
|
```
|
|
26
30
|
|
|
31
|
+
Config files can use either TypeScript or JavaScript.
|
|
32
|
+
|
|
27
33
|
## clientEntry
|
|
28
34
|
|
|
29
35
|
type `string`
|
|
@@ -117,6 +123,24 @@ const config = {
|
|
|
117
123
|
};
|
|
118
124
|
```
|
|
119
125
|
|
|
126
|
+
## devServerMiddleware
|
|
127
|
+
|
|
128
|
+
type `string`
|
|
129
|
+
|
|
130
|
+
Path to a file in your project that exports a function that can receive the Express server.
|
|
131
|
+
|
|
132
|
+
This can be used to extend to the dev server middleware.
|
|
133
|
+
|
|
134
|
+
Example:
|
|
135
|
+
|
|
136
|
+
```js
|
|
137
|
+
module.exports = app => {
|
|
138
|
+
app.get('/mock-api', (req, res) => {
|
|
139
|
+
...
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
120
144
|
## displayNamesProd
|
|
121
145
|
|
|
122
146
|
type `boolean`
|
|
@@ -151,31 +175,21 @@ Default: `false`
|
|
|
151
175
|
|
|
152
176
|
By default, sku compiles all node_modules in builds that target node. Setting this option to `true` will instead externalize all node_modules, excluding `compilePackages`.
|
|
153
177
|
|
|
154
|
-
##
|
|
178
|
+
## hosts
|
|
155
179
|
|
|
156
180
|
type `Array<string>`
|
|
157
181
|
|
|
158
|
-
Default: `[]`
|
|
159
|
-
|
|
160
|
-
When running `sku build`, sku will compile all your external packages (`node_modules`) through `@babel/preset-env`. This is to ensure external packages satisfy the browser support policy. However, this can cause very slow builds when large packages are processed. The `skipPackageCompatibilityCompilation` option allows you to pass a list of trusted packages to skip this behaviour.
|
|
161
|
-
|
|
162
|
-
> Note: `react` & `react-dom` are skipped by default.
|
|
163
|
-
|
|
164
|
-
Example:
|
|
182
|
+
Default: `['localhost']`
|
|
165
183
|
|
|
166
|
-
|
|
167
|
-
const config = {
|
|
168
|
-
skipPackageCompatibilityCompilation: ['@bloat/very-large-package', 'lodash'],
|
|
169
|
-
};
|
|
170
|
-
```
|
|
184
|
+
An array of custom hosts the app can be served off when running `sku start`. You must have configured your hosts file to point to localhost as well.
|
|
171
185
|
|
|
172
|
-
##
|
|
186
|
+
## httpsDevServer
|
|
173
187
|
|
|
174
|
-
type `
|
|
188
|
+
type `boolean`
|
|
175
189
|
|
|
176
|
-
Default: `
|
|
190
|
+
Default: `false`
|
|
177
191
|
|
|
178
|
-
|
|
192
|
+
Whether or not to use `https` for the local development server with a self-signed certificate. This is useful when testing authentication flows that require access to `window.crypto`.
|
|
179
193
|
|
|
180
194
|
## initialPath
|
|
181
195
|
|
|
@@ -187,7 +201,7 @@ The browser URL to open when running `sku start` or `sku start-ssr`. It will def
|
|
|
187
201
|
|
|
188
202
|
## languages
|
|
189
203
|
|
|
190
|
-
type `Array<string>`
|
|
204
|
+
type `Array<string | { name: string }>`
|
|
191
205
|
|
|
192
206
|
The languages your application supports.
|
|
193
207
|
|
|
@@ -269,6 +283,18 @@ Default: `./src/render.js`
|
|
|
269
283
|
|
|
270
284
|
The render entry file to the app. This file should export the required functions for static rendering. See [static-rendering](./docs/static-rendering.md) for more info.
|
|
271
285
|
|
|
286
|
+
## rootResolution
|
|
287
|
+
|
|
288
|
+
type `boolean`
|
|
289
|
+
|
|
290
|
+
Default: `true`
|
|
291
|
+
|
|
292
|
+
Enable root resolution. By default, sku allows importing from the root of the project e.g. `import something from 'src/modules/something'`.
|
|
293
|
+
|
|
294
|
+
Unfortunately, these kinds of imports only work for apps. In packages, the imports will work locally, but fail when consumed from `node_modules`.
|
|
295
|
+
|
|
296
|
+
You can set this option in `sku.config.js`, or adding `"skuCompilePackage": true` to your `package.json` will disable this behaviour by default.
|
|
297
|
+
|
|
272
298
|
## routes
|
|
273
299
|
|
|
274
300
|
type `Array<string | {route: string, name: string, entry: string, languages: Array<string>}>`
|
|
@@ -329,6 +355,24 @@ Can be an array of site names, or objects with a site name and corresponding hos
|
|
|
329
355
|
|
|
330
356
|
Can be used to limit the languages rendered for a specific site. Any listed language must exist in the [top level languages attribute](./docs/configuration?id=languages).
|
|
331
357
|
|
|
358
|
+
## skipPackageCompatibilityCompilation
|
|
359
|
+
|
|
360
|
+
type `Array<string>`
|
|
361
|
+
|
|
362
|
+
Default: `[]`
|
|
363
|
+
|
|
364
|
+
When running `sku build`, sku will compile all your external packages (`node_modules`) through `@babel/preset-env`. This is to ensure external packages satisfy the browser support policy. However, this can cause very slow builds when large packages are processed. The `skipPackageCompatibilityCompilation` option allows you to pass a list of trusted packages to skip this behaviour.
|
|
365
|
+
|
|
366
|
+
> Note: `react` & `react-dom` are skipped by default.
|
|
367
|
+
|
|
368
|
+
Example:
|
|
369
|
+
|
|
370
|
+
```js
|
|
371
|
+
const config = {
|
|
372
|
+
skipPackageCompatibilityCompilation: ['@bloat/very-large-package', 'lodash'],
|
|
373
|
+
};
|
|
374
|
+
```
|
|
375
|
+
|
|
332
376
|
## sourceMapsProd
|
|
333
377
|
|
|
334
378
|
type `boolean`
|
|
@@ -352,6 +396,14 @@ Default: `['./src']`
|
|
|
352
396
|
|
|
353
397
|
An array of directories holding your apps source code. By default, sku expects your source code to be in a directory named `src` in the root of your project. Use this option if your source code needs to be arranged differently.
|
|
354
398
|
|
|
399
|
+
## storybookAddons
|
|
400
|
+
|
|
401
|
+
type `Array<string>`
|
|
402
|
+
|
|
403
|
+
Default: `[]`
|
|
404
|
+
|
|
405
|
+
An array of storybook addons to use.
|
|
406
|
+
|
|
355
407
|
## storybookPort
|
|
356
408
|
|
|
357
409
|
type `number`
|
|
@@ -368,14 +420,6 @@ Default: `dist-storybook`
|
|
|
368
420
|
|
|
369
421
|
The directory `sku build-storybook` will output files to.
|
|
370
422
|
|
|
371
|
-
## storybookAddons
|
|
372
|
-
|
|
373
|
-
type `Array<string>`
|
|
374
|
-
|
|
375
|
-
Default: `[]`
|
|
376
|
-
|
|
377
|
-
An array of storybook addons to use.
|
|
378
|
-
|
|
379
423
|
## supportedBrowsers
|
|
380
424
|
|
|
381
425
|
type `browserslist-query`
|
|
@@ -401,29 +445,3 @@ type `function`
|
|
|
401
445
|
Default: `({ environment = '', site = '', route = '' }) => path.join(environment, site, route)`
|
|
402
446
|
|
|
403
447
|
This function returns the output path within [`target`](#target) for each rendered page. Generally, this value should be sufficient. If you think you need to modify this setting, please reach out to the `sku-support` group first to discuss.
|
|
404
|
-
|
|
405
|
-
## httpsDevServer
|
|
406
|
-
|
|
407
|
-
type `boolean`
|
|
408
|
-
|
|
409
|
-
Default: `false`
|
|
410
|
-
|
|
411
|
-
Whether or not to use `https` for the local development server with a self-signed certificate. This is useful when testing authentication flows that require access to `window.crypto`.
|
|
412
|
-
|
|
413
|
-
## devServerMiddleware
|
|
414
|
-
|
|
415
|
-
type `string`
|
|
416
|
-
|
|
417
|
-
Path to a file in your project that exports a function that can receive the Express server.
|
|
418
|
-
|
|
419
|
-
This can be used to extend to the dev server middleware.
|
|
420
|
-
|
|
421
|
-
Example:
|
|
422
|
-
|
|
423
|
-
```js
|
|
424
|
-
module.exports = app => {
|
|
425
|
-
app.get('/mock-api', (req, res) => {
|
|
426
|
-
...
|
|
427
|
-
})
|
|
428
|
-
}
|
|
429
|
-
```
|
package/docs/index.html
CHANGED
|
@@ -106,5 +106,7 @@
|
|
|
106
106
|
<script src="https://unpkg.com/docsify-themeable"></script>
|
|
107
107
|
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
|
108
108
|
<script src="//unpkg.com/prismjs/components/prism-diff.min.js"></script>
|
|
109
|
+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.25.0/components/prism-typescript.min.js"></script>
|
|
110
|
+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.25.0/components/prism-bash.min.js"></script>
|
|
109
111
|
</body>
|
|
110
112
|
</html>
|
package/lib/configure.js
CHANGED
|
@@ -5,7 +5,6 @@ const path = require('path');
|
|
|
5
5
|
const ensureGitignore = require('ensure-gitignore');
|
|
6
6
|
const { cwd, getPathFromCwd } = require('./cwd');
|
|
7
7
|
|
|
8
|
-
const isTypeScript = require('./isTypeScript');
|
|
9
8
|
const { paths, httpsDevServer, languages } = require('../context');
|
|
10
9
|
const {
|
|
11
10
|
bundleReportFolder,
|
|
@@ -87,16 +86,10 @@ module.exports = async () => {
|
|
|
87
86
|
patterns: lintIgnorePatterns.map(convertToForwardSlashPaths),
|
|
88
87
|
});
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
await writeFileToCWD(tsConfigFileName, createTSConfig());
|
|
95
|
-
gitIgnorePatterns.push(tsConfigFileName);
|
|
96
|
-
|
|
97
|
-
// Delete TSLint
|
|
98
|
-
await fs.remove(tslintPath);
|
|
99
|
-
}
|
|
89
|
+
// Generate TypeScript configuration
|
|
90
|
+
const tsConfigFileName = 'tsconfig.json';
|
|
91
|
+
await writeFileToCWD(tsConfigFileName, createTSConfig());
|
|
92
|
+
gitIgnorePatterns.push(tsConfigFileName);
|
|
100
93
|
|
|
101
94
|
// Generate self-signed certificate and ignore
|
|
102
95
|
const selfSignedCertificateDirName = '.ssl';
|
package/lib/parseArgs.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a placeholder file that provides for at least one TypeScript file in the project.
|
|
3
|
+
*
|
|
4
|
+
* Since all projects get a tsconfig.json now, having zero TS files would cause an error.
|
|
5
|
+
*
|
|
6
|
+
* Support for purely JS projects will be removed in a future major version, and this file can be removed.
|
|
7
|
+
* */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sku",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.3",
|
|
4
4
|
"description": "Front-end development toolkit, powered by Webpack, Babel, CSS Modules, Less and Jest",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -105,6 +105,8 @@
|
|
|
105
105
|
"empty-dir": "^2.0.0",
|
|
106
106
|
"ensure-gitignore": "^1.1.2",
|
|
107
107
|
"env-ci": "^5.0.0",
|
|
108
|
+
"esbuild": "^0.13.13",
|
|
109
|
+
"esbuild-register": "^3.2.0",
|
|
108
110
|
"escape-string-regexp": "^4.0.0",
|
|
109
111
|
"eslint": "^7.18.0",
|
|
110
112
|
"eslint-config-seek": "^7.0.8",
|
|
@@ -149,7 +151,7 @@
|
|
|
149
151
|
"traverse": "^0.6.6",
|
|
150
152
|
"treat": "^2.0.4",
|
|
151
153
|
"tree-kill": "^1.2.1",
|
|
152
|
-
"typescript": "
|
|
154
|
+
"typescript": ">=4.1.3 <4.5.0",
|
|
153
155
|
"validate-npm-package-name": "^3.0.0",
|
|
154
156
|
"webpack": "^5.47.1",
|
|
155
157
|
"webpack-bundle-analyzer": "^4.4.2",
|
|
@@ -9,8 +9,10 @@ const gracefulSpawn = require('../lib/gracefulSpawn');
|
|
|
9
9
|
const { storybookTarget } = require('../context');
|
|
10
10
|
const buildStorybookPath = require.resolve('@storybook/react/bin/build.js');
|
|
11
11
|
const configDir = path.resolve(__dirname, '../config/storybook/build');
|
|
12
|
+
const { runVocabCompile } = require('../lib/runVocab');
|
|
12
13
|
|
|
13
14
|
(async () => {
|
|
15
|
+
await runVocabCompile();
|
|
14
16
|
await rimraf(storybookTarget);
|
|
15
17
|
|
|
16
18
|
argv.push('--config-dir', configDir);
|
package/scripts/init.js
CHANGED
|
@@ -13,8 +13,6 @@ const prettierWrite = require('../lib/runPrettier').write;
|
|
|
13
13
|
const esLintFix = require('../lib/runESLint').fix;
|
|
14
14
|
const configure = require('../lib/configure');
|
|
15
15
|
const install = require('../lib/install');
|
|
16
|
-
const { getMissingHosts } = require('../lib/hosts');
|
|
17
|
-
const { getSuggestedScript } = require('../lib/suggestScript');
|
|
18
16
|
const banner = require('../lib/banner');
|
|
19
17
|
const trace = require('debug')('sku:init');
|
|
20
18
|
|
|
@@ -184,16 +182,8 @@ const args = require('../config/args');
|
|
|
184
182
|
await esLintFix();
|
|
185
183
|
await prettierWrite();
|
|
186
184
|
|
|
187
|
-
// read configured sites from templated sku config
|
|
188
|
-
const sites = require(path.join(root, 'sku.config.js')).sites;
|
|
189
|
-
const missingHosts = await getMissingHosts(sites);
|
|
190
|
-
const setupHostScript = await getSuggestedScript('setup-hosts', {
|
|
191
|
-
sudo: true,
|
|
192
|
-
});
|
|
193
|
-
|
|
194
185
|
const nextSteps = [
|
|
195
186
|
`${chalk.cyan('cd')} ${projectName}`,
|
|
196
|
-
missingHosts.length > 0 ? chalk.cyan(setupHostScript) : null,
|
|
197
187
|
`${chalk.cyan('yarn start')}`,
|
|
198
188
|
]
|
|
199
189
|
.filter(Boolean)
|
package/scripts/lint.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
-
const isTypeScript = require('../lib/isTypeScript');
|
|
3
2
|
const esLintCheck = require('../lib/runESLint').check;
|
|
4
3
|
const prettierCheck = require('../lib/runPrettier').check;
|
|
5
4
|
const runTsc = require('../lib/runTsc');
|
|
@@ -14,17 +13,15 @@ const { runVocabCompile } = require('../lib/runVocab');
|
|
|
14
13
|
await runVocabCompile();
|
|
15
14
|
|
|
16
15
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
await runTsc();
|
|
27
|
-
}
|
|
16
|
+
const hasPaths = typeof pathsToCheck !== 'undefined';
|
|
17
|
+
const pathsIncludeTS =
|
|
18
|
+
hasPaths &&
|
|
19
|
+
pathsToCheck.filter(
|
|
20
|
+
(filePath) => filePath.endsWith('.ts') || filePath.endsWith('.tsx'),
|
|
21
|
+
).length > 0;
|
|
22
|
+
|
|
23
|
+
if (!hasPaths || pathsIncludeTS) {
|
|
24
|
+
await runTsc();
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
await prettierCheck(pathsToCheck);
|
package/scripts/storybook.js
CHANGED
|
@@ -4,16 +4,21 @@ const gracefulSpawn = require('../lib/gracefulSpawn');
|
|
|
4
4
|
const { storybookPort } = require('../context');
|
|
5
5
|
const startStorybookPath = require.resolve('@storybook/react/bin/index.js');
|
|
6
6
|
const configDir = path.resolve(__dirname, '../config/storybook/start');
|
|
7
|
+
const { watchVocabCompile } = require('../lib/runVocab');
|
|
7
8
|
|
|
8
9
|
argv.push('--port', storybookPort);
|
|
9
10
|
argv.push('--config-dir', configDir);
|
|
10
11
|
argv.push('--quiet');
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
env: process.env,
|
|
15
|
-
});
|
|
13
|
+
(async () => {
|
|
14
|
+
await watchVocabCompile();
|
|
16
15
|
|
|
17
|
-
storybookProcess
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const storybookProcess = gracefulSpawn(startStorybookPath, argv, {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
env: process.env,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
storybookProcess.on('exit', (exitCode) => {
|
|
22
|
+
process.exit(exitCode);
|
|
23
|
+
});
|
|
24
|
+
})();
|
package/sku-types.d.ts
CHANGED
|
@@ -33,3 +33,385 @@ export interface Render<App = string> {
|
|
|
33
33
|
|
|
34
34
|
renderDocument(p: RenderDocumentProps<App>): Promise<string> | string;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
interface SkuRouteObject {
|
|
38
|
+
route: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
entry?: string;
|
|
41
|
+
languages?: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type SkuRoute = string | SkuRouteObject;
|
|
45
|
+
|
|
46
|
+
interface SkuSiteObject {
|
|
47
|
+
name: string;
|
|
48
|
+
host?: string;
|
|
49
|
+
routes?: Array<SkuRoute>;
|
|
50
|
+
languages?: string[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type SkuSite = string | SkuSiteObject;
|
|
54
|
+
|
|
55
|
+
interface TranformOutputPathFunctionParams {
|
|
56
|
+
environment: string;
|
|
57
|
+
site: string;
|
|
58
|
+
path: string;
|
|
59
|
+
}
|
|
60
|
+
type TranformOutputPathFunction = (
|
|
61
|
+
input: TranformOutputPathFunctionParams,
|
|
62
|
+
) => string;
|
|
63
|
+
|
|
64
|
+
export interface SkuConfig {
|
|
65
|
+
/**
|
|
66
|
+
* The client entry point to the app. The client entry is the file that executes your browser code.
|
|
67
|
+
*
|
|
68
|
+
* @default "./src/client.js"
|
|
69
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=cliententry
|
|
70
|
+
*/
|
|
71
|
+
clientEntry?: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* An array of `node_modules` to be compiled as if they were part of your source code.
|
|
75
|
+
*
|
|
76
|
+
* Ideally, this setting should only be used for internally controlled packages.
|
|
77
|
+
*
|
|
78
|
+
* @default "[]"
|
|
79
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=compilepackages
|
|
80
|
+
*/
|
|
81
|
+
compilePackages?: string[];
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* **Unavailable for libraries**
|
|
85
|
+
*
|
|
86
|
+
* Enable content security policy feature. More info at https://seek-oss.github.io/sku/#/./docs/csp
|
|
87
|
+
*
|
|
88
|
+
* @default false
|
|
89
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=cspenabled
|
|
90
|
+
*/
|
|
91
|
+
cspEnabled?: boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Extra external hosts to allow in your `script-src` content security policy. Only relevant if {@link cspEnabled} is set to `true`.
|
|
95
|
+
*
|
|
96
|
+
* @default []
|
|
97
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=cspextrascriptsrchosts
|
|
98
|
+
*/
|
|
99
|
+
cspExtraScriptSrcHosts?: string[];
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Similar to {@link dangerouslySetWebpackConfig} but for eslint config.
|
|
103
|
+
*
|
|
104
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=dangerouslyseteslintconfig
|
|
105
|
+
*/
|
|
106
|
+
dangerouslySetESLintConfig?: (existingESLintConfig: any) => any;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Similar to {@link dangerouslySetWebpackConfig} but for jest config. Make sure {@link setupTests} definitely doesn’t cover your needs before using.
|
|
110
|
+
* Please speak with the `sku-support` group before using.
|
|
111
|
+
*
|
|
112
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=dangerouslysetjestconfig
|
|
113
|
+
*/
|
|
114
|
+
dangerouslySetJestConfig?: (existingJestConfig: any) => any;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* This function provides a way to override the webpack config after sku has created it.
|
|
118
|
+
* Ideally, this setting is not needed and only used for experimenting/debugging. If you require webpack features not currently supported by sku please speak to the `sku-support` group.
|
|
119
|
+
*
|
|
120
|
+
* Reliance on this setting will cause issues when upgrading sku as any custom settings may break at anytime. You’ve been warned!
|
|
121
|
+
*
|
|
122
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=dangerouslysetwebpackconfig
|
|
123
|
+
*/
|
|
124
|
+
dangerouslySetWebpackConfig?: (existingWebpackConfig: any) => any;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Path to a file in your project that exports a function that can receive the Express server.
|
|
128
|
+
* This can be used to extend to the dev server middleware.
|
|
129
|
+
*
|
|
130
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=devservermiddleware
|
|
131
|
+
*/
|
|
132
|
+
devServerMiddleware?: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Adds static `displayName` properties to React components in production.
|
|
136
|
+
* This setting is designed for usage on sites that generate React code snippets, e.g. Braid.
|
|
137
|
+
*
|
|
138
|
+
* @default false
|
|
139
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=displaynamesprod
|
|
140
|
+
*/
|
|
141
|
+
displayNamesProd?: boolean;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* **Only for static apps**
|
|
145
|
+
*
|
|
146
|
+
* An array of environments the app supports.
|
|
147
|
+
* Apps should have one environment for local development plus one for each environment they’re deployed to.
|
|
148
|
+
*
|
|
149
|
+
* @default []
|
|
150
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=environments
|
|
151
|
+
*/
|
|
152
|
+
environments?: string[];
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* By default, sku compiles all node_modules in builds that target node.
|
|
156
|
+
* Setting this option to `true` will instead externalize all node_modules, excluding `compilePackages`.
|
|
157
|
+
*
|
|
158
|
+
* @default false
|
|
159
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=externalizenodemodules
|
|
160
|
+
*/
|
|
161
|
+
externalizeNodeModules?: boolean;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* An array of custom hosts the app can be served off when running `sku start`.
|
|
165
|
+
* You must have configured your hosts file to point to localhost as well.
|
|
166
|
+
*
|
|
167
|
+
* @default ['localhost']
|
|
168
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=hosts
|
|
169
|
+
*/
|
|
170
|
+
hosts?: string[];
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Whether or not to use https for the local development server with a self-signed certificate.
|
|
174
|
+
* This is useful when testing authentication flows that require access to `window.crypto`.
|
|
175
|
+
*
|
|
176
|
+
* @default false
|
|
177
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=httpsdevserver
|
|
178
|
+
*/
|
|
179
|
+
httpsDevServer?: boolean;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The browser URL to open when running `sku start` or `sku start-ssr`.
|
|
183
|
+
* It will default to the first `route` in the {@link routes} array.
|
|
184
|
+
*
|
|
185
|
+
* @default routes[0].route
|
|
186
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=initialpath
|
|
187
|
+
*/
|
|
188
|
+
initialPath?: string;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* The languages your application supports.
|
|
192
|
+
*
|
|
193
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=languages
|
|
194
|
+
*/
|
|
195
|
+
languages?: Array<string | { name: string }>;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* **Only for libraries**
|
|
199
|
+
*
|
|
200
|
+
* The entry file for the library. If set, sku will assume the project is a library. Must export its API from this file.
|
|
201
|
+
*
|
|
202
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=libraryentry
|
|
203
|
+
*/
|
|
204
|
+
libraryEntry?: string;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* **Only for libraries**
|
|
208
|
+
*
|
|
209
|
+
* The global name of the library. Will be added to the `window` object under `window[libraryName]`.
|
|
210
|
+
*
|
|
211
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=libraryname
|
|
212
|
+
*/
|
|
213
|
+
libraryName?: string;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Enables linting of import order. This rule supports auto-fix.
|
|
217
|
+
*
|
|
218
|
+
* @link https://seek-oss.github.io/sku/#/./docs/linting?id=import-ordering
|
|
219
|
+
*/
|
|
220
|
+
orderImports?: boolean;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Disables the use of webpack filesystem caching for `sku start` and `sku start-ssr`.
|
|
224
|
+
*
|
|
225
|
+
* @default true
|
|
226
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=persistentcache
|
|
227
|
+
*/
|
|
228
|
+
persistentCache?: boolean;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* An array of polyfills to be included into all client entry points.
|
|
232
|
+
*
|
|
233
|
+
* @default []
|
|
234
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=polyfills
|
|
235
|
+
*/
|
|
236
|
+
polyfills?: string[];
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The port the app is hosted on when running `sku start`.
|
|
240
|
+
*
|
|
241
|
+
* @default 8080
|
|
242
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=port
|
|
243
|
+
*/
|
|
244
|
+
port?: number;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* A folder of public assets to be copied into the `target` directory after `sku build` or `sku build-ssr`.
|
|
248
|
+
*
|
|
249
|
+
* *Caution*: All assets should ideally be imported through the source code to ensure they are named correctly for long term caching.
|
|
250
|
+
* You may run into caching issues using this option. It may be removed in future.
|
|
251
|
+
*
|
|
252
|
+
* @default 'public'
|
|
253
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=public
|
|
254
|
+
*/
|
|
255
|
+
public?: string;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The URL all the static assets of the app are accessible under.
|
|
259
|
+
*
|
|
260
|
+
* @default '/'
|
|
261
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=publicpath
|
|
262
|
+
*/
|
|
263
|
+
publicPath?: string;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* **Only for static apps and libraries**
|
|
267
|
+
*
|
|
268
|
+
* The render entry file to the app. This file should export the required functions for static rendering.
|
|
269
|
+
*
|
|
270
|
+
* @default "./src/render.js"
|
|
271
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=renderentry
|
|
272
|
+
*/
|
|
273
|
+
renderEntry?: string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Enables root resolution.
|
|
277
|
+
*
|
|
278
|
+
* By default, sku allows importing from the root of the project e.g. `import something from 'src/modules/something'`.
|
|
279
|
+
*
|
|
280
|
+
* Unfortunately, these kinds of imports only work for apps.
|
|
281
|
+
* In packages, the imports will work locally, but fail when consumed from `node_modules`.
|
|
282
|
+
*
|
|
283
|
+
* @default true
|
|
284
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=rootresolution
|
|
285
|
+
*/
|
|
286
|
+
rootResolution?: boolean;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* **Only for static apps**
|
|
290
|
+
*
|
|
291
|
+
* An array of routes for the app. Each route must specify a name and a route corresponding to the path it is hosted under. Each route may also have a custom client entry, which can help with bundle splitting. See static-rendering for more info.
|
|
292
|
+
*
|
|
293
|
+
* Can be used to limit the languages rendered for a specific route. Any listed language must exist in the top level languages attribute.
|
|
294
|
+
*
|
|
295
|
+
* @default ['/']
|
|
296
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=routes
|
|
297
|
+
*/
|
|
298
|
+
routes?: Array<SkuRoute>;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* *Only for SSR apps**
|
|
302
|
+
*
|
|
303
|
+
* The entry file for the server.
|
|
304
|
+
*
|
|
305
|
+
* @default "./src/server.js"
|
|
306
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=serverentry
|
|
307
|
+
*/
|
|
308
|
+
serverEntry?: string;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* **Only for SSR apps**
|
|
312
|
+
*
|
|
313
|
+
* The port the server is hosted on when running `sku start-ssr`.
|
|
314
|
+
*
|
|
315
|
+
* @default 8181
|
|
316
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=serverport
|
|
317
|
+
*/
|
|
318
|
+
serverPort?: number;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Point to a JS file that will run before your tests to setup the testing environment.
|
|
322
|
+
*
|
|
323
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=setuptests
|
|
324
|
+
*/
|
|
325
|
+
setupTests?: string | string[];
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* **Only for static apps**
|
|
329
|
+
*
|
|
330
|
+
* An array of sites the app supports. These usually correspond to each domain the app is hosted under.
|
|
331
|
+
*
|
|
332
|
+
* @default []
|
|
333
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=sites
|
|
334
|
+
*/
|
|
335
|
+
sites?: Array<SkuSite>;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* When running `sku build`, sku will compile all your external packages (`node_modules`) through `@babel/preset-env`.
|
|
339
|
+
* This is to ensure external packages satisfy the browser support policy.
|
|
340
|
+
* However, this can cause very slow builds when large packages are processed.
|
|
341
|
+
*
|
|
342
|
+
* The `skipPackageCompatibilityCompilation` option allows you to pass a list of trusted packages to skip this behaviour.
|
|
343
|
+
*
|
|
344
|
+
* @default []
|
|
345
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=skippackagecompatibilitycompilation
|
|
346
|
+
*/
|
|
347
|
+
skipPackageCompatibilityCompilation?: string[];
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* By default source maps will be generated only for development builds. Set to `true` to enable source maps in production.
|
|
351
|
+
*
|
|
352
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=sourcemapsprod
|
|
353
|
+
*/
|
|
354
|
+
sourceMapsProd?: boolean;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* An array of directories holding your apps source code.
|
|
358
|
+
* By default, sku expects your source code to be in a directory named `src` in the root of your project.
|
|
359
|
+
*
|
|
360
|
+
* Use this option if your source code needs to be arranged differently.
|
|
361
|
+
*
|
|
362
|
+
* @default ['./src']
|
|
363
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=srcpaths
|
|
364
|
+
*/
|
|
365
|
+
srcPaths?: string[];
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* An array of storybook addons to use.
|
|
369
|
+
*
|
|
370
|
+
* @default []
|
|
371
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=storybookaddons
|
|
372
|
+
*/
|
|
373
|
+
storybookAddons?: string[];
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* The port to host storybook on when running `sku storybook`.
|
|
377
|
+
*
|
|
378
|
+
* @default 8081
|
|
379
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=storybookport
|
|
380
|
+
*/
|
|
381
|
+
storybookPort?: number;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* The directory `sku build-storybook` will output files to.
|
|
385
|
+
*
|
|
386
|
+
* @default 'dist-storybook'
|
|
387
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=storybooktarget
|
|
388
|
+
*/
|
|
389
|
+
storybookTarget?: string;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* The `browserslist` query describing the apps browser support policy.
|
|
393
|
+
*
|
|
394
|
+
* @default browserslist-config-seek
|
|
395
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=supportedbrowsers
|
|
396
|
+
*/
|
|
397
|
+
supportedBrowsers?: string[];
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* The directory to build your assets into when running `sku build` or `sku build-ssr`.
|
|
401
|
+
*
|
|
402
|
+
* @default 'dist'
|
|
403
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=target
|
|
404
|
+
*/
|
|
405
|
+
target?: string;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* **Only for static apps**
|
|
409
|
+
*
|
|
410
|
+
* This function returns the output path within {@link target} for each rendered page. Generally, this value should be sufficient.
|
|
411
|
+
*
|
|
412
|
+
* If you think you need to modify this setting, please reach out to the `sku-support` group first to discuss.
|
|
413
|
+
*
|
|
414
|
+
* @link https://seek-oss.github.io/sku/#/./docs/configuration?id=transformoutputpath
|
|
415
|
+
*/
|
|
416
|
+
transformOutputPath?: TranformOutputPathFunction;
|
|
417
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SkuConfig } from 'sku';
|
|
2
|
+
|
|
3
|
+
const skuConfig: SkuConfig = {
|
|
2
4
|
clientEntry: 'src/client.tsx',
|
|
3
5
|
renderEntry: 'src/render.tsx',
|
|
4
6
|
environments: ['development', 'production'],
|
|
5
7
|
publicPath: '/path/to/public/assets/', // <-- Required for sku build output
|
|
6
8
|
orderImports: true
|
|
7
9
|
};
|
|
10
|
+
|
|
11
|
+
export default skuConfig;
|
package/template/src/render.tsx
CHANGED
package/lib/isTypeScript.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const glob = require('fast-glob');
|
|
2
|
-
const { cwd } = require('./cwd');
|
|
3
|
-
const debug = require('debug')('sku:isTypeScript');
|
|
4
|
-
|
|
5
|
-
const tsFiles = glob.sync(['**/*.{ts,tsx}', '!**/node_modules/**'], {
|
|
6
|
-
cwd: cwd(),
|
|
7
|
-
});
|
|
8
|
-
const isTypeScript = tsFiles.length > 0;
|
|
9
|
-
|
|
10
|
-
if (isTypeScript) {
|
|
11
|
-
debug(
|
|
12
|
-
`Found TypeScript in project. Found ${tsFiles.length} with the first at "${tsFiles[0]}".`,
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = isTypeScript;
|