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

refactor: move sandwich-ui and storybook to packages #6

Merged
merged 5 commits into from
Nov 29, 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 changes: 1 addition & 2 deletions .github/workflows/docs-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
paths:
- ".github/workflows/docs-pull-request.yml"
- "docs/**"
- "docs.Dockerfile"

jobs:
setup:
Expand Down Expand Up @@ -71,7 +70,7 @@ jobs:
with:
context: .
push: false
file: ./docs.Dockerfile
file: ./docs/Dockerfile
tags: image:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Sandwich UI Pull Request
name: "@sandwich-ui/react Pull Request"

on:
pull_request:
branches:
- main
paths:
- ".github/workflows/sandwich-ui-pull-request.yml"
- "sandwich-ui/**"
- ".github/workflows/react-pull-request.yml"
- "packages/react/**"

jobs:
setup:
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
uses: ./.github/actions/setup-env

- name: Build
run: pnpm build --filter @mrsquaare/sandwich-ui
run: pnpm build --filter @sandwich-ui/react

lint:
needs: setup
Expand All @@ -51,4 +51,4 @@ jobs:
uses: ./.github/actions/setup-env

- name: Lint
run: pnpm lint --filter @mrsquaare/sandwich-ui
run: pnpm lint --filter @sandwich-ui/react
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: ./.github/actions/setup-env

- name: Build
run: pnpm build --filter @mrsquaare/sandwich-ui
run: pnpm build --filter @sandwich-ui/react

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Storybook Pull Request
name: "@sandwich-ui/react Storybook Pull Request"

on:
pull_request:
branches:
- main
paths:
- ".github/workflows/storybook-pull-request.yml"
- "storybook/**"
- "storybook.Dockerfile"
- "sandwich-ui/**"
- ".github/workflows/storybook-react-pull-request.yml"
- "packages/react-storybook/**"
- "packages/react/**"

jobs:
setup:
Expand Down Expand Up @@ -37,7 +36,7 @@ jobs:
uses: ./.github/actions/setup-env

- name: Build
run: pnpm build --filter @sandwich-ui/storybook
run: pnpm build --filter @sandwich-ui/react-storybook

lint:
needs: setup
Expand All @@ -53,7 +52,7 @@ jobs:
uses: ./.github/actions/setup-env

- name: Lint
run: pnpm lint --filter @sandwich-ui/storybook
run: pnpm lint --filter @sandwich-ui/react-storybook

docker:
runs-on: ubuntu-latest
Expand All @@ -72,7 +71,7 @@ jobs:
with:
context: .
push: false
file: ./storybook.Dockerfile
file: ./packages/react-storybook/Dockerfile
tags: image:latest
cache-from: type=gha
cache-to: type=gha,mode=max
16 changes: 16 additions & 0 deletions storybook/CHANGELOG.md → PREVIOUS_CHANGELOGS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# @mrsquaare/sandwich-ui

## 0.3.1

### Patch Changes

- [#3](https://github.com/MrSquaare/sandwich-ui/pull/3) [`b2f564c`](https://github.com/MrSquaare/sandwich-ui/commit/b2f564cbfdd825519727065e9037e2f6c6d9c02f) Thanks [@MrSquaare](https://github.com/MrSquaare)! - Bump packages, migrate to ESLint v9

## 0.3.0

### Minor Changes

- [#1](https://github.com/MrSquaare/sandwich-ui/pull/1) [`67e57ad`](https://github.com/MrSquaare/sandwich-ui/commit/67e57ad4e631cc20297386ad3099dfe48aceae87) Thanks [@MrSquaare](https://github.com/MrSquaare)! - Initial version

---

# @sandwich-ui/storybook

## 0.1.1
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ It is composed of three projects:

```sh
# npm
npm install @mrsquaare/sandwich-ui
npm install @sandwich-ui/react

# yarn
yarn add @mrsquaare/sandwich-ui
yarn add @sandwich-ui/react

# pnpm
pnpm install @mrsquaare/sandwich-ui
pnpm install @sandwich-ui/react
```

## Using

```jsx
import { Button } from "@mrsquaare/sandwich-ui";
import { Button } from "@sandwich-ui/react";

function Example() {
return (
Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
"clean": "rimraf dist/ .astro/"
},
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/starlight": "^0.27.1",
"astro": "^4.15.4",
"@astrojs/check": "^0.9.4",
"@astrojs/starlight": "^0.29.2",
"astro": "^4.16.16",
"sharp": "^0.33.5",
"typescript": "^5.5.4"
"typescript": "^5.7.2"
},
"devDependencies": {
"eslint": "^9.10.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-astro": "^1.2.3",
"eslint-plugin-import-x": "^4.2.1",
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-import-x": "^4.4.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "5.1.0-rc-fb9a90fa48-20240614",
"globals": "^15.9.0",
"globals": "^15.12.0",
"rimraf": "^6.0.1",
"typescript-eslint": "^8.4.0"
"typescript-eslint": "^8.16.0"
}
}
6 changes: 3 additions & 3 deletions docs/src/content/docs/guide/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs>
<TabItem label="npm">
```bash
npm install @mrsquaare/sandwich-ui
npm install @sandwich-ui/react
```
</TabItem>
<TabItem label="yarn">
```bash
yarn add @mrsquaare/sandwich-ui
yarn add @sandwich-ui/react
```
</TabItem>
<TabItem label="pnpm">
```bash
pnpm install @mrsquaare/sandwich-ui
pnpm install @sandwich-ui/react
```
</TabItem>
</Tabs>
2 changes: 1 addition & 1 deletion docs/src/content/docs/guide/using.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: How to use Sandwich UI
---

```jsx
import { Button } from "@mrsquaare/sandwich-ui";
import { Button } from "@sandwich-ui/react";

function Example() {
return (
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.8",
"npm-check-updates": "^17.1.1",
"@changesets/cli": "^2.27.10",
"npm-check-updates": "^17.1.11",
"rimraf": "^6.0.1",
"turbo": "^2.1.1"
"turbo": "^2.3.3"
},
"engines": {
"node": ">=18"
"node": ">=22"
},
"packageManager": "pnpm@9.9.0"
"packageManager": "pnpm@9.14.3"
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "@mrsquaare/sandwich-ui/style.css";
@import "@sandwich-ui/react/style.css";

body:has(#storybook-root:not([hidden])) {
background-color: #ffffff;
Expand Down
12 changes: 6 additions & 6 deletions storybook.Dockerfile → packages/react-storybook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ RUN corepack enable pnpm
WORKDIR ${APP_DIRECTORY}

COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ./
COPY ./sandwich-ui/package.json ./sandwich-ui/
COPY ./storybook/package.json ./storybook/
COPY ./packages/react/package.json ./packages/react/
COPY ./packages/react-storybook/package.json ./packages/react-storybook/

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile


FROM base AS build

COPY ./turbo.json ./turbo.json
COPY ./sandwich-ui ./sandwich-ui
COPY ./storybook ./storybook
COPY ./packages/react ./packages/react
COPY ./packages/react-storybook ./packages/react-storybook
RUN pnpm build


FROM base

COPY --from=build ${APP_DIRECTORY}/storybook/storybook-static/ ./storybook/storybook-static/
COPY --from=build ${APP_DIRECTORY}/packages/react-storybook/storybook-static/ ./packages/react-storybook/storybook-static/

ENV NODE_ENV="production"

Expand All @@ -40,4 +40,4 @@ EXPOSE 4173

ENTRYPOINT ["dumb-init", "--"]

CMD ["pnpm", "-F", "@sandwich-ui/storybook", "preview", "--host"]
CMD ["pnpm", "-F", "@sandwich-ui/react-storybook", "preview", "--host"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
// import storybook from "eslint-plugin-storybook";
import storybook from "eslint-plugin-storybook";
import globals from "globals";

import rootConfig from "../eslint.config.mjs";
import rootConfig from "../../eslint.config.mjs";

export default [
{ ignores: ["storybook-static"] },
{ ignores: ["storybook-static", "!.storybook"] },
...rootConfig,
{
...react.configs.flat.recommended,
Expand Down Expand Up @@ -37,4 +37,5 @@ export default [
],
},
},
...storybook.configs["flat/recommended"],
];
48 changes: 48 additions & 0 deletions packages/react-storybook/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"private": true,
"name": "@sandwich-ui/react-storybook",
"version": "0.1.1",
"type": "module",
"scripts": {
"dev": "storybook dev -p 6006",
"prebuild": "rimraf storybook-static/",
"build": "storybook build",
"preview": "vite preview --outDir storybook-static/",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"clean": "rimraf storybook-static/ node_modules/.cache/"
},
"dependencies": {
"@sandwich-ui/react": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@storybook/addon-essentials": "^8.4.5",
"@storybook/addon-interactions": "^8.4.5",
"@storybook/addon-links": "^8.4.5",
"@storybook/addon-themes": "^8.4.5",
"@storybook/blocks": "^8.4.5",
"@storybook/react": "^8.4.5",
"@storybook/react-vite": "^8.4.5",
"@storybook/test": "^8.4.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import-x": "^4.4.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "5.1.0-rc-fb9a90fa48-20240614",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-storybook": "^0.11.1",
"globals": "^15.12.0",
"rimraf": "^6.0.1",
"storybook": "^8.4.5",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vite": "^5.4.11"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AspectRatio } from "@mrsquaare/sandwich-ui";
import { AspectRatio } from "@sandwich-ui/react";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
AvatarFallback,
AvatarImage,
AvatarRecipe,
} from "@mrsquaare/sandwich-ui";
} from "@sandwich-ui/react";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Badge, BadgeRecipe } from "@mrsquaare/sandwich-ui";
import { Badge, BadgeRecipe } from "@sandwich-ui/react";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, ButtonRecipe } from "@mrsquaare/sandwich-ui";
import { Button, ButtonRecipe } from "@sandwich-ui/react";
import type { Meta, StoryObj } from "@storybook/react";
import { fn } from "@storybook/test";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
CardFooter,
CardHeader,
CardTitle,
} from "@mrsquaare/sandwich-ui";
} from "@sandwich-ui/react";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
MenuContent,
MenuItem,
MenuTrigger,
} from "@mrsquaare/sandwich-ui";
} from "@sandwich-ui/react";
import type { Meta, StoryObj } from "@storybook/react";
import { fn } from "@storybook/test";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Navigation,
NavigationItem,
NavigationList,
} from "@mrsquaare/sandwich-ui";
} from "@sandwich-ui/react";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
Expand Down
Loading
Loading