Skip to content

Commit

Permalink
chore: add storybook to react lib
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 committed Sep 5, 2024
1 parent 696de7f commit 6d452fe
Show file tree
Hide file tree
Showing 58 changed files with 6,685 additions and 876 deletions.
4 changes: 4 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ runs:
node-version: ${{ inputs.node-version }}
cache: yarn

- name: Install yarn 1.19.0
run: npm install -g [email protected]
shell: bash

- name: Install dependencies
run: yarn install --frozen-lockfile
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Build eslint plugin
run: |
cd templates/eslint && yarn build
cd ./libs/eslint && yarn build
- uses: reviewdog/action-setup@v1
with:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ site/**/*.js
vocs.config.tsx.timestamp-*.mjs

bin

.nx


storybook-static
1 change: 0 additions & 1 deletion .vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"is-ci": "^3.0.1",
"prool": "^0.0.15",
"tar": "^7.4.1",
"typescript-template": "*",
"viem": "2.20.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion .vitest/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "typescript-template/base.json"
"extends": "../tsconfig.base.json"
}
1 change: 0 additions & 1 deletion aa-sdk/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"dotenv": "^16.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion aa-sdk/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion aa-sdk/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "typescript-template/base.json"
"extends": "../../tsconfig.base.json"
}
1 change: 0 additions & 1 deletion aa-sdk/ethers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"alchemy-sdk": "^3.0.0",
"dotenv": "^16.0.3",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion aa-sdk/ethers/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion aa-sdk/ethers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "typescript-template/base.json"
"extends": "../../tsconfig.base.json"
}
1 change: 0 additions & 1 deletion account-kit/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"devDependencies": {
"@types/js-cookie": "^3.0.6",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion account-kit/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion account-kit/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve",
"paths": {
Expand Down
1 change: 0 additions & 1 deletion account-kit/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
},
"devDependencies": {
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion account-kit/infra/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion account-kit/infra/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve"
}
Expand Down
1 change: 0 additions & 1 deletion account-kit/plugingen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion account-kit/plugingen/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion account-kit/plugingen/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "typescript-template/base.json"
"extends": "../../tsconfig.base.json"
}
25 changes: 25 additions & 0 deletions account-kit/react/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { StorybookConfig } from "@storybook/react-vite";

import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin";
import react from "@vitejs/plugin-react";
import { mergeConfig } from "vite";

const config: StorybookConfig = {
stories: ["../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))"],
addons: ["@storybook/addon-essentials", "@storybook/addon-interactions"],
framework: {
name: "@storybook/react-vite",
options: {},
},

viteFinal: async (config) =>
mergeConfig(config, {
plugins: [react(), nxViteTsPaths()],
}),
};

export default config;

// To customize your Vite configuration you can use the viteFinal field.
// Check https://storybook.js.org/docs/react/builders/vite#configuration
// and https://nx.dev/recipes/storybook/custom-builder-configs
1 change: 1 addition & 0 deletions account-kit/react/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./tailwind.css";
3 changes: 3 additions & 0 deletions account-kit/react/.storybook/tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
3 changes: 2 additions & 1 deletion account-kit/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@
},
"devDependencies": {
"@tanstack/react-query": "^5.28.9",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.45",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"dependencies": {
Expand Down
6 changes: 6 additions & 0 deletions account-kit/react/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {

Check warning on line 1 in account-kit/react/postcss.config.js

View workflow job for this annotation

GitHub Actions / Lint

Assign object to a variable before exporting as module default
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
15 changes: 15 additions & 0 deletions account-kit/react/src/components/button.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Button } from "./button.js";

const meta: Meta<typeof Button> = {
component: Button,
title: "Button",
};
export default meta;
type Story = StoryObj<typeof Button>;

export const Default: Story = {
render: (args) => {
return <Button {...args}>Default</Button>;
},
};
10 changes: 10 additions & 0 deletions account-kit/react/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// eslint-disable-next-line import/extensions
import { withAccountKitUi } from "./src/tailwind/plugin";

export default withAccountKitUi({
content: ["./src/**/*.{js,ts,jsx,tsx}", "./.storybook/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
});
6 changes: 4 additions & 2 deletions account-kit/react/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts"
"vitest.config.e2e.ts",
"tailwind.config.js",
".storybook/**/*"
],
"include": ["src"],
"compilerOptions": {
Expand Down
15 changes: 13 additions & 2 deletions account-kit/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{
"extends": "typescript-template/base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve"
}
},
"exclude": [
"**/*.stories.ts",
"**/*.stories.js",
"**/*.stories.jsx",
"**/*.stories.tsx"
],
"references": [
{
"path": "./tsconfig.storybook.json"
}
]
}
38 changes: 38 additions & 0 deletions account-kit/react/tsconfig.storybook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": ""
},
"files": [
"../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nx/react/typings/image.d.ts"
],
"exclude": [
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.jsx",
"src/**/*.test.js"
],
"include": [
"src/**/*.stories.ts",
"src/**/*.stories.js",
"src/**/*.stories.jsx",
"src/**/*.stories.tsx",
"src/**/*.tsx",
"src/**/*.ts",
"src/**/*.js",
"src/**/*.jsx",
"src/**/*.stories.mdx",
"**/*.stories.tsx",
".storybook/*.js",
".storybook/*.ts"
]
}
1 change: 0 additions & 1 deletion account-kit/signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"react-dom": "^18.2.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion account-kit/signer/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion account-kit/signer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve"
}
Expand Down
1 change: 0 additions & 1 deletion account-kit/smart-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"dedent": "^1.5.1",
"dotenv": "^16.3.1",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion account-kit/smart-contracts/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion account-kit/smart-contracts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"paths": {
"@account-kit/smart-contracts": ["./src/index.ts"],
Expand Down
1 change: 0 additions & 1 deletion doc-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion doc-gen/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/build.json",
"extends": "../tsconfig.build.json",
"exclude": [
"node_modules",
"**/*/__tests__",
Expand Down
2 changes: 1 addition & 1 deletion doc-gen/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/base.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext"
Expand Down
3 changes: 1 addition & 2 deletions templates/eslint/package.json → libs/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"build": "rm -rf ./dist && tsc --project tsconfig.json --module commonjs --moduleResolution node --removeComments --verbatimModuleSyntax false && echo > ./dist/package.json '{\"type\":\"commonjs\"}'"
},
"devDependencies": {
"@types/eslint-utils": "^3.0.5",
"typescript-template": "*"
"@types/eslint-utils": "^3.0.5"
},
"dependencies": {
"@es-joy/jsdoccomment": "^0.43.1",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "typescript-template/base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
Expand Down
Loading

0 comments on commit 6d452fe

Please sign in to comment.