Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/main-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Main Deploy

on:
push:
branches:
- main

jobs:
release:
name: Lint, Test, and Deploy
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Set Up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Install Dependencies
run: npm ci

- name: Lint Code
run: npm run lint

- name: Run Tests
run: npm run test:ci

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true

- name: Build Artifacts
run: npm run build

- name: Save Build Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

- name: Run Semantic Release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
run: npx semantic-release
40 changes: 40 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PR Tests

on:
pull_request:
branches:
- main

jobs:
test:
name: Run Lint, Tests, and Code Coverage
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set Up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Install Dependencies
run: npm ci

- name: Lint Code
run: npm run lint

- name: Run Tests
run: npm run test:ci

- name: Build Artifacts
run: npm run build

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"main": "index.js",
"scripts": {
"build": "vite build",
"build:map": "vite build --sourcemap",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"format": "prettier --write 'src/**/*.{ts,tsx}'",
"test": "vitest run",
"test:ci": "vitest run --coverage",
"test:watch": "vitest src",
"prepare": "husky"
"test:watch": "vitest src"
},
"keywords": [
"react",
Expand All @@ -24,6 +24,17 @@
"README.md",
"LICENSE"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/click-edit.es.js",
"require": "./dist/click-edit.umd.js"
},
"./dist/style.css": {
"import": "./dist/react-click-edit.css",
"require": "./dist/react-click-edit.css"
}
},
Comment on lines +27 to +37
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

CSS export paths don't match build configuration

The package.json exports configuration references "./dist/react-click-edit.css", but:

  • The build configuration doesn't specify CSS file output naming
  • The JS output uses a different naming pattern ("click-edit.[format].js")
  • No configuration ensures the CSS module is copied to the specified location
🔗 Analysis chain

LGTM: Well-structured exports configuration

The exports field is well-structured with:

  • Proper type definitions export
  • ES and CommonJS module formats
  • CSS file exports

Let's verify the CSS file paths:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the CSS files exist in the expected location after build
npm run build
ls -l dist/react-click-edit.css

Length of output: 1303


Script:

#!/bin/bash
# Check build configuration and source files
echo "=== Vite Config ==="
cat vite.config.ts

echo -e "\n=== Source CSS Files ==="
fd -e css

echo -e "\n=== Package Dependencies ==="
cat package.json | jq '.dependencies, .devDependencies'

Length of output: 2343

"author": "",
"license": "MIT",
"peerDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ export default defineConfig({
},
},
build: {
sourcemap: true,
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "ReactClickToEdit",
formats: ["es", "umd"],
fileName: format => `click-to-edit.${format}.js`,
fileName: (format) => `click-edit.${format}.js`,
},
rollupOptions: {
external: ["react", "react-dom", "react/jsx-runtime", "classnames"],
Expand Down
Loading