-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from department-of-veterans-affairs/cu/53-nar…
…in-update-expo-storybook [CU] Update to Expo 50 and Storybook 7
- Loading branch information
Showing
24 changed files
with
4,249 additions
and
9,519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import { getStorybookUI } from '@storybook/react-native' | ||
import AsyncStorage from '@react-native-async-storage/async-storage' | ||
|
||
import './storybook.requires' | ||
import { view } from './storybook.requires' | ||
|
||
const StorybookUIRoot = getStorybookUI({}) | ||
import './storybook.requires' | ||
|
||
const StorybookUIRoot = view.getStorybookUI({ | ||
// Used to persist the selected story between reloads | ||
storage: { | ||
getItem: AsyncStorage.getItem, | ||
setItem: AsyncStorage.setItem, | ||
}, | ||
}) | ||
export default StorybookUIRoot |
64 changes: 0 additions & 64 deletions
64
packages/components/.storybook/native/storybook.requires.js
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
packages/components/.storybook/native/storybook.requires.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* do not change this file, it is auto generated by storybook. */ | ||
|
||
import { start } from "@storybook/react-native"; | ||
|
||
import "@storybook/addon-ondevice-controls/register"; | ||
import "@storybook/addon-ondevice-actions/register"; | ||
|
||
const normalizedStories = [ | ||
{ | ||
titlePrefix: "", | ||
directory: "./src/components", | ||
files: "**/*.stories.mdx", | ||
importPathMatcher: | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.mdx)$/, | ||
// @ts-ignore | ||
req: require.context( | ||
"../../src/components", | ||
true, | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.mdx)$/ | ||
), | ||
}, | ||
{ | ||
titlePrefix: "", | ||
directory: "./src/components", | ||
files: "**/*.stories.@(js|jsx|ts|tsx)", | ||
importPathMatcher: | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(js|jsx|ts|tsx))$/, | ||
// @ts-ignore | ||
req: require.context( | ||
"../../src/components", | ||
true, | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(js|jsx|ts|tsx))$/ | ||
), | ||
}, | ||
]; | ||
|
||
// @ts-ignore | ||
global.STORIES = normalizedStories; | ||
|
||
export const view = start({ | ||
annotations: [ | ||
require("./preview"), | ||
require("@storybook/react-native/dist/preview"), | ||
require("@storybook/addon-actions/preview"), | ||
], | ||
storyEntries: normalizedStories, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,7 @@ | |
src: url('fonts/SourceSansPro/SourceSansPro-Bold.ttf'); | ||
} | ||
|
||
.dark { | ||
background: #333333; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,46 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const { getDefaultConfig } = require('metro-config') | ||
const { getDefaultConfig } = require('expo/metro-config') | ||
const path = require('path') | ||
|
||
const { generate } = require('@storybook/react-native/scripts/generate') | ||
|
||
// Generates storybook.requires, which is used to load all our stories and addons in our project. | ||
generate({ | ||
configPath: path.resolve(__dirname, './.storybook/native'), | ||
}) | ||
|
||
// Find the project and workspace directories | ||
const projectRoot = __dirname | ||
// This can be replaced with `find-yarn-workspace-root` | ||
const workspaceRoot = path.resolve(projectRoot, '../..') | ||
|
||
module.exports = (async () => { | ||
const { | ||
resolver: { sourceExts, assetExts, resolverMainFields }, | ||
} = await getDefaultConfig() | ||
|
||
return { | ||
// Watch all files within the monorepo | ||
watchFolders: [workspaceRoot], | ||
// SVG support | ||
transformer: { | ||
babelTransformerPath: require.resolve('react-native-svg-transformer'), | ||
}, | ||
resolver: { | ||
// SVG support | ||
assetExts: assetExts.filter((ext) => ext !== 'svg'), | ||
sourceExts: [...sourceExts, 'svg'], | ||
// Let Metro know where to resolve packages and in what order | ||
nodeModulesPaths: [ | ||
path.resolve(projectRoot, 'node_modules'), | ||
path.resolve(workspaceRoot, 'node_modules'), | ||
], | ||
// Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` | ||
disableHierarchicalLookup: true, | ||
resolverMainFields: ['sbmodern', 'react-native', ...resolverMainFields], | ||
}, | ||
module.exports = (() => { | ||
const config = getDefaultConfig(__dirname) | ||
|
||
const { transformer, resolver } = config | ||
|
||
config.watchFolders = [workspaceRoot] | ||
|
||
config.transformer = { | ||
...transformer, | ||
// Enables dynamic imports | ||
unstable_useRequireContext: true, | ||
// SVG Support | ||
babelTransformerPath: require.resolve('react-native-svg-transformer'), | ||
} | ||
config.resolver = { | ||
...resolver, | ||
// SVG Support | ||
assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'), | ||
sourceExts: [...resolver.sourceExts, 'svg'], | ||
// Let Metro know where to resolve packages and in what order | ||
nodeModulesPaths: [ | ||
path.resolve(projectRoot, 'node_modules'), | ||
path.resolve(workspaceRoot, 'node_modules'), | ||
], | ||
// Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` | ||
disableHierarchicalLookup: true, | ||
} | ||
|
||
return config | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.