Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(38312): Update dependencies as indicated by Snyk #39372

Merged
merged 13 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,024 changes: 1,321 additions & 1,703 deletions .github/actions/javascript/authorChecklist/index.js

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import type {StorybookConfig} from '@storybook/core-common';
import type {StorybookConfig} from '@storybook/types';

type Main = {
managerHead: (head: string) => string;
} & StorybookConfig;

const main: Main = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y', '@storybook/addon-react-native-web'],
const main: StorybookConfig = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to share your consideration to remove this addon @storybook/addon-react-native-web? Is it because there's no entry command in package.json to run storybook on native platforms (no usage on native platforms) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. I wasn't able to find this being used anywhere.

stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y', '@storybook/addon-webpack5-compiler-babel'],
staticDirs: ['./public', {from: '../assets/css', to: 'css'}, {from: '../assets/fonts/web', to: 'fonts'}],
core: {
builder: 'webpack5',
},
managerHead: (head: string) => `
core: {},

managerHead: (head) => `
pecanoro marked this conversation as resolved.
Show resolved Hide resolved
${head}
${process.env.ENV === 'staging' ? '<meta name="robots" content="noindex">' : ''}
`,
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: false,
},
};

export default main;
1 change: 0 additions & 1 deletion .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<link rel="icon" type="image/png" href="logo.png" />
<link rel="stylesheet" type="text/css" href="css/fonts.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
2 changes: 1 addition & 1 deletion .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {addons} from '@storybook/addons';
import {addons} from '@storybook/manager-api';
import theme from './theme';

addons.setConfig({
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {PortalProvider} from '@gorhom/portal';
import type {Parameters} from '@storybook/addons';
import type {Parameters} from '@storybook/types';
import React from 'react';
import Onyx from 'react-native-onyx';
import {SafeAreaProvider} from 'react-native-safe-area-context';
Expand Down
11 changes: 11 additions & 0 deletions .storybook/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .storybook/public/logo.png
Binary file not shown.
3 changes: 2 additions & 1 deletion .storybook/theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {ThemeVars} from '@storybook/theming';
import {create} from '@storybook/theming';
import {create} from '@storybook/theming/create';
// eslint-disable-next-line @dword-design/import-alias/prefer-alias
import colors from '../src/styles/theme/colors';

Expand All @@ -13,6 +13,7 @@ const theme: ThemeVars = create({
colorPrimary: colors.productDark400,
colorSecondary: colors.green,
appContentBg: colors.productDark100,
appPreviewBg: colors.productDark100,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I build production storybook via npm run storybook-build and then cd to ./dist/docs and run npx serve to access the storybook, the No Preview message in the home page is not easy to read

Screenshot 2024-04-02 at 5 09 13 PM

The empty preview page looks like below if this is removed
image

But I agree with this style added, the preview looks prettier

Default background Background productDark100
image image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that the dev cmd storybook dev automatically redirects to preview the first component. Maybe we can omit this if the production endpoint of storybook is also able to auto redirect to a preview of a component.

Copy link
Contributor

@eh2077 eh2077 Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I found that there's an option to change the background color of the preview area. So, I'm inclined not to incorporate this style.

Screen.Recording.2024-04-02.at.5.52.01.PM.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eh2077 This is an issue with the serve library. See more here. Using npx http-server works perfectly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allroundexperts Oh, yes, npx http-server works well!

textColor: colors.productDark900,
barTextColor: colors.productDark900,
barSelectedColor: colors.green,
Expand Down
6 changes: 6 additions & 0 deletions .storybook/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ const webpackConfig = ({config}: {config: Configuration}) => {
loader: require.resolve('@svgr/webpack'),
});

config.plugins.push(
new DefinePlugin({
__DEV__: process.env.NODE_ENV === 'development',
}),
);

return config;
};

Expand Down
9 changes: 4 additions & 5 deletions __mocks__/@react-native-community/netinfo.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import {NetInfoCellularGeneration, NetInfoStateType} from '@react-native-community/netinfo';
import type {addEventListener, configure, fetch, NetInfoState, refresh, useNetInfo} from '@react-native-community/netinfo';

const defaultState: NetInfoState = {
type: NetInfoStateType?.cellular,
const defaultState = {
type: 'cellular',
isConnected: true,
isInternetReachable: true,
details: {
isConnectionExpensive: true,
cellularGeneration: NetInfoCellularGeneration?.['3g'],
cellularGeneration: '3g',
carrier: 'T-Mobile',
},
};
} as NetInfoState;

type NetInfoMock = {
configure: typeof configure;
Expand Down
9 changes: 6 additions & 3 deletions __mocks__/@react-navigation/native/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import {useIsFocused as realUseIsFocused} from '@react-navigation/native';
import {useIsFocused as realUseIsFocused, useTheme as realUseTheme} from '@react-navigation/native';

// We only want this mocked for storybook, not jest
// We only want these mocked for storybook, not jest
const useIsFocused: typeof realUseIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true;

// @ts-expect-error as we're mocking this function
const useTheme: typeof realUseTheme = process.env.NODE_ENV === 'test' ? realUseTheme : () => ({});
pecanoro marked this conversation as resolved.
Show resolved Hide resolved

export * from '@react-navigation/core';
export * from '@react-navigation/native';
export {useIsFocused};
export {useIsFocused, useTheme};
Loading
Loading