From 0712c1354da68456e5ad8aafdd8037a3ae4a6912 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 24 Jul 2017 14:57:56 -0700 Subject: [PATCH 1/4] Revert channel debugging since it breaks react-native --- lib/addons/src/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/addons/src/index.js b/lib/addons/src/index.js index e6baf89fdc07..a1dad7dff486 100644 --- a/lib/addons/src/index.js +++ b/lib/addons/src/index.js @@ -1,16 +1,10 @@ -function channelError() { - throw new Error( - 'Accessing nonexistent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel' - ); -} - export class AddonStore { constructor() { this.loaders = {}; this.panels = {}; // this.channel should get overwritten by setChannel if package versions are // correct and AddonStore is a proper singleton. If not, throw an error. - this.channel = { on: channelError, emit: channelError }; + this.channel = null; this.preview = null; this.database = null; } From 63fe6e9fa3a098fb29a256c2b6e0ad09076d4689 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 24 Jul 2017 14:58:17 -0700 Subject: [PATCH 2/4] Don't hoist private packages --- scripts/hoist-internals.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) mode change 100644 => 100755 scripts/hoist-internals.js diff --git a/scripts/hoist-internals.js b/scripts/hoist-internals.js old mode 100644 new mode 100755 index d178df18df9b..f0756b580bde --- a/scripts/hoist-internals.js +++ b/scripts/hoist-internals.js @@ -20,10 +20,7 @@ const passingLog = fn => i => { fn(i); return i; }; -const getPackageNameOfFolder = sourcePath => - fse - .readJson(path.join(sourcePath, 'package.json')) - .then(json => json.name.replace('@storybook/', '')); +const getPackageOfFolder = sourcePath => fse.readJsonSync(path.join(sourcePath, 'package.json')); const task = getLernaPackages() .then( @@ -60,14 +57,17 @@ const task = getLernaPackages() log.silly(prefix, 'found package path', item); }) ) - .map(sourcePath => - getPackageNameOfFolder(sourcePath) - .then( - passingLog(packageName => { - log.silly(prefix, 'found package name', packageName); - }) - ) - .then(packageName => path.join(targetPath, packageName)) + .map(sourcePath => ({ + sourcePath, + packageJson: getPackageOfFolder(sourcePath), + })) + .filter(({ packageJson }) => !packageJson.private) + .map(({ sourcePath, packageJson }) => + Promise.resolve(packageJson.name.replace('@storybook/', '')) + .then(packageName => { + log.silly(prefix, 'found package name', packageName); + return path.join(targetPath, packageName); + }) .then(localTargetPath => symlink(sourcePath, localTargetPath) .then( From e89c4c9bd6a8fa937b4ac30ad0eff95010c89af8 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 24 Jul 2017 14:58:37 -0700 Subject: [PATCH 3/4] Linting fixes --- docs/components/Homepage/index.js | 6 +++--- examples/test-cra/src/stories/ComponentWithRef.js | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/components/Homepage/index.js b/docs/components/Homepage/index.js index 1e99bf4ef9cc..0c7041892772 100644 --- a/docs/components/Homepage/index.js +++ b/docs/components/Homepage/index.js @@ -43,13 +43,13 @@ import Footer from '../Footer'; const Homepage = ({ users }) =>
- {/*
*/} + {/*
*/} - {/* */} + {/* */} - {/* */} + {/* */}
; diff --git a/examples/test-cra/src/stories/ComponentWithRef.js b/examples/test-cra/src/stories/ComponentWithRef.js index e9f0679af15f..a8bf2c6d869a 100644 --- a/examples/test-cra/src/stories/ComponentWithRef.js +++ b/examples/test-cra/src/stories/ComponentWithRef.js @@ -7,7 +7,13 @@ class ComponentWithRef extends Component { } scrollWidth = 0; render() { - return
(this.ref = r)} />; + return ( +
{ + this.ref = r; + }} + /> + ); } } From d4d376127141e7099b57616684d591ee82ef1617 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 24 Jul 2017 15:25:52 -0700 Subject: [PATCH 4/4] Updated comment to reflect reverted code --- lib/addons/src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/addons/src/index.js b/lib/addons/src/index.js index a1dad7dff486..ee3ae408b66e 100644 --- a/lib/addons/src/index.js +++ b/lib/addons/src/index.js @@ -3,7 +3,8 @@ export class AddonStore { this.loaders = {}; this.panels = {}; // this.channel should get overwritten by setChannel if package versions are - // correct and AddonStore is a proper singleton. If not, throw an error. + // correct and AddonStore is a proper singleton. If not, this will be null + // (currently required by @storybook/react-native getStorybookUI) this.channel = null; this.preview = null; this.database = null;