diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ca7866c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,40 @@ +version: 2 + +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "09:00" + timezone: "America/Guayaquil" + open-pull-requests-limit: 10 + target-branch: "development" + groups: + strapi: + patterns: + - "@strapi/*" + dnd-kit: + patterns: + - "@dnd-kit/*" + react: + patterns: + - "react" + - "react-dom" + - "@types/react" + - "@types/react-dom" + ignore: + - dependency-name: "@strapi/strapi" + update-types: ["version-update:semver-major"] + - dependency-name: "@strapi/design-system" + update-types: ["version-update:semver-major"] + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "09:00" + timezone: "America/Guayaquil" + open-pull-requests-limit: 5 + target-branch: "development" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..05b04bd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: + - main + - development + - production + pull_request: + workflow_call: + +jobs: + ci: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Type check (server) + run: npm run test:ts:back + + - name: Type check (admin) + run: npm run test:ts:front + + - name: Build + run: npm run build + + - name: Verify plugin + run: npm run verify + + - name: Check version not already published + run: | + VERSION=$(node -p "require('./package.json').version") + if npm view strapi-plugin-form-builder-cms@$VERSION version 2>/dev/null; then + echo "❌ Version $VERSION is already published on npm. Bump the version before merging." + exit 1 + fi + echo "✅ Version $VERSION is not yet published." + + - name: Dry run publish + run: npm publish --dry-run --access public diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2c64e7f..fb9e7fc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,6 +9,7 @@ on: jobs: publish: if: github.event.pull_request.merged == true + needs: ci runs-on: ubuntu-latest steps: @@ -44,3 +45,6 @@ jobs: body: | Published from PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }} generate_release_notes: true + + ci: + uses: ./.github/workflows/ci.yml diff --git a/.gitignore b/.gitignore index 0a150cc..5d0e68b 100644 --- a/.gitignore +++ b/.gitignore @@ -102,6 +102,10 @@ public/uploads/* dist build +# Compiled JS files inside src (TypeScript sources only) +server/src/**/*.js +admin/src/**/*.js + ############################ # Node.js diff --git a/admin/src/components/DropZone.tsx b/admin/src/components/DropZone.tsx index eb3efb0..dff53a3 100644 --- a/admin/src/components/DropZone.tsx +++ b/admin/src/components/DropZone.tsx @@ -62,7 +62,7 @@ function SortableFieldRow({ {...attributes} {...listeners} style={{ cursor: 'grab', color: 'var(--strapi-neutral-400)', padding: '0 4px' }} - onClick={(e) => e.stopPropagation()} + onClick={(e: React.MouseEvent) => e.stopPropagation()} > diff --git a/admin/src/components/EmbedModal.tsx b/admin/src/components/EmbedModal.tsx index 2619106..b7d2b87 100644 --- a/admin/src/components/EmbedModal.tsx +++ b/admin/src/components/EmbedModal.tsx @@ -24,7 +24,7 @@ export function EmbedModal({ formId, open, onClose }: Props) { }; return ( - !v && onClose()}> + !v && onClose()}> Embed this form diff --git a/admin/src/components/FieldSettingsPanel.tsx b/admin/src/components/FieldSettingsPanel.tsx index 8d2ba1a..9d96867 100644 --- a/admin/src/components/FieldSettingsPanel.tsx +++ b/admin/src/components/FieldSettingsPanel.tsx @@ -260,7 +260,7 @@ export function FieldSettingsPanel({ field, onChange }: Props) { updateValidation(i, { type: String(val), value: undefined, message: '' })} + onChange={(val: string | number) => updateValidation(i, { type: String(val), value: undefined, message: '' })} size="S" > {available.map((opt) => ( diff --git a/admin/src/components/FormPreview.tsx b/admin/src/components/FormPreview.tsx index ea84fa5..4b9c266 100644 --- a/admin/src/components/FormPreview.tsx +++ b/admin/src/components/FormPreview.tsx @@ -287,7 +287,7 @@ export function FormPreview({ title, fields, settings, open, onClose }: Props) { if (!open) return null; return ( - !v && onClose()}> + !v && onClose()}> Preview — {title} diff --git a/admin/src/pages/SubmissionsPage.tsx b/admin/src/pages/SubmissionsPage.tsx index 793bf70..4dbbb12 100644 --- a/admin/src/pages/SubmissionsPage.tsx +++ b/admin/src/pages/SubmissionsPage.tsx @@ -93,7 +93,7 @@ export function SubmissionsPage() { setStatusFilter(String(val))} + onChange={(val: string | number) => setStatusFilter(String(val))} placeholder="All statuses" size="S" > diff --git a/package.json b/package.json index 62a5760..ffa40be 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "watch": "strapi-plugin watch", "watch:link": "strapi-plugin watch:link", "verify": "strapi-plugin verify", - "test:ts:front": "run -T tsc -p admin/tsconfig.json", - "test:ts:back": "run -T tsc -p server/tsconfig.json" + "test:ts:front": "npx tsc -p admin/tsconfig.json --noEmit", + "test:ts:back": "npx tsc -p server/tsconfig.json --noEmit" }, "dependencies": { "@dnd-kit/core": "^6.3.1",