Skip to content

Commit

Permalink
Merge pull request #6 from myshell-ai/dev-comfyui
Browse files Browse the repository at this point in the history
Dev comfyui
  • Loading branch information
ikun97 authored Sep 20, 2024
2 parents 7bfaf3d + 4e2d43c commit 9a58470
Show file tree
Hide file tree
Showing 84 changed files with 18,441 additions and 8,927 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
ref: main

- uses: pnpm/action-setup@v2
with:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/storybook-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Storybook Tests"

on:
push:
paths:
- "web/apps/web/**"
- "web/packages/**"
- ".github/**"
pull_request:
paths:
- "web/apps/web/**"
- "web/packages/**"
- ".github/**"

jobs:
test:
timeout-minutes: 10
runs-on: ubuntu-latest
env:
CYPRESS_INSTALL_BINARY: "0"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"

steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 9
run_install: false

- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: "web/pnpm-lock.yaml"

- run: npm install concurrently http-server wait-on -g

- working-directory: ./web
run: pnpm install

- working-directory: ./web
run: |
pnpm turbo run build-storybook --filter=storybook
- working-directory: ./web/apps/storybook
run: ./node_modules/.bin/playwright install --with-deps chromium

- working-directory: ./web/apps/storybook
run: |
concurrently -k -s first -n "SB,TEST" -c "magenta,blue" "http-server storybook-static --port 6006 --silent" "wait-on tcp:6006 && ./node_modules/.bin/test-storybook"
40 changes: 40 additions & 0 deletions .github/workflows/sync-open-source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Sync open-source

on:
pull_request:
paths:
- "web/apps/web/**"
- "web/packages/**"
- ".github/**"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Get last commit author email
id: get_email
run: echo "COMMIT_AUTHOR_EMAIL=$(git log -n 1 --pretty=format:%ae)" >> $GITHUB_ENV

- name: Test author email
run: echo "The commit author email is $COMMIT_AUTHOR_EMAIL"

- uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: web
target-directory: web
destination-github-username: "myshell-ai"
destination-repository-name: "open-source"
target-branch: ${{ github.head_ref }}
create-target-branch-if-needed: true
user-name: ${{ github.event.pull_request.user.login }}
user-email: ${{ env.COMMIT_AUTHOR_EMAIL }}
# https://github.com/orgs/community/discussions/25191
commit-message: See ${{github.repository}}@${{ github.event.pull_request.head.sha }}

- name: Test get variable exported by push-to-another-repository
run: echo $DESTINATION_CLONED_DIRECTORY
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ output
proconfig/widgets/imagen_widgets/library/models/
docker/
modal*
web
temp/
package/
servers/web-build
Expand Down
2 changes: 1 addition & 1 deletion web/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# . "$(dirname "$0")/_/husky.sh"

npx lint-staged
cd web && npx lint-staged
7 changes: 7 additions & 0 deletions web/apps/storybook/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": [
"next/core-web-vitals",
"next/typescript",
"plugin:storybook/recommended"
]
}
38 changes: 38 additions & 0 deletions web/apps/storybook/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

*storybook.log
27 changes: 27 additions & 0 deletions web/apps/storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { StorybookConfig } from '@storybook/nextjs';

import { join, dirname } from 'path';

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')));
}
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
getAbsolutePath('@storybook/addon-onboarding'),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@chromatic-com/storybook'),
getAbsolutePath('@storybook/addon-interactions'),
],
framework: {
name: getAbsolutePath('@storybook/nextjs'),
options: {},
},
staticDirs: ['../public'],
};
export default config;
14 changes: 14 additions & 0 deletions web/apps/storybook/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from '@storybook/react';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
40 changes: 40 additions & 0 deletions web/apps/storybook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
6 changes: 6 additions & 0 deletions web/apps/storybook/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
};

export default nextConfig;
41 changes: 41 additions & 0 deletions web/apps/storybook/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "storybook",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"next": "14.2.12",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.9.0",
"@storybook/addon-essentials": "^8.3.1",
"@storybook/addon-interactions": "^8.3.1",
"@storybook/addon-links": "^8.3.1",
"@storybook/addon-onboarding": "^8.3.1",
"@storybook/blocks": "^8.3.1",
"@storybook/nextjs": "^8.3.1",
"@storybook/react": "^8.3.1",
"@storybook/test": "^8.3.1",
"@storybook/test-runner": "^0.19.1",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.12",
"eslint-plugin-storybook": "^0.8.0",
"playwright": "^1.47.1",
"postcss": "^8",
"storybook": "^8.3.1",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
8 changes: 8 additions & 0 deletions web/apps/storybook/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};

export default config;
Binary file added web/apps/storybook/public/favicon.ico
Binary file not shown.
6 changes: 6 additions & 0 deletions web/apps/storybook/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// import '@/styles/globals.css';
import type { AppProps } from 'next/app';

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
13 changes: 13 additions & 0 deletions web/apps/storybook/src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Html, Head, Main, NextScript } from 'next/document';

export default function Document() {
return (
<Html lang="en">
<Head />
<body className="antialiased">
<Main />
<NextScript />
</body>
</Html>
);
}
13 changes: 13 additions & 0 deletions web/apps/storybook/src/pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next';

type Data = {
name: string;
};

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>,
) {
res.status(200).json({ name: 'John Doe' });
}
Binary file not shown.
Binary file added web/apps/storybook/src/pages/fonts/GeistVF.woff
Binary file not shown.
Loading

0 comments on commit 9a58470

Please sign in to comment.