Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyichv committed Sep 9, 2024
0 parents commit 5c9b7d7
Show file tree
Hide file tree
Showing 30 changed files with 3,747 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "ilyichv/shadcn-zod-form" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
12 changes: 12 additions & 0 deletions .github/changeset-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
// https://github.com/cloudflare/wrangler2/blob/main/.github/changeset-version.js

import { exec } from "node:child_process";

// This script is used by the `release.yml` workflow to update the version of the packages being released.
// The standard step is only to run `changeset version` but this does not update the package-lock.json file.
// So we also run `npm install`, which does this update.
// This is a workaround until this is handled automatically by `changeset version`.
// See https://github.com/changesets/changesets/issues/421.
exec("npx changeset version");
exec("npm install");
79 changes: 79 additions & 0 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# adapted from: https://github.com/shadcn-ui/ui/blob/f4ca57a79cf2d56f9c55021242a55cf0e1018b72/.github/workflows/code-check.yml

name: Code check

on:
pull_request:
branches: ["*"]

jobs:
lint:
runs-on: ubuntu-latest
name: pnpm lint
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 9.0.6
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- run: pnpm lint
tsc:
runs-on: ubuntu-latest
name: pnpm typecheck
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 9.0.6
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- run: pnpm typecheck
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Adapted from create-t3-app.

name: Release

on:
push:
branches:
- main

jobs:
release:
if: ${{ github.repository_owner == 'ilyichv' }}
name: Create a PR for release workflow
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use PNPM
uses: pnpm/action-setup@v4
with:
version: 9.0.6

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
version: 9.0.6
node-version: 18
cache: "pnpm"

- name: Install NPM Dependencies
run: pnpm install

- name: Build the package
run: pnpm build

- name: Create Version PR or Publish to NPM
id: changesets
uses: changesets/[email protected]
with:
commit: "chore(release): version packages"
title: "chore(release): version packages"
version: node .github/changeset-version.js
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_ENV: "production"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# shadcn-zod-form

## 0.0.1

### Patch Changes

- initial commit
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Contributing to shadcn-zod-form

Thank you for your interest in contributing to shadcn-zod-form! We welcome contributions from the community to help improve and grow this project.

## Getting Started

1. Fork the repository on GitHub.
2. Clone your fork locally.
3. Install dependencies with `pnpm install`.
4. Create a new branch for your feature or bug fix.

## Development

- Use `pnpm dev` to start the development server with watch mode.
- Make your changes in the `src` directory.
- Ensure your code follows the project's coding style and conventions.

## Testing

- Add tests for new features or bug fixes.
- Run tests using `pnpm test` (Note: You may need to add a test script to package.json).

## Linting

- Run `pnpm lint` to check for code style issues.
- Fix any linting errors before submitting your pull request.

## Submitting Changes

1. Commit your changes with a clear and descriptive commit message.
2. Push your changes to your fork on GitHub.
3. Create a pull request against the main repository.
4. Describe your changes in the pull request description.


## Questions

If you have any questions or need further clarification, please open an issue on GitHub.

Thank you for contributing to shadcn-zod-form!
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 ilyichv

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# shadcn-zod-form

Generate [shadcn/ui](https://ui.shadcn.com/) forms from [Zod](https://github.com/colinhacks/zod) schemas.

## Features

- Generate shadcn/ui forms from Zod schemas
- Automatically map Zod types to appropriate form components
- Easy-to-use CLI interface

## Installation

```bash
npx shadcn-zod-form@latest init
```

## Usage

```bash
npx shadcn-zod-form@latest generate ./path/to/zod/schema.ts
```


## License

MIT

## Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.
12 changes: 12 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "shadcn-zod-form",
"version": "0.0.1",
"description": "Generate shadcn/ui forms from zod schemas",
"publishConfig": {
"access": "public"
},
"files": ["dist"],
"type": "module",
"author": {
"name": "ilyichv",
"url": "https://x.com/ilyichv_"
},
"repository": {
"type": "git",
"url": "https://github.com/ilyichv/shadcn-zod-form.git"
},
"keywords": ["shadcn", "zod", "form", "ui", "cli", "react"],
"exports": "./dist/index.js",
"bin": "./dist/index.js",
"scripts": {
"dev": "tsup --watch",
"build": "tsup",
"typecheck": "tsc --noEmit",
"lint": "pnpm biome check src"
},
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.8",
"@types/fs-extra": "^11.0.4",
"@types/lodash.camelcase": "^4.3.9",
"@types/lodash.kebabcase": "^4.1.9",
"@types/lodash.startcase": "^4.4.9",
"@types/lodash.template": "^4.5.3",
"@types/node": "^22.5.4",
"@types/prompts": "^2.4.9",
"tsup": "^8.2.4",
"type-fest": "^4.26.1",
"typescript": "^5.5.4"
},
"dependencies": {
"chalk": "^5.3.0",
"commander": "^12.1.0",
"cosmiconfig": "^9.0.0",
"fs-extra": "^11.2.0",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"lodash.startcase": "^4.4.0",
"lodash.template": "^4.5.0",
"ora": "^8.1.0",
"prompts": "^2.4.2",
"ts-morph": "^23.0.0",
"tsconfig-paths": "^4.2.0",
"zod": "^3.23.8"
}
}
Loading

0 comments on commit 5c9b7d7

Please sign in to comment.