From a1d9225ff3cf4424a3b4f34e5f9b1555df46260d Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 11:52:04 +0100 Subject: [PATCH 1/8] chore: move next codebase to root and added migration guide chore: move next codebase to root and added migration guide chore: update build-next.yml chore: update eslint config chore: ignore scripts on eslint --- .github/workflows/build-next.yml | 27 +- next/.gitignore => .gitignore | 0 .gitmodules | 2 +- next/.nvmrc => .nvmrc | 0 {next/.vscode => .vscode}/settings.json | 0 next/CHANGELOG.md => CHANGELOG.md | 0 MIGRATING.md | 277 ++++++++++++++++++ README.md | 4 +- next/babel.config.mjs => babel.config.mjs | 0 next/eslint.config.mjs => eslint.config.mjs | 2 +- next/jest.config.mjs => jest.config.mjs | 0 ...chema-test-suite => json-schema-test-suite | 0 next/package.json => package.json | 0 next/pnpm-lock.yaml => pnpm-lock.yaml | 0 {next/src => src}/custom/order.ts | 0 {next/src => src}/errors/index.ts | 0 {next/src => src}/errors/messages.ts | 0 {next/src => src}/field/schema.ts | 0 {next/src => src}/field/type.ts | 0 {next/src => src}/form.ts | 4 +- {next/src => src}/index.ts | 0 {next/src => src}/modify-schema.ts | 0 {next/src => src}/mutations.ts | 0 {next/src => src}/types.ts | 0 {next/src => src}/utils.ts | 0 {next/src => src}/validation/array.ts | 0 {next/src => src}/validation/composition.ts | 0 {next/src => src}/validation/conditions.ts | 0 {next/src => src}/validation/const.ts | 0 {next/src => src}/validation/custom/date.ts | 0 {next/src => src}/validation/enum.ts | 0 {next/src => src}/validation/file.ts | 0 {next/src => src}/validation/format.ts | 0 {next/src => src}/validation/json-logic.ts | 0 {next/src => src}/validation/number.ts | 0 {next/src => src}/validation/object.ts | 0 {next/src => src}/validation/schema.ts | 0 {next/src => src}/validation/string.ts | 0 {next/src => src}/validation/util.ts | 0 {next/test => test}/custom/order.test.ts | 0 .../test => test}/errors/form-errors.test.ts | 0 {next/test => test}/errors/messages.test.ts | 0 {next/test => test}/errors/path.test.ts | 0 {next/test => test}/fields.test.ts | 0 {next/test => test}/fields/array.test.ts | 0 {next/test => test}/fields/mutation.test.ts | 0 {next/test => test}/fields/visibility.test.ts | 0 {next/test => test}/form.test.ts | 0 .../json-schema-test-suite/constants.d.ts | 0 .../json-schema-test-suite/constants.js | 0 .../failed-json-schema-test-suite.json | 0 .../json-schema-test-suite/helpers.ts | 0 .../json-schema-test-suite-tracker.js | 0 .../json-schema-test-suite.test.ts | 0 {next/test => test}/modify-schema.test.ts | 0 {next/test => test}/test-utils.ts | 0 {next/test => test}/utils.test.ts | 0 .../v0-baseline-test-results.json | 0 .../test => test}/v0_compare_test_results.js | 0 {next/test => test}/validation/array.test.ts | 0 .../validation/boolean_schema.test.ts | 0 .../validation/boolean_type.test.ts | 0 .../validation/composition.test.ts | 0 {next/test => test}/validation/const.test.ts | 0 {next/test => test}/validation/enum.test.ts | 0 {next/test => test}/validation/file.test.ts | 0 {next/test => test}/validation/format.test.ts | 0 .../validation/json-logic-v0.test.js | 0 .../validation/json-logic.fixtures.js | 0 .../validation/json-logic.test.ts | 0 {next/test => test}/validation/number.test.ts | 0 {next/test => test}/validation/object.test.ts | 0 .../test => test}/validation/optional.test.ts | 0 .../validation/required_field.test.ts | 0 {next/test => test}/validation/string.test.ts | 0 next/tsconfig.json => tsconfig.json | 0 next/tsup.config.js => tsup.config.js | 0 77 files changed, 298 insertions(+), 18 deletions(-) rename next/.gitignore => .gitignore (100%) rename next/.nvmrc => .nvmrc (100%) rename {next/.vscode => .vscode}/settings.json (100%) rename next/CHANGELOG.md => CHANGELOG.md (100%) create mode 100644 MIGRATING.md rename next/babel.config.mjs => babel.config.mjs (100%) rename next/eslint.config.mjs => eslint.config.mjs (60%) rename next/jest.config.mjs => jest.config.mjs (100%) rename next/json-schema-test-suite => json-schema-test-suite (100%) rename next/package.json => package.json (100%) rename next/pnpm-lock.yaml => pnpm-lock.yaml (100%) rename {next/src => src}/custom/order.ts (100%) rename {next/src => src}/errors/index.ts (100%) rename {next/src => src}/errors/messages.ts (100%) rename {next/src => src}/field/schema.ts (100%) rename {next/src => src}/field/type.ts (100%) rename {next/src => src}/form.ts (97%) rename {next/src => src}/index.ts (100%) rename {next/src => src}/modify-schema.ts (100%) rename {next/src => src}/mutations.ts (100%) rename {next/src => src}/types.ts (100%) rename {next/src => src}/utils.ts (100%) rename {next/src => src}/validation/array.ts (100%) rename {next/src => src}/validation/composition.ts (100%) rename {next/src => src}/validation/conditions.ts (100%) rename {next/src => src}/validation/const.ts (100%) rename {next/src => src}/validation/custom/date.ts (100%) rename {next/src => src}/validation/enum.ts (100%) rename {next/src => src}/validation/file.ts (100%) rename {next/src => src}/validation/format.ts (100%) rename {next/src => src}/validation/json-logic.ts (100%) rename {next/src => src}/validation/number.ts (100%) rename {next/src => src}/validation/object.ts (100%) rename {next/src => src}/validation/schema.ts (100%) rename {next/src => src}/validation/string.ts (100%) rename {next/src => src}/validation/util.ts (100%) rename {next/test => test}/custom/order.test.ts (100%) rename {next/test => test}/errors/form-errors.test.ts (100%) rename {next/test => test}/errors/messages.test.ts (100%) rename {next/test => test}/errors/path.test.ts (100%) rename {next/test => test}/fields.test.ts (100%) rename {next/test => test}/fields/array.test.ts (100%) rename {next/test => test}/fields/mutation.test.ts (100%) rename {next/test => test}/fields/visibility.test.ts (100%) rename {next/test => test}/form.test.ts (100%) rename {next/test => test}/json-schema-test-suite/constants.d.ts (100%) rename {next/test => test}/json-schema-test-suite/constants.js (100%) rename {next/test => test}/json-schema-test-suite/failed-json-schema-test-suite.json (100%) rename {next/test => test}/json-schema-test-suite/helpers.ts (100%) rename {next/test => test}/json-schema-test-suite/json-schema-test-suite-tracker.js (100%) rename {next/test => test}/json-schema-test-suite/json-schema-test-suite.test.ts (100%) rename {next/test => test}/modify-schema.test.ts (100%) rename {next/test => test}/test-utils.ts (100%) rename {next/test => test}/utils.test.ts (100%) rename {next/test => test}/v0-baseline-test-results.json (100%) rename {next/test => test}/v0_compare_test_results.js (100%) rename {next/test => test}/validation/array.test.ts (100%) rename {next/test => test}/validation/boolean_schema.test.ts (100%) rename {next/test => test}/validation/boolean_type.test.ts (100%) rename {next/test => test}/validation/composition.test.ts (100%) rename {next/test => test}/validation/const.test.ts (100%) rename {next/test => test}/validation/enum.test.ts (100%) rename {next/test => test}/validation/file.test.ts (100%) rename {next/test => test}/validation/format.test.ts (100%) rename {next/test => test}/validation/json-logic-v0.test.js (100%) rename {next/test => test}/validation/json-logic.fixtures.js (100%) rename {next/test => test}/validation/json-logic.test.ts (100%) rename {next/test => test}/validation/number.test.ts (100%) rename {next/test => test}/validation/object.test.ts (100%) rename {next/test => test}/validation/optional.test.ts (100%) rename {next/test => test}/validation/required_field.test.ts (100%) rename {next/test => test}/validation/string.test.ts (100%) rename next/tsconfig.json => tsconfig.json (100%) rename next/tsup.config.js => tsup.config.js (100%) diff --git a/.github/workflows/build-next.yml b/.github/workflows/build-next.yml index f834e6a74..710bb6ba6 100644 --- a/.github/workflows/build-next.yml +++ b/.github/workflows/build-next.yml @@ -1,9 +1,10 @@ name: Pull Request (v-next) on: pull_request: - paths: - - 'next/**' # Only run if files in next/ directory change - - '.github/workflows/build-next.yml' # Also run if this workflow file changes + paths-ignore: + - 'v0/**' # Skip if ONLY v0/ directory files change + - '.github/workflows/build.yml' # Skip if ONLY build.yml file changes + jobs: dependencies: @@ -24,18 +25,18 @@ jobs: - uses: actions/setup-node@v3 with: - node-version-file: 'next/.nvmrc' + node-version-file: '.nvmrc' - name: Cache PNPM dependencies uses: actions/cache@v3 id: cache-next with: - path: next/node_modules - key: ${{ runner.os }}-pnpm-next-${{ hashFiles('next/pnpm-lock.yaml') }} + path: node_modules + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Install dependencies if: steps.cache-next.outputs.cache-hit != 'true' - run: cd next && pnpm install + run: pnpm install test: runs-on: ubuntu-latest @@ -52,7 +53,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version-file: 'next/.nvmrc' + node-version-file: '.nvmrc' - name: Get cached v0 dependencies uses: actions/cache@v3 @@ -63,14 +64,14 @@ jobs: - name: Get cached PNPM dependencies uses: actions/cache@v3 with: - path: next/node_modules - key: ${{ runner.os }}-pnpm-next-${{ hashFiles('next/pnpm-lock.yaml') }} + path: node_modules + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run lint and type checks - run: cd next && pnpm check + run: pnpm check - name: Tests - run: cd next && pnpm test + run: pnpm test - name: v0 Tests - run: cd next && pnpm run test:v0 || true + run: cd v0 && npm run test diff --git a/next/.gitignore b/.gitignore similarity index 100% rename from next/.gitignore rename to .gitignore diff --git a/.gitmodules b/.gitmodules index 735edb903..fe6e7601c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "next/json-schema-test-suite"] - path = next/json-schema-test-suite + path = json-schema-test-suite url = git@github.com:json-schema-org/JSON-Schema-Test-Suite.git diff --git a/next/.nvmrc b/.nvmrc similarity index 100% rename from next/.nvmrc rename to .nvmrc diff --git a/next/.vscode/settings.json b/.vscode/settings.json similarity index 100% rename from next/.vscode/settings.json rename to .vscode/settings.json diff --git a/next/CHANGELOG.md b/CHANGELOG.md similarity index 100% rename from next/CHANGELOG.md rename to CHANGELOG.md diff --git a/MIGRATING.md b/MIGRATING.md new file mode 100644 index 000000000..c3a0ca8d0 --- /dev/null +++ b/MIGRATING.md @@ -0,0 +1,277 @@ +# Migrating from v0 to v1 + +This guide helps you upgrade from `@remoteoss/json-schema-form` v0 to v1. + +## Overview + +v1 is a complete rewrite in TypeScript with significant improvements: + +- **Full TypeScript support** with proper type definitions +- **Removed Yup dependency** - uses native JSON Schema validation +- **Simplified API** with better error handling +- **Better performance** with fewer dependencies +- **ESM-only** for modern JavaScript environments + +## Breaking Changes + +### 1. **Node.js & Package Manager Requirements** + +```diff +- Node.js >= 18.14.0 (any package manager) ++ Node.js >= 18.14.0 (with pnpm recommended) ++ Package is now ESM-only (type: "module") +``` + +### 2. **Dependencies Removed** + +v1 removes several heavy dependencies: + +```diff +- yup (validation library) +- lodash (utility functions) +- randexp (random expression generator) +# Only json-logic-js remains +``` + +### 3. **API Changes** + +#### New TypeScript Exports + +```diff ++ import { ++ Field, ++ FieldType, ++ FormErrors, ++ ValidationOptions, ++ ValidationResult ++ } from '@remoteoss/json-schema-form' +``` + +### 4. **createHeadlessForm Configuration** + +#### Deprecated Options + +```diff +- createHeadlessForm(schema, { +- customProperties: { ... }, // Deprecated +- }) + ++ createHeadlessForm(schema, { ++ initialValues: { ... }, ++ validationOptions: { ... }, ++ strictInputType: boolean ++ }) +``` + +#### Validation + +The main difference is that on v1 we stopped returning yup errors and only kept the form errors, when validating a form value change. + +```diff +// v0 - Returns Yup errors and Form Errors (which were based on the yup errors) +const { handleValidation } = createHeadlessForm(schema) +const { yupErrors, formErrors } = handleValidation(values) + +// v1 - Only Returns Form Errors +const { handleValidation } = createHeadlessForm(schema) +const { formErrors } = handleValidation(values) +``` + +### 5. **Field Structure Changes** + +#### Field Properties + +```diff +// v0 - Mixed property names +{ + name: 'username', +- type: 'text', // Deprecated ++ inputType: 'text', // Consistent naming + jsonType: 'string', + required: true +} +``` + +### 6. **modify() Function Changes** + +The `modify` function API remains mostly compatible, but with improved TypeScript support: + +```typescript +// v0 +const { schema, warnings } = modify(originalSchema, { + fields: { ... }, + create: { ... }, + pick: [...], + orderRoot: [...] +}) + +// v1 - Same API, better types +const { schema, warnings } = modify(originalSchema, { + fields: { ... }, + create: { ... }, + pick: [...], + orderRoot: [...] +}) +``` + +## Migration Steps + +### Step 1: Update Package + +```bash +# Remove old version +npm uninstall @remoteoss/json-schema-form + +# Install v1 +npm install @remoteoss/json-schema-form@v1 +``` + +### Step 2: Update Configuration + +Replace any deprecated config options (if necessary): + +```diff +// Before +const form = createHeadlessForm(schema, { +- customProperties: { +- username: { +- placeholder: 'Enter username' +- } +- } +}) + +// After - Use schema modifications instead +const modifiedSchema = modify(schema, { + fields: { + username: { + 'x-jsf-presentation': { + placeholder: 'Enter username' + } + } + } +}) + +const form = createHeadlessForm(modifiedSchema.schema) +``` + +### Step 3: Update Error Handling + +```diff +// Before (assuming you were using yupErrors) +const { yupErrors } = handleValidation(formValues) +- if (yupErrors.username) { +- console.log('Username error:', yupErrors.username) +- } + +// After +const { formErrors } = handleValidation(formValues) ++ if (formErrors?.username) { ++ console.log('Username error:', formErrors.username) ++ } +``` + +### Step 4: Update Field Type Checks + +```diff +// Before +- if (field.type === 'text') { ++ if (field.inputType === 'text') { + // Handle text field +} +``` + +### Step 5: Update TypeScript Types + +```typescript +// Add proper TypeScript imports +import { + CreateHeadlessFormOptions, + Field, + FormErrors, + ValidationResult +} from '@remoteoss/json-schema-form' + +// Use typed interfaces +const config: CreateHeadlessFormOptions = { + initialValues: { username: '' }, + strictInputType: true +} + +const form = createHeadlessForm(schema, config) +``` + +## New Features in v1 + +### 1. **Better TypeScript Support** + +Full type safety with proper interfaces: + +```typescript +interface Field { + name: string + inputType: FieldType + jsonType: string + required: boolean + // ... other properties +} +``` + +### 2. **Improved Error Messages** + +More descriptive validation errors with path information: + +```typescript +const { formErrors } = handleValidation(values) + +// Nested error structure +if (formErrors?.address?.street) { + console.log('Street validation failed') +} +``` + +### 3. **Enhanced Validation Options** + +```typescript +const form = createHeadlessForm(schema, { + validationOptions: { + allowForbiddenValues: true, + // Additional validation controls + } +}) +``` + +## Common Migration Issues + +### 1. **ESM Import Errors** + +If you get import errors, ensure your project supports ESM: + +```json +// package.json +{ + "type": "module" +} +``` + +## Testing Your Migration + +1. **Run your test suite** to catch breaking changes +2. **Check error handling** - verify form validation still works +3. **Test field rendering** - ensure all field types display correctly +4. **Validate TypeScript** - run `tsc --noEmit` to check types + +## Need Help? + +- Check the [v1 documentation](https://json-schema-form.vercel.app/) +- Review the [changelog](CHANGELOG.md) for detailed changes +- Open an issue on [GitHub](https://github.com/remoteoss/json-schema-form/issues) + +## Rollback Plan + +If you encounter issues, you can temporarily rollback: + +```bash +npm install @remoteoss/json-schema-form@^0.12.0 +``` + +This gives you time to properly migrate while keeping your application functional. diff --git a/README.md b/README.md index c4f3454c6..060836528 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ Check the 🕹️ **[JSF Playground](https://json-schema-form.vercel.app/?path=/ Read [CONTRIBUTING](CONTRIBUTING.md) to get started. -We are working on the [next version v1.0](/next). A rewrite in TypeScript with major bugfixes and missing features. It aims to support the latest JSON Schema dialect 2020-12. +## Migrating + +If you're using `v0` and wish to migrate to `v1`, read [MIGRATING](MIGRATING.md) to get started. _Backed by [Remote.com](https://remote.com/)_ diff --git a/next/babel.config.mjs b/babel.config.mjs similarity index 100% rename from next/babel.config.mjs rename to babel.config.mjs diff --git a/next/eslint.config.mjs b/eslint.config.mjs similarity index 60% rename from next/eslint.config.mjs rename to eslint.config.mjs index d3fe8ed8d..2b1ebb0b2 100644 --- a/next/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,7 +1,7 @@ import antfu from '@antfu/eslint-config' export default antfu({ - ignores: ['test/v0-baseline-test-results.json'], + ignores: ['test/v0-baseline-test-results.json', 'v0/**', 'scripts/**'], rules: { curly: ['error', 'all'], }, diff --git a/next/jest.config.mjs b/jest.config.mjs similarity index 100% rename from next/jest.config.mjs rename to jest.config.mjs diff --git a/next/json-schema-test-suite b/json-schema-test-suite similarity index 100% rename from next/json-schema-test-suite rename to json-schema-test-suite diff --git a/next/package.json b/package.json similarity index 100% rename from next/package.json rename to package.json diff --git a/next/pnpm-lock.yaml b/pnpm-lock.yaml similarity index 100% rename from next/pnpm-lock.yaml rename to pnpm-lock.yaml diff --git a/next/src/custom/order.ts b/src/custom/order.ts similarity index 100% rename from next/src/custom/order.ts rename to src/custom/order.ts diff --git a/next/src/errors/index.ts b/src/errors/index.ts similarity index 100% rename from next/src/errors/index.ts rename to src/errors/index.ts diff --git a/next/src/errors/messages.ts b/src/errors/messages.ts similarity index 100% rename from next/src/errors/messages.ts rename to src/errors/messages.ts diff --git a/next/src/field/schema.ts b/src/field/schema.ts similarity index 100% rename from next/src/field/schema.ts rename to src/field/schema.ts diff --git a/next/src/field/type.ts b/src/field/type.ts similarity index 100% rename from next/src/field/type.ts rename to src/field/type.ts diff --git a/next/src/form.ts b/src/form.ts similarity index 97% rename from next/src/form.ts rename to src/form.ts index fa88ec2d2..2a2c586e7 100644 --- a/next/src/form.ts +++ b/src/form.ts @@ -248,8 +248,8 @@ function buildFields(params: { schema: JsfObjectSchema, originalSchema: JsfObjec * @throws An error if any forbidden options are found */ function validateOptions(options: CreateHeadlessFormOptions) { - if (Object.prototype.hasOwnProperty.call(options, 'modifyConfig')) { - throw new Error('`modifyConfig` is a deprecated option and it\'s not supported on json-schema-form v1') + if (Object.prototype.hasOwnProperty.call(options, 'customProperties')) { + throw new Error('`customProperties` is a deprecated option and it\'s not supported on json-schema-form v1') } } diff --git a/next/src/index.ts b/src/index.ts similarity index 100% rename from next/src/index.ts rename to src/index.ts diff --git a/next/src/modify-schema.ts b/src/modify-schema.ts similarity index 100% rename from next/src/modify-schema.ts rename to src/modify-schema.ts diff --git a/next/src/mutations.ts b/src/mutations.ts similarity index 100% rename from next/src/mutations.ts rename to src/mutations.ts diff --git a/next/src/types.ts b/src/types.ts similarity index 100% rename from next/src/types.ts rename to src/types.ts diff --git a/next/src/utils.ts b/src/utils.ts similarity index 100% rename from next/src/utils.ts rename to src/utils.ts diff --git a/next/src/validation/array.ts b/src/validation/array.ts similarity index 100% rename from next/src/validation/array.ts rename to src/validation/array.ts diff --git a/next/src/validation/composition.ts b/src/validation/composition.ts similarity index 100% rename from next/src/validation/composition.ts rename to src/validation/composition.ts diff --git a/next/src/validation/conditions.ts b/src/validation/conditions.ts similarity index 100% rename from next/src/validation/conditions.ts rename to src/validation/conditions.ts diff --git a/next/src/validation/const.ts b/src/validation/const.ts similarity index 100% rename from next/src/validation/const.ts rename to src/validation/const.ts diff --git a/next/src/validation/custom/date.ts b/src/validation/custom/date.ts similarity index 100% rename from next/src/validation/custom/date.ts rename to src/validation/custom/date.ts diff --git a/next/src/validation/enum.ts b/src/validation/enum.ts similarity index 100% rename from next/src/validation/enum.ts rename to src/validation/enum.ts diff --git a/next/src/validation/file.ts b/src/validation/file.ts similarity index 100% rename from next/src/validation/file.ts rename to src/validation/file.ts diff --git a/next/src/validation/format.ts b/src/validation/format.ts similarity index 100% rename from next/src/validation/format.ts rename to src/validation/format.ts diff --git a/next/src/validation/json-logic.ts b/src/validation/json-logic.ts similarity index 100% rename from next/src/validation/json-logic.ts rename to src/validation/json-logic.ts diff --git a/next/src/validation/number.ts b/src/validation/number.ts similarity index 100% rename from next/src/validation/number.ts rename to src/validation/number.ts diff --git a/next/src/validation/object.ts b/src/validation/object.ts similarity index 100% rename from next/src/validation/object.ts rename to src/validation/object.ts diff --git a/next/src/validation/schema.ts b/src/validation/schema.ts similarity index 100% rename from next/src/validation/schema.ts rename to src/validation/schema.ts diff --git a/next/src/validation/string.ts b/src/validation/string.ts similarity index 100% rename from next/src/validation/string.ts rename to src/validation/string.ts diff --git a/next/src/validation/util.ts b/src/validation/util.ts similarity index 100% rename from next/src/validation/util.ts rename to src/validation/util.ts diff --git a/next/test/custom/order.test.ts b/test/custom/order.test.ts similarity index 100% rename from next/test/custom/order.test.ts rename to test/custom/order.test.ts diff --git a/next/test/errors/form-errors.test.ts b/test/errors/form-errors.test.ts similarity index 100% rename from next/test/errors/form-errors.test.ts rename to test/errors/form-errors.test.ts diff --git a/next/test/errors/messages.test.ts b/test/errors/messages.test.ts similarity index 100% rename from next/test/errors/messages.test.ts rename to test/errors/messages.test.ts diff --git a/next/test/errors/path.test.ts b/test/errors/path.test.ts similarity index 100% rename from next/test/errors/path.test.ts rename to test/errors/path.test.ts diff --git a/next/test/fields.test.ts b/test/fields.test.ts similarity index 100% rename from next/test/fields.test.ts rename to test/fields.test.ts diff --git a/next/test/fields/array.test.ts b/test/fields/array.test.ts similarity index 100% rename from next/test/fields/array.test.ts rename to test/fields/array.test.ts diff --git a/next/test/fields/mutation.test.ts b/test/fields/mutation.test.ts similarity index 100% rename from next/test/fields/mutation.test.ts rename to test/fields/mutation.test.ts diff --git a/next/test/fields/visibility.test.ts b/test/fields/visibility.test.ts similarity index 100% rename from next/test/fields/visibility.test.ts rename to test/fields/visibility.test.ts diff --git a/next/test/form.test.ts b/test/form.test.ts similarity index 100% rename from next/test/form.test.ts rename to test/form.test.ts diff --git a/next/test/json-schema-test-suite/constants.d.ts b/test/json-schema-test-suite/constants.d.ts similarity index 100% rename from next/test/json-schema-test-suite/constants.d.ts rename to test/json-schema-test-suite/constants.d.ts diff --git a/next/test/json-schema-test-suite/constants.js b/test/json-schema-test-suite/constants.js similarity index 100% rename from next/test/json-schema-test-suite/constants.js rename to test/json-schema-test-suite/constants.js diff --git a/next/test/json-schema-test-suite/failed-json-schema-test-suite.json b/test/json-schema-test-suite/failed-json-schema-test-suite.json similarity index 100% rename from next/test/json-schema-test-suite/failed-json-schema-test-suite.json rename to test/json-schema-test-suite/failed-json-schema-test-suite.json diff --git a/next/test/json-schema-test-suite/helpers.ts b/test/json-schema-test-suite/helpers.ts similarity index 100% rename from next/test/json-schema-test-suite/helpers.ts rename to test/json-schema-test-suite/helpers.ts diff --git a/next/test/json-schema-test-suite/json-schema-test-suite-tracker.js b/test/json-schema-test-suite/json-schema-test-suite-tracker.js similarity index 100% rename from next/test/json-schema-test-suite/json-schema-test-suite-tracker.js rename to test/json-schema-test-suite/json-schema-test-suite-tracker.js diff --git a/next/test/json-schema-test-suite/json-schema-test-suite.test.ts b/test/json-schema-test-suite/json-schema-test-suite.test.ts similarity index 100% rename from next/test/json-schema-test-suite/json-schema-test-suite.test.ts rename to test/json-schema-test-suite/json-schema-test-suite.test.ts diff --git a/next/test/modify-schema.test.ts b/test/modify-schema.test.ts similarity index 100% rename from next/test/modify-schema.test.ts rename to test/modify-schema.test.ts diff --git a/next/test/test-utils.ts b/test/test-utils.ts similarity index 100% rename from next/test/test-utils.ts rename to test/test-utils.ts diff --git a/next/test/utils.test.ts b/test/utils.test.ts similarity index 100% rename from next/test/utils.test.ts rename to test/utils.test.ts diff --git a/next/test/v0-baseline-test-results.json b/test/v0-baseline-test-results.json similarity index 100% rename from next/test/v0-baseline-test-results.json rename to test/v0-baseline-test-results.json diff --git a/next/test/v0_compare_test_results.js b/test/v0_compare_test_results.js similarity index 100% rename from next/test/v0_compare_test_results.js rename to test/v0_compare_test_results.js diff --git a/next/test/validation/array.test.ts b/test/validation/array.test.ts similarity index 100% rename from next/test/validation/array.test.ts rename to test/validation/array.test.ts diff --git a/next/test/validation/boolean_schema.test.ts b/test/validation/boolean_schema.test.ts similarity index 100% rename from next/test/validation/boolean_schema.test.ts rename to test/validation/boolean_schema.test.ts diff --git a/next/test/validation/boolean_type.test.ts b/test/validation/boolean_type.test.ts similarity index 100% rename from next/test/validation/boolean_type.test.ts rename to test/validation/boolean_type.test.ts diff --git a/next/test/validation/composition.test.ts b/test/validation/composition.test.ts similarity index 100% rename from next/test/validation/composition.test.ts rename to test/validation/composition.test.ts diff --git a/next/test/validation/const.test.ts b/test/validation/const.test.ts similarity index 100% rename from next/test/validation/const.test.ts rename to test/validation/const.test.ts diff --git a/next/test/validation/enum.test.ts b/test/validation/enum.test.ts similarity index 100% rename from next/test/validation/enum.test.ts rename to test/validation/enum.test.ts diff --git a/next/test/validation/file.test.ts b/test/validation/file.test.ts similarity index 100% rename from next/test/validation/file.test.ts rename to test/validation/file.test.ts diff --git a/next/test/validation/format.test.ts b/test/validation/format.test.ts similarity index 100% rename from next/test/validation/format.test.ts rename to test/validation/format.test.ts diff --git a/next/test/validation/json-logic-v0.test.js b/test/validation/json-logic-v0.test.js similarity index 100% rename from next/test/validation/json-logic-v0.test.js rename to test/validation/json-logic-v0.test.js diff --git a/next/test/validation/json-logic.fixtures.js b/test/validation/json-logic.fixtures.js similarity index 100% rename from next/test/validation/json-logic.fixtures.js rename to test/validation/json-logic.fixtures.js diff --git a/next/test/validation/json-logic.test.ts b/test/validation/json-logic.test.ts similarity index 100% rename from next/test/validation/json-logic.test.ts rename to test/validation/json-logic.test.ts diff --git a/next/test/validation/number.test.ts b/test/validation/number.test.ts similarity index 100% rename from next/test/validation/number.test.ts rename to test/validation/number.test.ts diff --git a/next/test/validation/object.test.ts b/test/validation/object.test.ts similarity index 100% rename from next/test/validation/object.test.ts rename to test/validation/object.test.ts diff --git a/next/test/validation/optional.test.ts b/test/validation/optional.test.ts similarity index 100% rename from next/test/validation/optional.test.ts rename to test/validation/optional.test.ts diff --git a/next/test/validation/required_field.test.ts b/test/validation/required_field.test.ts similarity index 100% rename from next/test/validation/required_field.test.ts rename to test/validation/required_field.test.ts diff --git a/next/test/validation/string.test.ts b/test/validation/string.test.ts similarity index 100% rename from next/test/validation/string.test.ts rename to test/validation/string.test.ts diff --git a/next/tsconfig.json b/tsconfig.json similarity index 100% rename from next/tsconfig.json rename to tsconfig.json diff --git a/next/tsup.config.js b/tsup.config.js similarity index 100% rename from next/tsup.config.js rename to tsup.config.js From 9949de9dfa3d0bfe158192cfa086d7cd2e2d9365 Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 15:50:43 +0100 Subject: [PATCH 2/8] fix: fix lint on yml --- .github/workflows/build-next.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-next.yml b/.github/workflows/build-next.yml index 710bb6ba6..810b34207 100644 --- a/.github/workflows/build-next.yml +++ b/.github/workflows/build-next.yml @@ -2,8 +2,8 @@ name: Pull Request (v-next) on: pull_request: paths-ignore: - - 'v0/**' # Skip if ONLY v0/ directory files change - - '.github/workflows/build.yml' # Skip if ONLY build.yml file changes + - v0/** # Skip if ONLY v0/ directory files change + - .github/workflows/build.yml # Skip if ONLY build.yml file changes jobs: @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version-file: '.nvmrc' + node-version-file: .nvmrc - name: Cache PNPM dependencies uses: actions/cache@v3 @@ -53,7 +53,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version-file: '.nvmrc' + node-version-file: .nvmrc - name: Get cached v0 dependencies uses: actions/cache@v3 From f666a592f85f5b9691c42908a16cfa887c49b3ad Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 15:53:44 +0100 Subject: [PATCH 3/8] fix: fix lint on yml --- .github/workflows/build-next.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-next.yml b/.github/workflows/build-next.yml index 810b34207..439c9f459 100644 --- a/.github/workflows/build-next.yml +++ b/.github/workflows/build-next.yml @@ -5,7 +5,6 @@ on: - v0/** # Skip if ONLY v0/ directory files change - .github/workflows/build.yml # Skip if ONLY build.yml file changes - jobs: dependencies: runs-on: ubuntu-latest From 011378f63f836c86bf31eca909bf4f768d1fc17f Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 15:54:39 +0100 Subject: [PATCH 4/8] chore: disable lint for markdown files --- eslint.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index 2b1ebb0b2..a8fb2dbf9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,6 +2,7 @@ import antfu from '@antfu/eslint-config' export default antfu({ ignores: ['test/v0-baseline-test-results.json', 'v0/**', 'scripts/**'], + modules: false, rules: { curly: ['error', 'all'], }, From f0ca43508aebab8713d6e5f8eee9b6e2b5e12d98 Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 17:17:41 +0100 Subject: [PATCH 5/8] fix: fix lint --- .github/workflows/build.yml | 10 +++++----- eslint.config.mjs | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 401694678..b847e8647 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,8 +2,8 @@ name: Pull Request (v0) on: pull_request: paths-ignore: - - 'next/**' # Skip if ONLY next/ directory files change - - '.github/workflows/build-next.yml' + - next/** # Skip if ONLY next/ directory files change + - .github/workflows/build-next.yml jobs: dependencies: @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version-file: 'v0/.nvmrc' + node-version-file: v0/.nvmrc - name: Cache NPM dependencies # From: https://dev.to/drakulavich/aggressive-dependency-caching-in-github-actions-3c64 uses: actions/cache@v3 @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version-file: 'v0/.nvmrc' + node-version-file: v0/.nvmrc - name: Get cached NPM dependencies uses: actions/cache@v3 @@ -49,7 +49,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version-file: 'v0/.nvmrc' + node-version-file: v0/.nvmrc - name: Get cached NPM dependencies uses: actions/cache@v3 diff --git a/eslint.config.mjs b/eslint.config.mjs index a8fb2dbf9..3a89902eb 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,6 +2,7 @@ import antfu from '@antfu/eslint-config' export default antfu({ ignores: ['test/v0-baseline-test-results.json', 'v0/**', 'scripts/**'], + markdown: false, modules: false, rules: { curly: ['error', 'all'], From 358338774d7a52a4a70af8bc44376047e139227d Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 17:19:08 +0100 Subject: [PATCH 6/8] fix: fix test --- test/form.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/form.test.ts b/test/form.test.ts index e5e3e4b2f..78f9dba1c 100644 --- a/test/form.test.ts +++ b/test/form.test.ts @@ -15,10 +15,10 @@ describe('createHeadlessForm', () => { }, } - it('should throw error when modifyConfig option is provided', () => { + it('should throw error when customProperties option is provided', () => { expect(() => { - createHeadlessForm(basicSchema, { modifyConfig: {} } as any) - }).toThrow('`modifyConfig` is a deprecated option and it\'s not supported on json-schema-form v1') + createHeadlessForm(basicSchema, { customProperties: {} } as any) + }).toThrow('`customProperties` is a deprecated option and it\'s not supported on json-schema-form v1') }) it('should not throw error when modifyConfig option is not provided', () => { From 430965136189849ab233d3ebab4d65de493c37fe Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 18:21:23 +0100 Subject: [PATCH 7/8] chore: remove v0 test from v1 action --- .github/workflows/build-next.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-next.yml b/.github/workflows/build-next.yml index 439c9f459..695e6d158 100644 --- a/.github/workflows/build-next.yml +++ b/.github/workflows/build-next.yml @@ -70,7 +70,4 @@ jobs: run: pnpm check - name: Tests - run: pnpm test - - - name: v0 Tests - run: cd v0 && npm run test + run: pnpm test \ No newline at end of file From 0f1fbe89de4c47d9bb311c412994df3c48f171df Mon Sep 17 00:00:00 2001 From: Capelo Date: Thu, 10 Jul 2025 18:28:30 +0100 Subject: [PATCH 8/8] fix: fix lint on yml --- .github/workflows/build-next.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-next.yml b/.github/workflows/build-next.yml index 695e6d158..604e021a8 100644 --- a/.github/workflows/build-next.yml +++ b/.github/workflows/build-next.yml @@ -70,4 +70,4 @@ jobs: run: pnpm check - name: Tests - run: pnpm test \ No newline at end of file + run: pnpm test