Skip to content

Commit 1728e79

Browse files
authored
main (#1)
* ci: add CI workflow with type check, build, verify and dry-run publish Runs on every push and PR across all branches. Checks: - TypeScript (server + admin) - Build - Strapi plugin verify - Version not already published on npm - Dry run publish publish.yml now requires CI to pass before publishing to npm. * fix: replace yarn run -T with npx tsc and fix implicit any type errors - Fix test:ts:front and test:ts:back scripts to use npx tsc (was yarn-only syntax) - Add explicit types for implicit any parameters caught by the type check: MouseEvent on DropZone drag handle click boolean on Modal.Root onOpenChange in EmbedModal and FormPreview string | number on SingleSelect onChange in FieldSettingsPanel and SubmissionsPage * ci: add Dependabot for npm and GitHub Actions weekly updates * fix: remove stale compiled JS files from src and ignore them in .gitignore Rollup was resolving register.js (and other compiled .js files) instead of the .ts sources, causing 'default is not exported' build failures in CI. Deleted all .js artifacts from server/src and admin/src and added them to .gitignore so they are never committed again. * fix: add --noEmit to tsc type-check scripts to prevent JS file generation Without --noEmit, tsc outputs .js files next to the .ts sources. Rollup then resolves the CJS .js files instead of the .ts sources and fails with 'default is not exported' on the CommonJS interop boundary. * ci: prevent double CI run on PR branches Push trigger now only fires on main, development and production. Feature branches are covered by the pull_request trigger alone, so CI no longer runs twice when pushing to an open PR.
1 parent d28d546 commit 1728e79

10 files changed

Lines changed: 106 additions & 7 deletions

File tree

.github/dependabot.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "npm"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
timezone: "America/Guayaquil"
11+
open-pull-requests-limit: 10
12+
target-branch: "development"
13+
groups:
14+
strapi:
15+
patterns:
16+
- "@strapi/*"
17+
dnd-kit:
18+
patterns:
19+
- "@dnd-kit/*"
20+
react:
21+
patterns:
22+
- "react"
23+
- "react-dom"
24+
- "@types/react"
25+
- "@types/react-dom"
26+
ignore:
27+
- dependency-name: "@strapi/strapi"
28+
update-types: ["version-update:semver-major"]
29+
- dependency-name: "@strapi/design-system"
30+
update-types: ["version-update:semver-major"]
31+
32+
- package-ecosystem: "github-actions"
33+
directory: "/"
34+
schedule:
35+
interval: "weekly"
36+
day: "monday"
37+
time: "09:00"
38+
timezone: "America/Guayaquil"
39+
open-pull-requests-limit: 5
40+
target-branch: "development"

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- development
8+
- production
9+
pull_request:
10+
workflow_call:
11+
12+
jobs:
13+
ci:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Type check (server)
30+
run: npm run test:ts:back
31+
32+
- name: Type check (admin)
33+
run: npm run test:ts:front
34+
35+
- name: Build
36+
run: npm run build
37+
38+
- name: Verify plugin
39+
run: npm run verify
40+
41+
- name: Check version not already published
42+
run: |
43+
VERSION=$(node -p "require('./package.json').version")
44+
if npm view strapi-plugin-form-builder-cms@$VERSION version 2>/dev/null; then
45+
echo "❌ Version $VERSION is already published on npm. Bump the version before merging."
46+
exit 1
47+
fi
48+
echo "✅ Version $VERSION is not yet published."
49+
50+
- name: Dry run publish
51+
run: npm publish --dry-run --access public

.github/workflows/publish.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010
publish:
1111
if: github.event.pull_request.merged == true
12+
needs: ci
1213
runs-on: ubuntu-latest
1314

1415
steps:
@@ -44,3 +45,6 @@ jobs:
4445
body: |
4546
Published from PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}
4647
generate_release_notes: true
48+
49+
ci:
50+
uses: ./.github/workflows/ci.yml

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ public/uploads/*
102102
dist
103103
build
104104

105+
# Compiled JS files inside src (TypeScript sources only)
106+
server/src/**/*.js
107+
admin/src/**/*.js
108+
105109

106110
############################
107111
# Node.js

admin/src/components/DropZone.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function SortableFieldRow({
6262
{...attributes}
6363
{...listeners}
6464
style={{ cursor: 'grab', color: 'var(--strapi-neutral-400)', padding: '0 4px' }}
65-
onClick={(e) => e.stopPropagation()}
65+
onClick={(e: React.MouseEvent) => e.stopPropagation()}
6666
>
6767
<Drag />
6868
</Box>

admin/src/components/EmbedModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function EmbedModal({ formId, open, onClose }: Props) {
2424
};
2525

2626
return (
27-
<Modal.Root open={open} onOpenChange={(v) => !v && onClose()}>
27+
<Modal.Root open={open} onOpenChange={(v: boolean) => !v && onClose()}>
2828
<Modal.Content style={{ maxWidth: 600, width: '100%' }}>
2929
<Modal.Header>
3030
<Typography variant="beta">Embed this form</Typography>

admin/src/components/FieldSettingsPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export function FieldSettingsPanel({ field, onChange }: Props) {
260260
<Field.Root style={{ flex: 1 }}>
261261
<SingleSelect
262262
value={rule.type}
263-
onChange={(val) => updateValidation(i, { type: String(val), value: undefined, message: '' })}
263+
onChange={(val: string | number) => updateValidation(i, { type: String(val), value: undefined, message: '' })}
264264
size="S"
265265
>
266266
{available.map((opt) => (

admin/src/components/FormPreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export function FormPreview({ title, fields, settings, open, onClose }: Props) {
287287
if (!open) return null;
288288

289289
return (
290-
<Modal.Root open={open} onOpenChange={(v) => !v && onClose()}>
290+
<Modal.Root open={open} onOpenChange={(v: boolean) => !v && onClose()}>
291291
<Modal.Content style={{ maxWidth: 760, width: '100%' }}>
292292
<Modal.Header>
293293
<Typography variant="beta">Preview — {title}</Typography>

admin/src/pages/SubmissionsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function SubmissionsPage() {
9393
<SingleSelect
9494
aria-label="Filter by status"
9595
value={statusFilter}
96-
onChange={(val) => setStatusFilter(String(val))}
96+
onChange={(val: string | number) => setStatusFilter(String(val))}
9797
placeholder="All statuses"
9898
size="S"
9999
>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"watch": "strapi-plugin watch",
2828
"watch:link": "strapi-plugin watch:link",
2929
"verify": "strapi-plugin verify",
30-
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
31-
"test:ts:back": "run -T tsc -p server/tsconfig.json"
30+
"test:ts:front": "npx tsc -p admin/tsconfig.json --noEmit",
31+
"test:ts:back": "npx tsc -p server/tsconfig.json --noEmit"
3232
},
3333
"dependencies": {
3434
"@dnd-kit/core": "^6.3.1",

0 commit comments

Comments
 (0)