Skip to content

Commit 0232cb7

Browse files
committed
feat: template react component
1 parent 91a8670 commit 0232cb7

File tree

4 files changed

+81
-22
lines changed

4 files changed

+81
-22
lines changed

.github/workflows/npm-publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Npm Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
push:
10+
tags:
11+
- '*'
12+
branches:
13+
- main
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
24+
publish-npm:
25+
needs: build
26+
runs-on: ubuntu-latest
27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.ref }}
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
registry-url: https://registry.npmjs.org/
38+
39+
40+
- name: Install pnpm
41+
uses: pnpm/action-setup@v2
42+
with:
43+
version: 7
44+
45+
- name: Install & Publish
46+
run: |
47+
pnpm -v
48+
pnpm i
49+
npm publish
50+
env:
51+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

packages/create-chaos/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-chaos",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"type": "module",
55
"license": "MIT",
66
"bin": {
Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,59 @@
11
{
22
"name": "vite-react-typescript-starter",
3-
"private": true,
4-
"version": "0.0.1",
53
"type": "module",
4+
"version": "0.0.1",
5+
"private": true,
6+
"exports": {
7+
".": {
8+
"development": "./src/index.ts",
9+
"require": "./dist/index.cjs.js",
10+
"import": "./dist/index.es.js"
11+
}
12+
},
13+
"main": "./dist/index.cjs.js",
14+
"module": "./dist/index.es.js",
15+
"files": [
16+
"dist"
17+
],
618
"scripts": {
719
"dev": "vite",
8-
"build": "rm -rf dist && tsc && vite build",
20+
"build": "rm -rf dist && tsc && vite build --watch",
921
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1022
"preview": "vite preview"
1123
},
12-
"files": [
13-
"dist"
14-
],
15-
"main": "./dist/index.cjs.js",
16-
"module": "./dist/index.es.js",
1724
"typings": "./dist/index.d.ts",
18-
"exports": {
19-
".": {
20-
"import": "./dist/index.es.js",
21-
"require": "./dist/index.cjs.js"
22-
}
25+
"peerDependencies": {
26+
"react": ">=18",
27+
"react-dom": ">=18"
2328
},
2429
"dependencies": {
25-
"@tinyfe/classnames": "^0.0.8",
30+
"@chaos-design/classnames": "latest",
2631
"react": "^18.2.0",
2732
"react-dom": "^18.2.0",
2833
"sass": "^1.63.6"
2934
},
3035
"devDependencies": {
31-
"eslint-config-chaos": "latest",
3236
"@chaos-design/tsconfig": "latest",
3337
"@rollup/plugin-commonjs": "^25.0.3",
3438
"@rollup/plugin-node-resolve": "^15.1.0",
3539
"@rollup/plugin-terser": "^0.4.3",
3640
"@rollup/plugin-typescript": "^11.1.2",
41+
"@testing-library/react": "^16.0.1",
3742
"@types/node": "^20.3.3",
3843
"@types/react": "^18.2.14",
3944
"@types/react-dom": "^18.2.6",
4045
"@vitejs/plugin-react": "^4.0.1",
41-
"eslint": "^8.43.0",
46+
"@vitejs/plugin-react-swc": "^3.7.0",
47+
"eslint": "^9.11.0",
48+
"eslint-config-chaos": "latest",
4249
"eslint-define-config": "^2.1.0",
4350
"lint-staged": "^13.2.3",
4451
"npm-run-all": "^4.1.5",
4552
"prettier": "^2.8.8",
4653
"typescript": "^5.1.6",
4754
"unbuild": "^1.2.1",
48-
"vite": "^4.3.9"
49-
},
50-
"peerDependencies": {
51-
"react": ">=18",
52-
"react-dom": ">=18"
55+
"vite": "^5.4.7",
56+
"vite-plugin-dts": "^4.2.1",
57+
"vitest": "^2.1.1"
5358
}
5459
}

packages/create-chaos/template-library-react-component-ts/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export default defineConfig({
2626
formats: ['es', 'cjs'],
2727
fileName: (format: string) => `index.${format}.js`,
2828
},
29+
// watch: {
30+
// https://rollupjs.org/configuration-options/#watch
31+
// },
2932
rollupOptions: {
3033
external: [
3134
'react/jsx-runtime',

0 commit comments

Comments
 (0)