Skip to content

Commit

Permalink
feat(storybook): upgrade @storybook/react-native version to ^6.0.1-be…
Browse files Browse the repository at this point in the history
…ta.5

- also move the toggle-storybook.tsx to src/storbyook folder rather than .storybook
  • Loading branch information
xiongemi committed Apr 1, 2022
1 parent 9b13b53 commit f35a2c4
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 10 deletions.
4 changes: 2 additions & 2 deletions e2e/react-native/src/react-native.test.ts
Expand Up @@ -66,8 +66,8 @@ describe('react native', () => {
expect(() =>
checkFilesExist(
`.storybook/story-loader.js`,
`apps/${appName}/.storybook/storybook.ts`,
`apps/${appName}/.storybook/toggle-storybook.tsx`,
`apps/${appName}/src/storybook/storybook.ts`,
`apps/${appName}/src/storybook/toggle-storybook.tsx`,
`apps/${appName}/src/app/App.stories.tsx`
)
).not.toThrow();
Expand Down
Expand Up @@ -19,7 +19,6 @@ const props <% if ( propsTypeName ) { %>:<%= propsTypeName %><% } %> = {<% for (
<% } %>};

storiesOf('<%= componentName %>', module)
.addDecorator((getStory) => <>{getStory()}</>)
.add('Primary', () => (
<<%= componentName %> {...props} <% if (hasActions) { %> {...actions} <% } %>/>
));
@@ -1,6 +1,6 @@
import { configure, getStorybookUI } from '@storybook/react-native';

import { loadStories } from '../../../.storybook/story-loader';
import { loadStories } from '../../../../.storybook/story-loader';

configure(loadStories(), module, false);

Expand Down
Expand Up @@ -5,7 +5,7 @@ import React, { useState, useEffect, useRef } from 'react';
import { DevSettings } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';

import AppRoot from '../src/app/App';
import AppRoot from '../app/App';

export const DEFAULT_REACTOTRON_WS_URI = 'ws://localhost:9090';

Expand Down
Expand Up @@ -53,7 +53,7 @@ export async function createStorybookFiles(
generateFiles(
host,
join(__dirname, '../files/app'),
join(root, '.storybook'),
join(root, 'src', 'storybook'),
{
tmpl: '',
offsetFromRoot: offsetFromRoot(sourceRoot),
Expand Down
Expand Up @@ -34,7 +34,7 @@ describe('replaceAppImportWithStorybookToggle', () => {
const mainFile = tree.read('apps/products/src/main.tsx', 'utf-8');
expect(formatFile`${mainFile}`).toEqual(
formatFile`import { AppRegistry } from 'react-native';
import App from '../.storybook/toggle-storybook';
import App from './storybook/toggle-storybook';
AppRegistry.registerComponent('main', () => App);`
);
Expand All @@ -57,7 +57,7 @@ describe('replaceAppImportWithStorybookToggle', () => {
const mainFile = tree.read('apps/products/src/main.tsx', 'utf-8');
expect(formatFile`${mainFile}`).toEqual(
formatFile`import { AppRegistry } from 'react-native';
import App from '../.storybook/toggle-storybook';
import App from './storybook/toggle-storybook';
AppRegistry.registerComponent('main', () => App);`
);
Expand Down
Expand Up @@ -20,7 +20,7 @@ export function replaceAppImportWithStorybookToggle(

const mainFilePath = join(sourceRoot, schema.js ? 'main.js' : 'main.tsx');
const appImportImport = `import App from './app/App';`;
const storybookeToggleImport = `import App from '../.storybook/toggle-storybook';`;
const storybookeToggleImport = `import App from './storybook/toggle-storybook';`;

try {
logger.debug(`Updating import for ${mainFilePath}`);
Expand Down
20 changes: 20 additions & 0 deletions packages/storybook/migrations.json
Expand Up @@ -87,6 +87,26 @@
"@storybook/core-server": {
"version": "~6.4.12",
"alwaysAddToPackageJson": true
},
"@storybook/react-native": {
"version": "^6.0.1-beta.5",
"alwaysAddToPackageJson": false
},
"@storybook/addon-ondevice-actions": {
"version": "^6.0.1-beta.5",
"alwaysAddToPackageJson": false
},
"@storybook/addon-ondevice-backgrounds": {
"version": "^6.0.1-beta.5",
"alwaysAddToPackageJson": false
},
"@storybook/addon-ondevice-controls": {
"version": "^6.0.1-beta.5",
"alwaysAddToPackageJson": false
},
"@storybook/addon-ondevice-notes": {
"version": "^6.0.1-beta.5",
"alwaysAddToPackageJson": false
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/src/utils/versions.ts
Expand Up @@ -6,5 +6,5 @@ export const babelPresetTypescriptVersion = '7.12.13';
export const svgrVersion = '^5.4.0';
export const urlLoaderVersion = '^3.0.0';
export const webpack5Version = '^5.64.0';
export const storybookReactNativeVersion = '6.0.1-alpha.7';
export const storybookReactNativeVersion = '^6.0.1-beta.5';
export const reactNativeStorybookLoader = '^2.0.5';

0 comments on commit f35a2c4

Please sign in to comment.