From c2cf9077cae0a5ce9e17978d47e695ad6057d735 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 22 Jun 2020 17:09:13 +0200 Subject: [PATCH 1/5] ADD the ability to specify versions (for example) in the refs config in main.js --- lib/core/src/server/manager/manager-config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core/src/server/manager/manager-config.js b/lib/core/src/server/manager/manager-config.js index 1e8f0f546f6f..9b8edf74ef98 100644 --- a/lib/core/src/server/manager/manager-config.js +++ b/lib/core/src/server/manager/manager-config.js @@ -71,11 +71,14 @@ async function getManagerWebpackConfig(options, presets) { if (definedRefs) { Object.entries(definedRefs).forEach(([key, value]) => { const url = typeof value === 'string' ? value : value.url; - const title = typeof value === 'string' ? toTitle(key) : value.title || toTitle(value.key); + const rest = + typeof value === 'string' + ? { title: toTitle(key) } + : { ...value, title: value.title || toTitle(value.key) }; refs[key] = { id: key, - title, + ...rest, url: stripTrailingSlash(url), }; }); From e439a48a6e8120252efee56ad38b06a170baaeda Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 23 Jun 2020 12:02:38 +0200 Subject: [PATCH 2/5] copy versions from previous ref object & drop error when switching versions --- examples/dev-kits/main.js | 4 ++++ lib/api/src/modules/refs.ts | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/dev-kits/main.js b/examples/dev-kits/main.js index 79db36243b45..3ba02c3459be 100644 --- a/examples/dev-kits/main.js +++ b/examples/dev-kits/main.js @@ -6,6 +6,10 @@ module.exports = { id: 'ember', title: 'Ember', url: 'https://next--storybookjs.netlify.app/ember-cli', + versions: { + next: 'https://next--storybookjs.netlify.app/ember-cli', + master: 'https://master--storybookjs.netlify.app/ember-cli', + }, }, cra: 'https://next--storybookjs.netlify.app/cra-ts-kitchen-sink', }, diff --git a/lib/api/src/modules/refs.ts b/lib/api/src/modules/refs.ts index 00595d930ed5..1437ee10a068 100644 --- a/lib/api/src/modules/refs.ts +++ b/lib/api/src/modules/refs.ts @@ -108,8 +108,8 @@ export const init: ModuleFn = ({ store, provider, fullAPI }, { runCheck = true } return Object.values(refs).find(({ url }) => url.match(source)); }, changeRefVersion: (id, url) => { - const previous = api.getRefs()[id]; - const ref = { ...previous, stories: {}, url } as SetRefData; + const { versions, title } = api.getRefs()[id]; + const ref = { id, url, versions, title, stories: {} } as SetRefData; api.checkRef(ref); }, @@ -192,6 +192,7 @@ export const init: ModuleFn = ({ store, provider, fullAPI }, { runCheck = true } id, url, ...loadedData, + error: loadedData.error, type: !loadedData.stories ? 'auto-inject' : 'lazy', }); }, From 9dc3489bd09e7a2196008670f0e4678e7aed26b1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 23 Jun 2020 12:06:18 +0200 Subject: [PATCH 3/5] FIX versions --- lib/api/src/version.ts | 2 +- lib/cli/versions.json | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/api/src/version.ts b/lib/api/src/version.ts index 43536275fd12..f9a2b7d11210 100644 --- a/lib/api/src/version.ts +++ b/lib/api/src/version.ts @@ -1 +1 @@ -export const version = '6.0.0-beta.32'; +export const version = '6.0.0-beta.33'; diff --git a/lib/cli/versions.json b/lib/cli/versions.json index 74628defd297..77730e65ace6 100644 --- a/lib/cli/versions.json +++ b/lib/cli/versions.json @@ -1,17 +1,17 @@ { - "@storybook/angular": "6.0.0-beta.32", - "@storybook/aurelia": "6.0.0-beta.32", - "@storybook/ember": "6.0.0-beta.32", - "@storybook/html": "6.0.0-beta.32", - "@storybook/marionette": "6.0.0-beta.32", - "@storybook/marko": "6.0.0-beta.32", - "@storybook/mithril": "6.0.0-beta.32", - "@storybook/preact": "6.0.0-beta.32", - "@storybook/rax": "6.0.0-beta.32", - "@storybook/react": "6.0.0-beta.32", - "@storybook/riot": "6.0.0-beta.32", - "@storybook/server": "6.0.0-beta.32", - "@storybook/svelte": "6.0.0-beta.32", - "@storybook/vue": "6.0.0-beta.32", - "@storybook/web-components": "6.0.0-beta.32" + "@storybook/angular": "6.0.0-beta.33", + "@storybook/aurelia": "6.0.0-beta.33", + "@storybook/ember": "6.0.0-beta.33", + "@storybook/html": "6.0.0-beta.33", + "@storybook/marionette": "6.0.0-beta.33", + "@storybook/marko": "6.0.0-beta.33", + "@storybook/mithril": "6.0.0-beta.33", + "@storybook/preact": "6.0.0-beta.33", + "@storybook/rax": "6.0.0-beta.33", + "@storybook/react": "6.0.0-beta.33", + "@storybook/riot": "6.0.0-beta.33", + "@storybook/server": "6.0.0-beta.33", + "@storybook/svelte": "6.0.0-beta.33", + "@storybook/vue": "6.0.0-beta.33", + "@storybook/web-components": "6.0.0-beta.33" } \ No newline at end of file From 8a6bcb65fb186979570f0a80bb699f93b0374582 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 25 Jun 2020 06:25:20 +0800 Subject: [PATCH 4/5] Update versions --- lib/api/src/version.ts | 2 +- lib/cli/versions.json | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/api/src/version.ts b/lib/api/src/version.ts index 5f3343a35695..7cd52f1fd4ed 100644 --- a/lib/api/src/version.ts +++ b/lib/api/src/version.ts @@ -1 +1 @@ -export const version = '6.0.0-beta.34'; +export const version = '6.0.0-beta.35'; diff --git a/lib/cli/versions.json b/lib/cli/versions.json index fef02cad4d6f..bc8ac525df24 100644 --- a/lib/cli/versions.json +++ b/lib/cli/versions.json @@ -1,17 +1,17 @@ { - "@storybook/angular": "6.0.0-beta.34", - "@storybook/aurelia": "6.0.0-beta.34", - "@storybook/ember": "6.0.0-beta.34", - "@storybook/html": "6.0.0-beta.34", - "@storybook/marionette": "6.0.0-beta.34", - "@storybook/marko": "6.0.0-beta.34", - "@storybook/mithril": "6.0.0-beta.34", - "@storybook/preact": "6.0.0-beta.34", - "@storybook/rax": "6.0.0-beta.34", - "@storybook/react": "6.0.0-beta.34", - "@storybook/riot": "6.0.0-beta.34", - "@storybook/server": "6.0.0-beta.34", - "@storybook/svelte": "6.0.0-beta.34", - "@storybook/vue": "6.0.0-beta.34", - "@storybook/web-components": "6.0.0-beta.34" + "@storybook/angular": "6.0.0-beta.35", + "@storybook/aurelia": "6.0.0-beta.35", + "@storybook/ember": "6.0.0-beta.35", + "@storybook/html": "6.0.0-beta.35", + "@storybook/marionette": "6.0.0-beta.35", + "@storybook/marko": "6.0.0-beta.35", + "@storybook/mithril": "6.0.0-beta.35", + "@storybook/preact": "6.0.0-beta.35", + "@storybook/rax": "6.0.0-beta.35", + "@storybook/react": "6.0.0-beta.35", + "@storybook/riot": "6.0.0-beta.35", + "@storybook/server": "6.0.0-beta.35", + "@storybook/svelte": "6.0.0-beta.35", + "@storybook/vue": "6.0.0-beta.35", + "@storybook/web-components": "6.0.0-beta.35" } \ No newline at end of file From 43a2d326a39aaae5b7120ccf750ae6a6887a0e13 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 25 Jun 2020 06:25:35 +0800 Subject: [PATCH 5/5] Update snapshots --- lib/api/src/tests/refs.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/api/src/tests/refs.test.js b/lib/api/src/tests/refs.test.js index 1c54af755979..1e610afc7488 100644 --- a/lib/api/src/tests/refs.test.js +++ b/lib/api/src/tests/refs.test.js @@ -331,6 +331,7 @@ describe('Refs API', () => { Object { "refs": Object { "fake": Object { + "error": undefined, "id": "fake", "ready": false, "stories": Object {}, @@ -423,6 +424,7 @@ describe('Refs API', () => { Object { "refs": Object { "fake": Object { + "error": undefined, "id": "fake", "loginUrl": "https://example.com/login", "ready": false, @@ -516,6 +518,7 @@ describe('Refs API', () => { Object { "refs": Object { "fake": Object { + "error": undefined, "id": "fake", "ready": false, "stories": Object {}, @@ -603,6 +606,7 @@ describe('Refs API', () => { Object { "refs": Object { "fake": Object { + "error": undefined, "id": "fake", "ready": false, "stories": undefined,