Skip to content

Commit

Permalink
fix: build storybook after build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrea committed May 11, 2023
1 parent dd67c3b commit 08ed2de
Show file tree
Hide file tree
Showing 30 changed files with 2,986 additions and 3,029 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
"packages/*"
],
"scripts": {
"build": "yarn build:js-lib && yarn build:server && yarn build:browser && yarn build:react",
"build:js-lib": "yarn workspace @theniledev/js build",
"build:browser": "yarn workspace @theniledev/browser build",
"build:js-lib": "yarn workspace @theniledev/js build",
"build:react-storybook": "yarn build && yarn workspace @theniledev/react build-storybook",
"build:react": "yarn workspace @theniledev/react build",
"build:server": "yarn workspace @theniledev/server build",
"build": "yarn build:js-lib && yarn build:server && yarn build:browser && yarn build:react",
"buildDocs": "yarn workspace @theniledev/js typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs true src/index.ts",
"lint": "yarn eslint . --max-warnings=0",
"postinstall": "husky install",
"prepare": "husky install",
"publish": "yarn lerna publish",
"test:browser": "yarn workspace @theniledev/browser test",
"test:server": "yarn workspace @theniledev/server test",
"test:js-lib": "yarn workspace @theniledev/js test",
"test:react": "yarn workspace @theniledev/react test",
"build:react": "yarn workspace @theniledev/react build",
"build:react-storybook": "yarn build:js-lib && yarn build:react && yarn workspace @theniledev/react build-storybook",
"lint": "yarn eslint . --max-warnings=0",
"buildDocs": "yarn workspace @theniledev/js typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs true src/index.ts",
"publish": "yarn lerna publish",
"postinstall": "husky install",
"prepare": "husky install"
"test:server": "yarn workspace @theniledev/server test"
},
"devDependencies": {
"@commitlint/cli": "17.3.0",
Expand Down
17 changes: 17 additions & 0 deletions packages/react/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100,
"node": "current"
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": []
}
64 changes: 0 additions & 64 deletions packages/react/.storybook/main.js

This file was deleted.

35 changes: 35 additions & 0 deletions packages/react/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'storybook-addon-mock',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: 'tag',
},
webpackFinal: async (config) => {
if (config.module?.rules) {
// This modifies the existing image rule to exclude .svg files
// since you want to handle those files with @svgr/webpack
const imageRule = config.module.rules.find((rule) =>
rule.test.test('.svg')
);
imageRule.exclude = /\.svg$/;

// Configure .svg files to be loaded with @svgr/webpack
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
}

return config;
},
};
export default config;
5 changes: 0 additions & 5 deletions packages/react/.storybook/preview.js

This file was deleted.

15 changes: 15 additions & 0 deletions packages/react/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from '@storybook/react';

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
35 changes: 23 additions & 12 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"lint": "eslint src",
"size": "size-limit",
"analyze": "size-limit --why",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"peerDependencies": {
"@tanstack/react-query": "^4.23.0",
Expand Down Expand Up @@ -50,28 +50,39 @@
}
],
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/core": "^7.21.8",
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@rollup/plugin-babel": "^6.0.3",
"@size-limit/preset-small-lib": "^8.1.2",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/addon-links": "^6.5.15",
"@storybook/addons": "^6.5.15",
"@storybook/react": "^7.0.9",
"@svgr/rollup": "^6.5.1",
"@svgr/webpack": "^5.5.0",
"@storybook/addon-essentials": "^7.0.10",
"@storybook/addon-interactions": "^7.0.10",
"@storybook/addon-links": "^7.0.10",
"@storybook/blocks": "^7.0.10",
"@storybook/react": "^7.0.10",
"@storybook/react-webpack5": "^7.0.10",
"@storybook/testing-library": "^0.0.14-next.2",
"@svgr/rollup": "^8.0.1",
"@svgr/webpack": "^8.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@typescript-eslint/parser": "^5.49.0",
"@typescript-eslint/parser": "^5.59.5",
"babel-jest": "25.5.1",
"babel-loader": "^9.1.2",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-storybook": "^0.6.10",
"eslint-plugin-storybook": "^0.6.12",
"husky": "^8.0.3",
"prop-types": "^15.8.1",
"rollup-plugin-terser": "^7.0.2",
"size-limit": "^8.1.2",
"storybook-addon-mock": "^3.2.0",
"storybook": "^7.0.10",
"storybook-addon-mock": "^4.0.0",
"tsdx": "^0.14.1",
"tslib": "^2.4.1",
"typescript": "^4.9.4"
Expand Down
45 changes: 45 additions & 0 deletions packages/react/src/GoogleLoginButton/GoogleLoginButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';
import { CssVarsProvider } from '@mui/joy/styles';

import { NileProvider } from '../context';
import defaultTheme from '../context/themeJoiner';

import GoogleLoginButton from './GoogleLoginButton';
import GoogleSSOButton from './GoogleSSOButton';

const meta = {
title: 'SSO/Google',
component: GoogleLoginButton,
tags: ['autodocs'],
};

export default meta;

export function Basic() {
return (
<NileProvider database="database" workspace="my_workspace">
<div style={{ maxWidth: '20rem', margin: '0 auto' }}>
<GoogleLoginButton />
</div>
</NileProvider>
);
}
export function AlphaVersionWithOutProvider() {
return (
<CssVarsProvider theme={defaultTheme}>
<div style={{ maxWidth: '20rem', margin: '0 auto' }}>
<GoogleSSOButton href="some href" />
</div>
</CssVarsProvider>
);
}

export function AlphaVersionWithProvider() {
return (
<NileProvider database="database" workspace="workspace">
<div style={{ maxWidth: '20rem', margin: '0 auto' }}>
<GoogleSSOButton />
</div>
</NileProvider>
);
}
23 changes: 23 additions & 0 deletions packages/react/src/LoginForm/UserLoginForm.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { Meta } from '@storybook/react';
import Stack from '@mui/joy/Stack';

import LoginForm from '../../src/LoginForm';
import { NileProvider } from '../../src/context';

const meta: Meta = {
tags: ['autodocs'],
component: LoginForm,
};

export default meta;

export function Basic() {
return (
<NileProvider database="database" workspace="workspace">
<Stack sx={{ maxWidth: '20rem', margin: '0 auto' }} spacing={2}>
<LoginForm onSuccess={() => alert('success!')} />
</Stack>
</NileProvider>
);
}
23 changes: 23 additions & 0 deletions packages/react/src/SignUpForm/NewUserSignUp.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { Meta } from '@storybook/react';

import { NileProvider } from '../context';

import SignUpForm from '.';

const meta: Meta = {
tags: ['autodocs'],
component: SignUpForm,
};

export default meta;

export function Basic() {
return (
<NileProvider workspace="workspace" database="database">
<div style={{ maxWidth: '20rem', margin: '0 auto' }}>
<SignUpForm onSuccess={() => alert('success!')} />
</div>
</NileProvider>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import React from 'react';
import { Story } from '@storybook/react';
import { Button } from '@mui/joy';

import EntityForm from '../src/components/EntityForm';
import { AttributeType } from '../src/lib/SimpleForm/types';
import { NileProvider } from '../src/context';
import { AttributeType } from '../../lib/SimpleForm/types';
import { NileProvider } from '../../context';

import EntityForm from './EntityForm';

const meta = {
tags: ['autodocs'],
component: EntityForm,
args: {
org: 'myOrg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import Button from '@mui/joy/Button';
import Add from '@mui/icons-material/Add';
import Box from '@mui/joy/Box';

import { NileProvider } from '../src/context';
import InstanceList from '../src/components/InstanceList/InstanceList';
import { NileProvider } from '../../context';

import InstanceList from './InstanceList';

const entityData = {
id: 'ent_02qdzM9QKiB7lzR3HZVVEv',
Expand Down Expand Up @@ -80,9 +81,7 @@ const meta: Meta = {
},
},
},
parameters: {
controls: { expanded: true },
},
tags: ['autodocs'],
};

export default meta;
Expand Down
Loading

0 comments on commit 08ed2de

Please sign in to comment.