Skip to content

Commit cb18bf9

Browse files
committed
init
0 parents  commit cb18bf9

File tree

412 files changed

+53383
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+53383
-0
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "shadcn-ui/ui" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": ["www", "**-template"]
11+
}

.changeset/mean-badgers-grab.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"shadcn-ui": patch
3+
---
4+
5+
fix code style

.changeset/smart-pants-smile.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"shadcn-ui": patch
3+
---
4+
5+
use jsconfig for non-ts projects

.changeset/sweet-worms-fix.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"shadcn-ui": minor
3+
---
4+
5+
add support for tailwind.config.ts

.commitlintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"]
3+
}

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true

.eslintrc.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json.schemastore.org/eslintrc",
3+
"root": true,
4+
"extends": [
5+
"next/core-web-vitals",
6+
"turbo",
7+
"prettier",
8+
"plugin:tailwindcss/recommended"
9+
],
10+
"plugins": ["tailwindcss"],
11+
"rules": {
12+
"@next/next/no-html-link-for-pages": "off",
13+
"tailwindcss/no-custom-classname": "off",
14+
"tailwindcss/classnames-order": "error"
15+
},
16+
"settings": {
17+
"tailwindcss": {
18+
"callees": ["cn", "cva"],
19+
"config": "tailwind.config.cjs"
20+
},
21+
"next": {
22+
"rootDir": ["apps/*/"]
23+
}
24+
},
25+
"overrides": [
26+
{
27+
"files": ["*.ts", "*.tsx"],
28+
"parser": "@typescript-eslint/parser"
29+
}
30+
]
31+
}

.github/changeset-version.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
2+
// https://github.com/cloudflare/wrangler2/blob/main/.github/changeset-version.js
3+
4+
import { exec } from "child_process"
5+
6+
// This script is used by the `release.yml` workflow to update the version of the packages being released.
7+
// The standard step is only to run `changeset version` but this does not update the package-lock.json file.
8+
// So we also run `npm install`, which does this update.
9+
// This is a workaround until this is handled automatically by `changeset version`.
10+
// See https://github.com/changesets/changesets/issues/421.
11+
exec("npx changeset version")
12+
exec("npm install")

.github/version-script-beta.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
2+
// https://github.com/cloudflare/wrangler2/blob/main/.github/version-script.js
3+
4+
import { exec } from "child_process"
5+
import fs from "fs"
6+
7+
const pkgJsonPath = "packages/cli/package.json"
8+
try {
9+
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
10+
exec("git rev-parse --short HEAD", (err, stdout) => {
11+
if (err) {
12+
console.log(err)
13+
process.exit(1)
14+
}
15+
pkg.version = "0.0.0-beta." + stdout.trim()
16+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, "\t") + "\n")
17+
})
18+
} catch (error) {
19+
console.error(error)
20+
process.exit(1)
21+
}

.github/version-script-next.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
2+
// https://github.com/cloudflare/wrangler2/blob/main/.github/version-script.js
3+
4+
import { exec } from "child_process"
5+
import fs from "fs"
6+
7+
const pkgJsonPath = "packages/cli/package.json"
8+
try {
9+
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
10+
exec("git rev-parse --short HEAD", (err, stdout) => {
11+
if (err) {
12+
console.log(err)
13+
process.exit(1)
14+
}
15+
pkg.version = "0.0.0-next." + stdout.trim()
16+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, "\t") + "\n")
17+
})
18+
} catch (error) {
19+
console.error(error)
20+
process.exit(1)
21+
}

.github/workflows/code-check.yml

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Code check
2+
3+
on:
4+
pull_request:
5+
branches: ["*"]
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
name: pnpm lint
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Install Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
21+
- uses: pnpm/[email protected]
22+
name: Install pnpm
23+
id: pnpm-install
24+
with:
25+
version: 8.6.1
26+
run_install: false
27+
28+
- name: Get pnpm store directory
29+
id: pnpm-cache
30+
run: |
31+
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
32+
- uses: actions/cache@v3
33+
name: Setup pnpm cache
34+
with:
35+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
36+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
37+
restore-keys: |
38+
${{ runner.os }}-pnpm-store-
39+
- name: Install dependencies
40+
run: pnpm install
41+
42+
- run: pnpm lint
43+
44+
format:
45+
runs-on: ubuntu-latest
46+
name: pnpm format:check
47+
steps:
48+
- uses: actions/checkout@v3
49+
with:
50+
fetch-depth: 0
51+
52+
- name: Install Node.js
53+
uses: actions/setup-node@v3
54+
with:
55+
node-version: 16
56+
57+
- uses: pnpm/[email protected]
58+
name: Install pnpm
59+
id: pnpm-install
60+
with:
61+
version: 8.6.1
62+
run_install: false
63+
64+
- name: Get pnpm store directory
65+
id: pnpm-cache
66+
run: |
67+
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
68+
69+
- uses: actions/cache@v3
70+
name: Setup pnpm cache
71+
with:
72+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
73+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
74+
restore-keys: |
75+
${{ runner.os }}-pnpm-store-
76+
77+
- name: Install dependencies
78+
run: pnpm install
79+
80+
- run: pnpm format:check
81+
82+
tsc:
83+
runs-on: ubuntu-latest
84+
name: pnpm typecheck
85+
steps:
86+
- uses: actions/checkout@v3
87+
with:
88+
fetch-depth: 0
89+
90+
- name: Install Node.js
91+
uses: actions/setup-node@v3
92+
with:
93+
node-version: 16
94+
95+
- uses: pnpm/[email protected]
96+
name: Install pnpm
97+
id: pnpm-install
98+
with:
99+
version: 8.6.1
100+
run_install: false
101+
102+
- name: Get pnpm store directory
103+
id: pnpm-cache
104+
run: |
105+
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
106+
- uses: actions/cache@v3
107+
name: Setup pnpm cache
108+
with:
109+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
110+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
111+
restore-keys: |
112+
${{ runner.os }}-pnpm-store-
113+
- name: Install dependencies
114+
run: pnpm install
115+
116+
- run: pnpm typecheck
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Adapted from create-t3-app.
2+
name: Write Beta Release comment
3+
4+
on:
5+
workflow_run:
6+
workflows: ["Release - Beta"]
7+
types:
8+
- completed
9+
10+
jobs:
11+
comment:
12+
if: |
13+
github.repository_owner == 'shadcn-ui' &&
14+
${{ github.event.workflow_run.conclusion == 'success' }}
15+
runs-on: ubuntu-latest
16+
name: Write comment to the PR
17+
steps:
18+
- name: "Comment on PR"
19+
uses: actions/github-script@v6
20+
with:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
script: |
23+
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
run_id: context.payload.workflow_run.id,
27+
});
28+
29+
for (const artifact of allArtifacts.data.artifacts) {
30+
// Extract the PR number and package version from the artifact name
31+
const match = /^npm-package-shadcn-ui@(.*?)-pr-(\d+)/.exec(artifact.name);
32+
33+
if (match) {
34+
require("fs").appendFileSync(
35+
process.env.GITHUB_ENV,
36+
`\nBETA_PACKAGE_VERSION=${match[1]}` +
37+
`\nWORKFLOW_RUN_PR=${match[2]}` +
38+
`\nWORKFLOW_RUN_ID=${context.payload.workflow_run.id}`
39+
);
40+
break;
41+
}
42+
}
43+
44+
- name: "Comment on PR with Link"
45+
uses: marocchino/sticky-pull-request-comment@v2
46+
with:
47+
number: ${{ env.WORKFLOW_RUN_PR }}
48+
message: |
49+
A new prerelease is available for testing:
50+
51+
```sh
52+
npx shadcn-ui@${{ env.BETA_PACKAGE_VERSION }}
53+
```
54+
55+
- name: "Remove the autorelease label once published"
56+
uses: actions/github-script@v6
57+
with:
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
script: |
60+
github.rest.issues.removeLabel({
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
issue_number: '${{ env.WORKFLOW_RUN_PR }}',
64+
name: '🚀 autorelease',
65+
});

.github/workflows/prerelease.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Adapted from create-t3-app.
2+
3+
name: Release - Beta
4+
5+
on:
6+
pull_request:
7+
types: [labeled]
8+
branches:
9+
- main
10+
jobs:
11+
prerelease:
12+
if: |
13+
github.repository_owner == 'shadcn-ui' &&
14+
contains(github.event.pull_request.labels.*.name, '🚀 autorelease')
15+
name: Build & Publish a beta release to NPM
16+
runs-on: ubuntu-latest
17+
environment: Preview
18+
19+
steps:
20+
- name: Checkout Repo
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Use PNPM
26+
uses: pnpm/[email protected]
27+
with:
28+
version: 8.6.1
29+
30+
- name: Use Node.js 18
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: 18
34+
cache: "pnpm"
35+
36+
- name: Install NPM Dependencies
37+
run: pnpm install
38+
39+
- name: Modify package.json version
40+
run: node .github/version-script-beta.js
41+
42+
- name: Authenticate to NPM
43+
run: echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" >> packages/cli/.npmrc
44+
env:
45+
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
46+
47+
- name: Publish Beta to NPM
48+
run: pnpm pub:beta
49+
50+
- name: get-npm-version
51+
id: package-version
52+
uses: martinbeentjes/npm-get-version-action@main
53+
with:
54+
path: packages/cli
55+
56+
- name: Upload packaged artifact
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: npm-package-shadcn-ui@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
60+
path: packages/cli/dist/index.js

0 commit comments

Comments
 (0)