Skip to content

Commit

Permalink
feat: add workflow, fix build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisUser committed Apr 1, 2024
1 parent 7f494fe commit cdaf7b8
Show file tree
Hide file tree
Showing 5 changed files with 543 additions and 420 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
NODE_VERSION: "16"

jobs:
full-code-check:
runs-on: ubuntu-latest
steps:
- name: Full-check repository
uses: actions/checkout@v3
- uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
- name: Install dependecies
run: |
yarn install
- name: Lint code
run: |
yarn lint
- name: Build React
env:
CI: false
run: |
yarn build
26 changes: 23 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-basic-contenteditable",
"private": true,
"version": "1.0.0",
"description": "React 18 contenteditable component. Super-customizable!",
"version": "1.0.1",
"type": "module",
"main": "dist/main.js",
"types": "dist/main.d.ts",
Expand All @@ -11,6 +11,22 @@
"sideEffects": [
"**/*.css"
],
"author": "ChrisUser (https://github.com/ChrisUser)",
"repository": {
"type": "git",
"url": "https://github.com/ChrisUser/react-basic-contenteditable.git"
},
"license": "MIT",
"keywords": [
"react",
"contenteditable",
"chat-component"
],
"release": {
"branches": [
"main"
]
},
"scripts": {
"dev": "vite",
"build": "tsc --p ./tsconfig-build.json && vite build",
Expand All @@ -37,5 +53,9 @@
"typescript": "^5.2.2",
"vite": "^5.1.0",
"vite-plugin-dts": "^3.7.2"
}
},
"bugs": {
"url": "https://github.com/ChrisUser/react-basic-contenteditable/issues"
},
"homepage": "https://github.com/ChrisUser/react-basic-contenteditable#readme"
}
4 changes: 2 additions & 2 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
"include": ["vite.config.ts"],
"exclude": []
}
23 changes: 22 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { defineConfig } from "vite"
import { resolve } from "path"
import { extname, relative, resolve } from "path"
import { fileURLToPath } from "node:url"
import glob from "glob"
import react from "@vitejs/plugin-react-swc"
import dts from "vite-plugin-dts"

Expand All @@ -13,6 +15,25 @@ export default defineConfig({
},
rollupOptions: {
external: ["react", "react/jsx-runtime"],
input: Object.fromEntries(
// https://rollupjs.org/configuration-options/#input
glob.sync("lib/**/*.{ts,tsx}").map((file) => [
// 1. The name of the entry point
// lib/nested/foo.js becomes nested/foo
relative("lib", file.slice(0, file.length - extname(file).length)),
// 2. The absolute path to the entry file
// lib/nested/foo.ts becomes /project/lib/nested/foo.ts
fileURLToPath(new URL(file, import.meta.url)),
])
),
output: {
// assetFileNames: '[name][extname]',
assetFileNames: (assetInfo) => {
const assetName = assetInfo.name?.split(".").at(0)
return `${assetName === "style" ? "index" : "[name]"}[extname]`
},
entryFileNames: "[name].js",
},
},
},
})
Loading

0 comments on commit cdaf7b8

Please sign in to comment.