playroom 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +1 -1
- package/CHANGELOG.md +32 -0
- package/README.md +4 -0
- package/bin/{cli.js → cli.cjs} +5 -2
- package/lib/makeWebpackConfig.js +11 -2
- package/package.json +8 -8
package/.eslintrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# playroom
|
|
2
2
|
|
|
3
|
+
## 0.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2d3571b: Add support for loading mjs config files
|
|
8
|
+
|
|
9
|
+
Consumers should now be able to write their configuration files using ES modules. By default Playroom will look for `playroom.config.js` with either a `.js`, `.mjs` or `.cjs` file extension.
|
|
10
|
+
|
|
11
|
+
## 0.32.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- a044864: Allow overriding Webpack module rules
|
|
16
|
+
|
|
17
|
+
Consumers may have complex Webpack configurations that can clash with Playroom's.
|
|
18
|
+
In this case, it's useful to be able to override the module rules that Playroom defines.
|
|
19
|
+
For example, overriding loaders defined for CSS files:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
// playroom.config.js
|
|
23
|
+
module.exports = {
|
|
24
|
+
webpackConfig: () => ({
|
|
25
|
+
module: {
|
|
26
|
+
rules: [
|
|
27
|
+
// use your own CSS loaders
|
|
28
|
+
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
3
35
|
## 0.32.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -194,6 +194,10 @@ module.exports = {
|
|
|
194
194
|
};
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
+
## ESM Support
|
|
198
|
+
|
|
199
|
+
Playroom supports loading [ESM](https://nodejs.org/api/esm.html#introduction) configuration files. By default, Playroom will look for a playroom config file with either a `.js`, `.mjs` or `.cjs` file extension.
|
|
200
|
+
|
|
197
201
|
## Storybook Integration
|
|
198
202
|
|
|
199
203
|
If you are interested in integrating Playroom into Storybook, check out [storybook-addon-playroom](https://github.com/rbardini/storybook-addon-playroom).
|
package/bin/{cli.js → cli.cjs}
RENAMED
|
@@ -53,7 +53,10 @@ const showUsage = () => {
|
|
|
53
53
|
const cwd = process.cwd();
|
|
54
54
|
const configPath = args.config
|
|
55
55
|
? path.resolve(cwd, args.config)
|
|
56
|
-
: await findUp(
|
|
56
|
+
: await findUp(
|
|
57
|
+
['playroom.config.js', 'playroom.config.mjs', 'playroom.config.cjs'],
|
|
58
|
+
{ cwd }
|
|
59
|
+
);
|
|
57
60
|
|
|
58
61
|
if (!configPath) {
|
|
59
62
|
console.error(
|
|
@@ -62,7 +65,7 @@ const showUsage = () => {
|
|
|
62
65
|
process.exit(1);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
const config =
|
|
68
|
+
const { default: config } = await import(configPath);
|
|
66
69
|
|
|
67
70
|
const playroom = lib({
|
|
68
71
|
cwd: path.dirname(configPath),
|
package/lib/makeWebpackConfig.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const webpack = require('webpack');
|
|
4
|
-
const {
|
|
4
|
+
const { mergeWithRules } = require('webpack-merge');
|
|
5
5
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
6
6
|
const FriendlyErrorsWebpackPlugin = require('@soda/friendly-errors-webpack-plugin');
|
|
7
7
|
const getStaticTypes = require('./getStaticTypes');
|
|
@@ -199,5 +199,14 @@ module.exports = async (playroomConfig, options) => {
|
|
|
199
199
|
? await playroomConfig.webpackConfig()
|
|
200
200
|
: makeDefaultWebpackConfig(playroomConfig);
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
const mergedConfig = mergeWithRules({
|
|
203
|
+
module: {
|
|
204
|
+
rules: {
|
|
205
|
+
test: 'match',
|
|
206
|
+
use: 'replace',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
})(ourConfig, theirConfig);
|
|
210
|
+
|
|
211
|
+
return mergedConfig;
|
|
203
212
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playroom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Design with code, powered by your own component library",
|
|
5
5
|
"main": "utils/index.js",
|
|
6
6
|
"types": "utils/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"playroom": "bin/cli.
|
|
8
|
+
"playroom": "bin/cli.cjs"
|
|
9
9
|
},
|
|
10
10
|
"lint-staged": {
|
|
11
11
|
"**/*.{js,ts,tsx}": [
|
|
@@ -111,14 +111,14 @@
|
|
|
111
111
|
"cypress": "start-server-and-test build-and-serve:all '9000|9001|9002' 'cypress run'",
|
|
112
112
|
"cypress:dev": "start-server-and-test start:all '9000|9001|9002' 'cypress open --browser chrome --e2e'",
|
|
113
113
|
"cypress:verify": "cypress verify",
|
|
114
|
-
"start:basic": "./bin/cli.
|
|
115
|
-
"build:basic": "./bin/cli.
|
|
114
|
+
"start:basic": "./bin/cli.cjs start --config cypress/projects/basic/playroom.config.js",
|
|
115
|
+
"build:basic": "./bin/cli.cjs build --config cypress/projects/basic/playroom.config.js",
|
|
116
116
|
"serve:basic": "PORT=9000 serve --no-request-logging cypress/projects/basic/dist",
|
|
117
|
-
"start:themed": "./bin/cli.
|
|
118
|
-
"build:themed": "./bin/cli.
|
|
117
|
+
"start:themed": "./bin/cli.cjs start --config cypress/projects/themed/playroom.config.js",
|
|
118
|
+
"build:themed": "./bin/cli.cjs build --config cypress/projects/themed/playroom.config.js",
|
|
119
119
|
"serve:themed": "PORT=9001 serve --config ../serve.json --no-request-logging cypress/projects/themed/dist",
|
|
120
|
-
"start:typescript": "./bin/cli.
|
|
121
|
-
"build:typescript": "./bin/cli.
|
|
120
|
+
"start:typescript": "./bin/cli.cjs start --config cypress/projects/typescript/playroom.config.js",
|
|
121
|
+
"build:typescript": "./bin/cli.cjs build --config cypress/projects/typescript/playroom.config.js",
|
|
122
122
|
"serve:typescript": "PORT=9002 serve --no-request-logging cypress/projects/typescript/dist",
|
|
123
123
|
"start:all": "concurrently 'npm:start:*(!all)'",
|
|
124
124
|
"build:all": "concurrently 'npm:build:*(!all)'",
|