diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000..a609515 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", + "changelog": [ + "@svitejs/changesets-changelog-github-compact", + { "repo": "crutchcorn/sync-skeleton" } + ], + "commit": false, + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "fixed": [], + "linked": [], + "ignore": [] +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9d08a1a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5a0d5e4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto eol=lf diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..9ba4e07 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [crutchcorn] diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..3f6e9d4 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,35 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "configMigration": true, + "extends": [ + "config:recommended", + "group:allNonMajor", + "schedule:weekly", + ":approveMajorUpdates", + ":automergeMinor", + ":disablePeerDependencies", + ":maintainLockFilesMonthly", + ":semanticCommits", + ":semanticCommitTypeAll(chore)" + ], + "ignorePresets": [":ignoreModulesAndTests"], + "labels": ["dependencies"], + "rangeStrategy": "bump", + "postUpdateOptions": ["pnpmDedupe"], + "ignoreDeps": [ + "@types/node", + "@types/react", + "@types/react-dom", + "node", + "react", + "react-dom", + "typescript", + "typescript49", + "typescript50", + "typescript51", + "typescript52", + "typescript53", + "vue", + "vue-tsc" + ] +} diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 0000000..f800261 --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,40 @@ +name: autofix.ci # needed to securely identify the workflow + +on: + pull_request: + push: + branches: [main, alpha, beta] + workflow_dispatch: + inputs: + generate-docs: + description: 'Generate docs' + required: false + default: false + type: boolean + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + autofix: + if: ${{ !contains(github.event.head_commit.message, 'apply automated fixes') }} + name: autofix + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.3.0 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Fix formatting + run: pnpm prettier:write + - name: Generate Docs + if: ${{ github.event_name == 'push' || github.event.inputs.generate-docs == true }} + run: pnpm docs:generate + - name: Apply fixes + uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 + with: + commit-message: 'ci: apply automated fixes and generate docs' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0cfe49e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: ci + +on: + workflow_dispatch: + inputs: + tag: + description: override release tag + required: false + push: + branches: [main, alpha, beta] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: write + id-token: write + +jobs: + test-and-publish: + name: Test & Publish + if: github.repository == 'crutchcorn/sync-skeleton' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Run Tests + run: pnpm run test:ci --parallel=3 + - name: Publish + run: | + git config --global user.name 'Tanner Linsley' + git config --global user.email 'tannerlinsley@users.noreply.github.com' + npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" + pnpm run cipublish + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + TAG: ${{ inputs.tag }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + directory: packages + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..5d83b70 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,53 @@ +name: pr + +on: + pull_request: + paths-ignore: + - 'docs/**' + - 'media/**' + - '**/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Get base and head commits for `nx affected` + uses: nrwl/nx-set-shas@v4 + with: + main-branch-name: main + - name: Run Checks + run: pnpm run test:pr --parallel=3 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + directory: packages + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + preview: + name: Preview + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Build Packages + run: pnpm run build:all + - name: Publish Previews + run: pnpx pkg-pr-new publish --pnpm --compact './packages/*' --template './examples/*/*' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8d34fd3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + push: + branches: [main, alpha, beta, rc] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: write + id-token: write + pull-requests: write + +jobs: + release: + name: Release + if: github.repository_owner == 'TanStack' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Run Tests + run: pnpm run test:ci + - name: Run Changesets (version or publish) + uses: changesets/action@v1.4.9 + with: + version: pnpm run changeset:version + publish: pnpm run changeset:publish + commit: 'ci: Version Packages' + title: 'ci: Version Packages' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index a547bf3..22096f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,44 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies node_modules +package-lock.json +yarn.lock + +# builds +build +coverage dist -dist-ssr -*.local -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea +# misc .DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? +.env +.env.local +.env.development.local +.env.test.local +.env.production.local +.next + +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.history +size-plugin.json +stats-hydration.json +stats.json +stats.html +.vscode/settings.json + +*.log +.cache +.idea +.nx/cache +.nx/workspace-data +.pnpm-store +.tsup +.svelte-kit + +vite.config.js.timestamp-* +vite.config.ts.timestamp-* +tsconfig.vitest-temp.json diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..84aee8d --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +link-workspace-packages=true +prefer-workspace-packages=true +provenance=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..9d11232 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +24.4.1 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..d26fe21 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +**/.next +**/.nx/cache +**/.svelte-kit +**/build +**/coverage +**/dist +**/docs/**/reference/** +**/codemods/**/__testfixtures__ +pnpm-lock.yaml diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..e3b414c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "semi": false, + "singleQuote": true, + "trailingComma": "all" +} diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..1869e21 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-present Tanner Linsley + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 7959ce4..5ddddda 100644 --- a/README.md +++ b/README.md @@ -1,69 +1 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: - -```js -export default tseslint.config([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - - // Remove tseslint.configs.recommended and replace with this - ...tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - ...tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - ...tseslint.configs.stylisticTypeChecked, - - // Other configs... - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` - -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: - -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default tseslint.config([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - // Enable lint rules for React - reactX.configs['recommended-typescript'], - // Enable lint rules for React DOM - reactDom.configs.recommended, - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` + \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100755 index 0000000..7700cbe --- /dev/null +++ b/codecov.yml @@ -0,0 +1,11 @@ +codecov: + max_report_age: off +coverage: + status: + project: + default: + target: auto + threshold: 1% +ignore: + - 'packages/form-devtools' + - 'packages/react-form-devtools' diff --git a/eslint.config.js b/eslint.config.js index d94e7de..4abda41 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,23 +1,21 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { globalIgnores } from 'eslint/config' +// @ts-check -export default tseslint.config([ - globalIgnores(['dist']), +// @ts-ignore Needed due to moduleResolution Node vs Bundler +import { tanstackConfig } from '@tanstack/config/eslint' + +export default [ + ...tanstackConfig, { - files: ['**/*.{ts,tsx}'], - extends: [ - js.configs.recommended, - tseslint.configs.recommended, - reactHooks.configs['recommended-latest'], - reactRefresh.configs.vite, - ], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, + name: 'tanstack/temp', + rules: { + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/method-signature-style': 'off', + '@typescript-eslint/naming-convention': 'off', + '@typescript-eslint/no-unnecessary-type-assertion': 'off', + '@typescript-eslint/no-unsafe-function-type': 'off', + '@typescript-eslint/require-await': 'off', + 'no-async-promise-executor': 'off', + 'no-empty': 'off', }, }, -]) +] diff --git a/examples/react/simple/.eslintrc.cjs b/examples/react/simple/.eslintrc.cjs new file mode 100644 index 0000000..35853b6 --- /dev/null +++ b/examples/react/simple/.eslintrc.cjs @@ -0,0 +1,11 @@ +// @ts-check + +/** @type {import('eslint').Linter.Config} */ +const config = { + extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'], + rules: { + 'react/no-children-prop': 'off', + }, +} + +module.exports = config diff --git a/examples/react/simple/.gitignore b/examples/react/simple/.gitignore new file mode 100644 index 0000000..4673b02 --- /dev/null +++ b/examples/react/simple/.gitignore @@ -0,0 +1,27 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +pnpm-lock.yaml +yarn.lock +package-lock.json + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/examples/react/simple/README.md b/examples/react/simple/README.md new file mode 100644 index 0000000..1cf8892 --- /dev/null +++ b/examples/react/simple/README.md @@ -0,0 +1,6 @@ +# Example + +To run this example: + +- `npm install` +- `npm run dev` diff --git a/examples/react/simple/index.html b/examples/react/simple/index.html new file mode 100644 index 0000000..74d1be4 --- /dev/null +++ b/examples/react/simple/index.html @@ -0,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