diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 6a2af8cf..9caef3c0 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -11,5 +11,6 @@ module.exports = { 'symbol-description': 'off', 'no-console': 'warn', 'no-tabs': 'off', + 'no-invalid-character': 'off', }, } diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..16ebaaec --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,72 @@ +name: Publish www + +on: + push: + branches: + - dev + paths: + - 'apps/www/**' + pull_request: + branches: + - dev + paths: + - 'apps/www/**' + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Publish to Cloudflare Pages + steps: + - name: Checkout + uses: actions/checkout@v3 + + # Run a build step here + - name: Setup Node.js environment + uses: actions/setup-node@v2 + with: + node-version: 18 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm i --frozen-lockfile + + - name: Build www + run: pnpm build + + # Run a action to publish docs + - name: Publish to Cloudflare Pages + uses: cloudflare/pages-action@v1.5.0 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: shadcn-vue + directory: .vitepress/dist + # Optional: Enable this if you want to have GitHub Deployments triggered + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + # Optional: Switch what branch you are publishing to. + # By default this will be the branch which triggered this workflow + # branch: main + # Optional: Change the working directory + workingDirectory: apps/www + wranglerVersion: '3' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..f1a7f7de --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,52 @@ +name: Test + +on: + push: + branches: + - dev + paths: + - 'packages/**' + + pull_request: + branches: + - dev + paths: + - 'packages/**' + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node.js environment + uses: actions/setup-node@v2 + with: + node-version: 16 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm i --frozen-lockfile + + - name: Test + run: pnpm test diff --git a/.gitignore b/.gitignore index fb5041c7..b4948488 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* +.nuxt .env node_modules .DS_Store diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..31bf7db9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,158 @@ +# Contributing + +Thanks for your interest in contributing to shadcn-vue.com. We're happy to have you here. + +Please take a moment to review this document before submitting your first pull request. We also strongly recommend that you check for open issues and pull requests to see if someone else is working on something similar. + +If you need any help, feel free to reach out to the core team on [Discord](https://chat.radix-vue.com/). + +## About this repository + +This repository is a monorepo. + +- We use [pnpm](https://pnpm.io) and [`workspaces`](https://pnpm.io/workspaces) for development. + +## Structure + +This repository is structured as follows: + +``` +apps +└── www + ├── src + │ └── content + └── registry + ├── default + │ ├── example + │ └── ui + └── new-york + ├── example + └── ui +packages +└── cli +``` + +| Path | Description | +| --------------------- | ---------------------------------------- | +| `apps/www/app` | The Next.js application for the website. | +| `apps/www/content` | The content for the website. | +| `apps/www/registry` | The registry for the components. | +| `packages/cli` | The `shadcn-vue` package. | + +## Development + +### Start by cloning the repository: + +``` +git clone git@github.com:radix-vue/shadcn-vue.git +``` + +### Install dependencies + +``` +pnpm install +``` + +### Run a workspace + +You can use the `pnpm --filter=[WORKSPACE]` command to start the development process for a workspace or some of the shortcut command that we have setup. + +#### Examples + +1. To run the `shadcn-vue.com` website: + +``` +pnpm dev +``` + +2. To run the `shadcn-vue` cli package: + +``` +pnpm dev:cli +``` + +## Documentation + +The documentation for this project is located in the `www` workspace. You can run the documentation locally by running the following command: + +```bash +pnpm dev +``` + +Documentation is written using [md](https://vitepress.dev/guide/markdown). You can find the documentation files in the `apps/www/content/docs` directory. + +## Components + +We use a registry system for developing components. You can find the source code for the components under `apps/www/registry`. The components are organized by styles. + +```bash +apps +└── www + └── registry + ├── default + │ ├── example + │ └── ui + └── new-york + ├── example + └── ui +``` + +When adding or modifying components, please ensure that: + +1. You make the changes for every style. +2. You update the documentation. +3. You run `pnpm build:registry` to update the registry. + +## Commit Convention + +Before you create a Pull Request, please check whether your commits comply with +the commit conventions used in this repository. + +When you create a commit we kindly ask you to follow the convention +`category(scope or module): message` in your commit message while using one of +the following categories: + +- `feat / feature`: all changes that introduce completely new code or new + features +- `fix`: changes that fix a bug (ideally you will additionally reference an + issue if present) +- `refactor`: any code related change that is not a fix nor a feature +- `docs`: changing existing or creating new documentation (i.e. README, docs for + usage of a lib or cli usage) +- `build`: all changes regarding the build of the software, changes to + dependencies or the addition of new dependencies +- `test`: all changes regarding tests (adding new tests or changing existing + ones) +- `ci`: all changes regarding the configuration of continuous integration (i.e. + github actions, ci system) +- `chore`: all changes to the repository that do not fit into any of the above + categories + + e.g. `feat(components): add new prop to the avatar component` + + +If you are interested in the detailed specification you can visit +https://www.conventionalcommits.org/ or check out the +[Angular Commit Message Guidelines](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines). + + + +## Requests for new components + +If you have a request for a new component, please open a discussion on GitHub. We'll be happy to help you out. + +## CLI + +The `shadcn-vue` package is a CLI for adding components to your project. You can find the documentation for the CLI [here](https://shadcn-vue.com/docs/cli). + +Any changes to the CLI should be made in the `packages/cli` directory. If you can, it would be great if you could add tests for your changes. + +## Testing + +Tests are written using [Vitest](https://vitest.dev). You can run all the tests from the root of the repository. + +```bash +pnpm test +``` + +Please ensure that the tests are passing when submitting a pull request. If you're adding new features, please include tests. \ No newline at end of file diff --git a/README.md b/README.md index 7b3df7f3..e8ee038e 100644 --- a/README.md +++ b/README.md @@ -15,19 +15,19 @@ Accessible and customizable components that you can copy and paste into your app ## Documentation -Visit https://shadcn-vue.com/docs to view the documentation. +[View documentation here](https://www.shadcn-vue.com/docs/introduction.html) ## Credits All credits go to these open-source works and resources -- [Shadnc UI](https://ui.shadcn.com) for creating this beautiful project -- [Shadnc Svelte](https://shadcn-svelte.com) for some inspiration for registry -- [Radix Vue](https://radix-vue.com) for doing all the hard work to make sure components are accessible +- [Shadcn UI](https://ui.shadcn.com) for creating this beautiful project. +- [Shadcn Svelte](https://shadcn-svelte.com) for some inspiration for registry. +- [Radix Vue](https://radix-vue.com) for doing all the hard work to make sure components are accessible. - [VueUse](https://vueuse.org) for providing many useful utilities. - [ahmedmayara](https://github.com/ahmedmayara/shadcn-vue) for populating many components ## License -Licensed under the [MIT license](https://github.com/shadcn/ui/blob/main/LICENSE.md). \ No newline at end of file +Licensed under the [MIT license](https://github.com/shadcn/ui/blob/main/LICENSE.md). diff --git a/apps/www/.vitepress/config.mts b/apps/www/.vitepress/config.mts index d72b958c..11573b64 100644 --- a/apps/www/.vitepress/config.mts +++ b/apps/www/.vitepress/config.mts @@ -1,6 +1,8 @@ import path from 'node:path' import { defineConfig } from 'vitepress' import Icons from 'unplugin-icons/vite' +import tailwind from 'tailwindcss' +import autoprefixer from 'autoprefixer' import { siteConfig } from './theme/config/site' import ComponentPreviewPlugin from './theme/plugins/previewer' @@ -54,8 +56,16 @@ export default defineConfig({ 'content/(.*)': '(.*)', }, vite: { + css: { + postcss: { + plugins: [ + tailwind(), + autoprefixer(), + ], + }, + }, plugins: [ - Icons({ compiler: 'vue3', autoInstall: true }) as any, + Icons({ compiler: 'vue3', autoInstall: true }), ], resolve: { alias: { diff --git a/apps/www/.vitepress/theme/components/ComponentPreview.vue b/apps/www/.vitepress/theme/components/ComponentPreview.vue index 0e07e8a6..403cb932 100644 --- a/apps/www/.vitepress/theme/components/ComponentPreview.vue +++ b/apps/www/.vitepress/theme/components/ComponentPreview.vue @@ -41,7 +41,7 @@ const { style } = useConfigStore()
+import { computed, ref } from 'vue' +import { useClipboard } from '@vueuse/core' +import { useConfigStore } from '@/stores/config' +import { themes } from '@/lib/registry' +import { Button } from '@/lib/registry/new-york/ui/button' +import CheckIcon from '~icons/radix-icons/check' +import CopyIcon from '~icons/radix-icons/copy' + +const { theme, config } = useConfigStore() + +const activeTheme = computed(() => themes.find(i => i.name === theme.value)) + +const { copy, copied } = useClipboard() + +const codeRef = ref() +async function copyCode() { + await copy(codeRef.value?.innerText ?? '') +} + + + diff --git a/apps/www/.vitepress/theme/components/ExamplesNav.vue b/apps/www/.vitepress/theme/components/ExamplesNav.vue index 87265ecf..d1b930b6 100644 --- a/apps/www/.vitepress/theme/components/ExamplesNav.vue +++ b/apps/www/.vitepress/theme/components/ExamplesNav.vue @@ -30,7 +30,7 @@ const examples = [ }, { name: 'Forms', - href: '/examples/forms', + href: '/examples/forms/forms', code: 'https://github.com/radix-vue/shadcn-vue/tree/dev/apps/www/src/examples/forms', }, { diff --git a/apps/www/.vitepress/theme/components/Kbd.vue b/apps/www/.vitepress/theme/components/Kbd.vue new file mode 100644 index 00000000..7e3bd02c --- /dev/null +++ b/apps/www/.vitepress/theme/components/Kbd.vue @@ -0,0 +1,37 @@ + + + diff --git a/apps/www/.vitepress/theme/components/LandingPage.vue b/apps/www/.vitepress/theme/components/LandingPage.vue index cb6c9d90..1e649d6e 100644 --- a/apps/www/.vitepress/theme/components/LandingPage.vue +++ b/apps/www/.vitepress/theme/components/LandingPage.vue @@ -19,12 +19,11 @@ import DashboardExample from '@/examples/dashboard/Example.vue' href="/docs/changelog" class="inline-flex items-center rounded-lg bg-muted px-3 py-1 text-sm font-medium" > - 🎉 - Style, a new CLI and more. -