Skip to content

Commit

Permalink
Playroom: Update to v0.22.0, add 'playroomScope' option (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Oct 13, 2020
1 parent f177075 commit 2ba5cfc
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .changeset/eight-phones-worry.md
@@ -0,0 +1,29 @@
---
'sku': minor
---

**Playroom:** Update to v0.22.0, add `playroomScope` option

You can now use Playroom's new custom scope feature by providing a `playroomScope` file.

**EXAMPLE USAGE**

sku.config.js:

```js
module.exports = {
playroomScope: './playroom/useScope.ts',
}
```

useScope.ts:

```js
import { useToast } from 'braid-design-system';

export default function useScope() {
return {
showToast: useToast()
}
}
```
1 change: 1 addition & 0 deletions config/playroom/makePlayroomConfig.js
Expand Up @@ -35,6 +35,7 @@ module.exports = () =>
themes: paths.playroomThemes,
snippets: paths.playroomSnippets,
frameComponent: paths.playroomFrameComponent,
scope: paths.playroomScope,
openBrowser: process.env.OPEN_TAB !== 'false',
...playroom,
webpackConfig: () => ({
Expand Down
1 change: 1 addition & 0 deletions context/configSchema.js
Expand Up @@ -145,6 +145,7 @@ module.exports = validator.compile({
playroomThemes: { type: 'string', optional: true },
playroomSnippets: { type: 'string', optional: true },
playroomFrameComponent: { type: 'string', optional: true },
playroomScope: { type: 'string', optional: true },
playroomTarget: { type: 'string', optional: true },
playroomWidths: {
type: 'array',
Expand Down
1 change: 1 addition & 0 deletions context/defaultSkuConfig.js
Expand Up @@ -42,6 +42,7 @@ module.exports = {
playroomThemes: null,
playroomSnippets: null,
playroomFrameComponent: null,
playroomScope: null,
playroomTitle: null,
playroomPort: 8082,
playroomParamType: null,
Expand Down
3 changes: 3 additions & 0 deletions context/index.js
Expand Up @@ -121,6 +121,9 @@ const paths = {
playroomFrameComponent: skuConfig.playroomFrameComponent
? getPathFromCwd(skuConfig.playroomFrameComponent)
: null,
playroomScope: skuConfig.playroomScope
? getPathFromCwd(skuConfig.playroomScope)
: null,
};

module.exports = {
Expand Down
6 changes: 6 additions & 0 deletions docs/docs/configuration.md
Expand Up @@ -356,6 +356,12 @@ type `string`

The file that exports a component that wraps each frame within Playroom.

## playroomScope

type `string`

The file that exports a function that provides a custom scope object.

## playroomWidths

type `Array<number>`
Expand Down
1 change: 1 addition & 0 deletions docs/docs/playroom.md
Expand Up @@ -17,6 +17,7 @@ module.exports = {
playroomThemes: './src/themes.js',
playroomSnippets: './playroom/snippets.js',
playroomFrameComponent: './playroom/FrameComponent.js',
playroomScope: './playroom/scope.js',
};
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -138,7 +138,7 @@
"node-html-parser": "^1.2.16",
"open": "^7.0.0",
"path-to-regexp": "^6.0.0",
"playroom": "^0.21.1",
"playroom": "^0.22.0",
"postcss-js": "^2.0.2",
"postcss-loader": "^3.0.0",
"prettier": "2.0.2",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -11810,10 +11810,10 @@ pkg-up@^3.1.0:
dependencies:
find-up "^3.0.0"

playroom@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/playroom/-/playroom-0.21.1.tgz#5a91602f323975c41870ea2bd86eba8c18c09c99"
integrity sha512-GhowhPDwzlYctfZ40YvcWVSpwkZaZ0b0n+k7LwBgtXjRUIxpC4rxpzhHM84xFzFqGh8ecOXNnhhfRem3BzvyQw==
playroom@^0.22.0:
version "0.22.0"
resolved "https://registry.yarnpkg.com/playroom/-/playroom-0.22.0.tgz#719f34e4691b3da5c219b4ee8be692c5efa5ae1c"
integrity sha512-PozSTbKiu+FwsOebtOBGGhcwOuTkqubnBP/DaCXreHpunriHLXuWvQLoTlI1fpNgE4M2wYM2Mne4XZ6N17xGjg==
dependencies:
"@babel/cli" "^7.8.3"
"@babel/core" "^7.8.3"
Expand Down

0 comments on commit 2ba5cfc

Please sign in to comment.