Skip to content

Commit cdaf7b8

Browse files
committed
feat: add workflow, fix build issue
1 parent 7f494fe commit cdaf7b8

File tree

5 files changed

+543
-420
lines changed

5 files changed

+543
-420
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
NODE_VERSION: "16"
11+
12+
jobs:
13+
full-code-check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Full-check repository
17+
uses: actions/checkout@v3
18+
- uses: actions/setup-node@v2.5.1
19+
with:
20+
node-version: ${{ env.NODE_VERSION }}
21+
check-latest: true
22+
- name: Install dependecies
23+
run: |
24+
yarn install
25+
- name: Lint code
26+
run: |
27+
yarn lint
28+
- name: Build React
29+
env:
30+
CI: false
31+
run: |
32+
yarn build

package.json

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-basic-contenteditable",
3-
"private": true,
4-
"version": "1.0.0",
3+
"description": "React 18 contenteditable component. Super-customizable!",
4+
"version": "1.0.1",
55
"type": "module",
66
"main": "dist/main.js",
77
"types": "dist/main.d.ts",
@@ -11,6 +11,22 @@
1111
"sideEffects": [
1212
"**/*.css"
1313
],
14+
"author": "ChrisUser (https://github.com/ChrisUser)",
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/ChrisUser/react-basic-contenteditable.git"
18+
},
19+
"license": "MIT",
20+
"keywords": [
21+
"react",
22+
"contenteditable",
23+
"chat-component"
24+
],
25+
"release": {
26+
"branches": [
27+
"main"
28+
]
29+
},
1430
"scripts": {
1531
"dev": "vite",
1632
"build": "tsc --p ./tsconfig-build.json && vite build",
@@ -37,5 +53,9 @@
3753
"typescript": "^5.2.2",
3854
"vite": "^5.1.0",
3955
"vite-plugin-dts": "^3.7.2"
40-
}
56+
},
57+
"bugs": {
58+
"url": "https://github.com/ChrisUser/react-basic-contenteditable/issues"
59+
},
60+
"homepage": "https://github.com/ChrisUser/react-basic-contenteditable#readme"
4161
}

tsconfig.node.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"module": "ESNext",
66
"moduleResolution": "bundler",
77
"allowSyntheticDefaultImports": true,
8-
"strict": true
98
},
10-
"include": ["vite.config.ts"]
9+
"include": ["vite.config.ts"],
10+
"exclude": []
1111
}

vite.config.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { defineConfig } from "vite"
2-
import { resolve } from "path"
2+
import { extname, relative, resolve } from "path"
3+
import { fileURLToPath } from "node:url"
4+
import glob from "glob"
35
import react from "@vitejs/plugin-react-swc"
46
import dts from "vite-plugin-dts"
57

@@ -13,6 +15,25 @@ export default defineConfig({
1315
},
1416
rollupOptions: {
1517
external: ["react", "react/jsx-runtime"],
18+
input: Object.fromEntries(
19+
// https://rollupjs.org/configuration-options/#input
20+
glob.sync("lib/**/*.{ts,tsx}").map((file) => [
21+
// 1. The name of the entry point
22+
// lib/nested/foo.js becomes nested/foo
23+
relative("lib", file.slice(0, file.length - extname(file).length)),
24+
// 2. The absolute path to the entry file
25+
// lib/nested/foo.ts becomes /project/lib/nested/foo.ts
26+
fileURLToPath(new URL(file, import.meta.url)),
27+
])
28+
),
29+
output: {
30+
// assetFileNames: '[name][extname]',
31+
assetFileNames: (assetInfo) => {
32+
const assetName = assetInfo.name?.split(".").at(0)
33+
return `${assetName === "style" ? "index" : "[name]"}[extname]`
34+
},
35+
entryFileNames: "[name].js",
36+
},
1637
},
1738
},
1839
})

0 commit comments

Comments
 (0)