generated from citrus327/react-lib-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d7e3cae
Showing
21 changed files
with
11,161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: publish_on_release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Install Pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 6.0.2 | ||
|
||
- name: Install Dependencies | ||
run: pnpm i | ||
|
||
- name: Build | ||
run: pnpm run build | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
title: Changeset Auto PR | ||
createGithubReleases: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish | ||
if: steps.changesets.outputs.hasChangesets == 'false' | ||
run: npx changeset publish | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# panda css | ||
styled-system/ | ||
|
||
# bundle-visualizer | ||
stats.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=https://registry.npmjs.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Changelog | ||
|
||
## 1.1.3 | ||
|
||
### Patch Changes | ||
|
||
- cd4222e: chore: simply package.json script | ||
chore: integrate vitest and react testing lib | ||
chore: update tsconfig into one | ||
chore: remove dev server | ||
chore: add bundle-visualizer | ||
|
||
## 1.1.2 | ||
|
||
### Patch Changes | ||
|
||
- 896548a: fix title | ||
|
||
## 1.1.1 | ||
|
||
### Patch Changes | ||
|
||
- a78d88d: new flow testing | ||
|
||
## 1.1.0 | ||
|
||
### Minor Changes | ||
|
||
- 287eab9: ## Added | ||
|
||
1. feat: support alias for declaration and panda-css | ||
|
||
## Changed | ||
|
||
2. chore: update readme.md for more introduction | ||
|
||
### Patch Changes | ||
|
||
- 4c029ee: chore: update workflow params | ||
|
||
## 1.0.0 | ||
|
||
### Major Changes | ||
|
||
- 5400655: first major release | ||
|
||
## 0.4.0 | ||
|
||
### Minor Changes | ||
|
||
- edf63a3: try minor | ||
|
||
### Patch Changes | ||
|
||
- edf63a3: mimic changeset changes | ||
|
||
## 0.3.2 | ||
|
||
### Patch Changes | ||
|
||
- 1b2626a: remove prepublishOnly hook | ||
|
||
## 0.3.1 | ||
|
||
### Patch Changes | ||
|
||
- remove cliff | ||
|
||
## 0.3.0 | ||
|
||
### Minor Changes | ||
|
||
- try changeset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 null51_ | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# react-lib-starter | ||
|
||
![Version](https://img.shields.io/npm/v/@citrus327/react-template-lib) | ||
|
||
## Introduction | ||
|
||
This is my personal React library template. | ||
|
||
## What's included | ||
|
||
The template includes the following: | ||
|
||
1. [rollup](https://rollupjs.org/) + [swc](https://swc.rs/) with esm and cjs output | ||
2. [panda-css](https://panda-css.com/) integration as a postcss plugin | ||
3. [Changesets](https://github.com/changesets/changesets) setup for versioning and auto changelog generation. | ||
4. auto NPM package publishing workflow via [changesets action](https://github.com/changesets/action) | ||
5. zero dependency by default | ||
6. `vitest` for testing | ||
7. minify all bundled files via [@rollup/plugin-terser](https://www.npmjs.com/package/@rollup/plugin-terser). | ||
8. `.d.ts` generation with alias support via [tsc-alias](https://github.com/justkey007/tsc-alias) | ||
9. single tree-shaked .d.ts file via [rollup-plugin-dts](https://www.npmjs.com/package/rollup-plugin-dts) | ||
10. bundle analyze via [rollup-plugin-visualizer](https://www.npmjs.com/package/rollup-plugin-visualizer) | ||
|
||
## What's missing | ||
|
||
1. A quick playground for components | ||
|
||
## Usage | ||
|
||
1. Directly use this repo as a template in github | ||
2. use degit: `degit [email protected]:citrus327/react-lib-starter.git` | ||
|
||
## Workflow | ||
|
||
1. Create new branch | ||
2. Do as many commits as you want | ||
3. After push all the commits, execute `pnpm run change` or `npx changeset` to create a changeset | ||
4. Modify changeset markdown file in `.changeset` folder if needed | ||
5. Push all the changes to current branch | ||
6. Make a pull request manually in your repo or just merge into the main branch | ||
7. Then changeset action will detect the changesets you've made and create new PR for it. | ||
8. After accepting the new PR, the changeset action will then go change the package version and publish to target registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"name": "@citrus327/react-template-lib", | ||
"version": "1.1.3", | ||
"description": "my react lib starter", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"module": "dist/index.esm.js", | ||
"scripts": { | ||
"prepare": "panda codegen", | ||
"dev": "rimraf dist && cross-env NODE_ENV=development rollup -c rollup.config.mjs -w", | ||
"build": "rimraf dist && cross-env NODE_ENV=production rollup -c rollup.config.mjs", | ||
"change": "npx changeset", | ||
"version": "npx changeset version", | ||
"coverage": "vitest run --coverage", | ||
"test": "vitest", | ||
"analyze": "pnpm run build -p rollup-plugin-visualizer" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/citrus327/react-lib-starter.git" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/citrus327/react-lib-starter/issues" | ||
}, | ||
"homepage": "https://github.com/citrus327/react-lib-starter#readme", | ||
"peerDependencies": { | ||
"react": ">=18.2.0", | ||
"react-dom": ">=18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@changesets/cli": "^2.26.2", | ||
"@csstools/postcss-cascade-layers": "^4.0.0", | ||
"@pandacss/dev": "^0.14.0", | ||
"@rollup/plugin-alias": "^5.0.0", | ||
"@rollup/plugin-commonjs": "^25.0.3", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"@rollup/plugin-terser": "^0.4.3", | ||
"@rollup/plugin-url": "^8.0.1", | ||
"@swc/core": "^1.3.82", | ||
"@testing-library/jest-dom": "^6.1.3", | ||
"@testing-library/react": "^14.0.0", | ||
"@types/node": "^20.4.5", | ||
"@types/react": "^18.2.17", | ||
"@types/react-dom": "^18.2.7", | ||
"@vitest/coverage-v8": "^0.34.4", | ||
"cross-env": "^7.0.3", | ||
"detect-port": "^1.5.1", | ||
"jsdom": "^22.1.0", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "^8.4.27", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^5.0.1", | ||
"rollup": "^3.27.0", | ||
"rollup-plugin-dts": "^6.0.2", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
"rollup-plugin-serve": "^2.0.2", | ||
"rollup-plugin-swc3": "^0.10.1", | ||
"rollup-plugin-visualizer": "^5.9.2", | ||
"tsc-alias": "^1.8.7", | ||
"typescript": "5.2.2", | ||
"vitest": "^0.34.4" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.