Skip to content

Commit

Permalink
chore: Add type checking to integrations (TanStack#6607)
Browse files Browse the repository at this point in the history
* Add TS to vue-vite integration

* Explicitly exclude examples

* Merge test:bundle into build

* Update gitignore

* Update codesandbox build step

* Wow npm is annoying
  • Loading branch information
lachlancollins authored Dec 28, 2023
1 parent 9f2c148 commit ddf5539
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"installCommand": "install:csb",
"buildCommand": "build:all",
"buildCommand": "build:all -- --exclude=integrations/**",
"sandboxes": [
"/examples/angular/basic",
"/examples/react/basic-typescript",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Start CI Orchestrator
run: npx nx-cloud start-ci-run
- name: Run Tests
run: npx nx affected --targets=test:eslint,test:lib,test:types,test:build,test:bundle
run: pnpm run test:pr
- name: Stop Agents
if: ${{ always() }}
run: npx nx-cloud stop-all-agents
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pnpm-lock.yaml
# builds
types
*/**/.svelte-kit
*/**/.tsup
*/**/build
*/**/dist
*/**/lib
Expand Down
2 changes: 1 addition & 1 deletion integrations/angular-cli-standalone-17/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "angular-cli-standalone-17",
"version": "0.0.0",
"scripts": {
"test:bundle": "ng build"
"build": "ng build"
},
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/react-cra4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-cra4",
"private": true,
"scripts": {
"test:bundle": "cross-env DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true NODE_OPTIONS=--openssl-legacy-provider react-scripts build"
"build": "cross-env DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true NODE_OPTIONS=--openssl-legacy-provider react-scripts build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion integrations/react-cra5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-cra5",
"private": true,
"scripts": {
"test:bundle": "cross-env DISABLE_ESLINT_PLUGIN=true react-scripts build"
"build": "cross-env DISABLE_ESLINT_PLUGIN=true react-scripts build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion integrations/react-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-next",
"private": true,
"scripts": {
"test:bundle": "next build"
"build": "next build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion integrations/react-vite4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"scripts": {
"test:bundle": "vite build"
"build": "vite build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion integrations/react-vite5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"scripts": {
"test:bundle": "vite build"
"build": "vite build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion integrations/solid-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"scripts": {
"test:bundle": "vite build"
"build": "vite build"
},
"dependencies": {
"@tanstack/solid-query": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion integrations/svelte-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"scripts": {
"test:bundle": "vite build"
"build": "vite build"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
Expand Down
4 changes: 2 additions & 2 deletions integrations/vue-vite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Vite + Vue</title>
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
9 changes: 7 additions & 2 deletions integrations/vue-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
"private": true,
"type": "module",
"scripts": {
"test:bundle": "vite build"
"test:types": "vue-tsc",
"build": "vite build"
},
"dependencies": {
"@tanstack/vue-query": "workspace:*",
"vue": "^3.3.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.5.2",
"typescript": "5.2.2",
"vite": "^5.0.10",
"vue": "^3.3.0"
"vue-tsc": "^1.8.26"
}
}
2 changes: 1 addition & 1 deletion integrations/vue-vite/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
import { useQuery } from '@tanstack/vue-query'
const { isPending, isError, data } = useQuery({
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions integrations/vue-vite/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
25 changes: 25 additions & 0 deletions integrations/vue-vite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions integrations/vue-vite/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
File renamed without changes.
5 changes: 0 additions & 5 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
"inputs": ["default", "^public"],
"cache": true
},
"test:bundle": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"],
"cache": true
},
"build": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"],
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
"install:csb": "corepack enable && pnpm install --frozen-lockfile",
"test": "pnpm run test:ci",
"test:ci": "nx run-many --exclude=examples/** --targets=test:format,test:sherif,test:eslint,test:lib,test:types,test:build,test:bundle,build",
"test:eslint": "nx affected --target=test:eslint",
"test:pr": "nx affected --targets=test:eslint,test:lib,test:types,test:build,build --exclude=examples/**",
"test:ci": "nx run-many --targets=test:format,test:sherif,test:eslint,test:lib,test:types,test:build,build --exclude=examples/**",
"test:eslint": "nx affected --target=test:eslint --exclude=examples/**",
"test:format": "pnpm run prettier --check",
"test:sherif": "sherif -i react-scripts -i typescript --ignore-package react-vite5 --ignore-package react-vite4",
"test:lib": "nx affected --target=test:lib",
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:build": "nx affected --target=test:build",
"test:types": "nx affected --target=test:types",
"test:bundle": "nx affected --target=test:bundle",
"build": "nx affected --target=build",
"build:all": "nx run-many --exclude=examples/** --target=build",
"test:lib": "nx affected --target=test:lib --exclude=examples/**",
"test:lib:dev": "pnpm run test:lib && nx watch --all -- pnpm run test:lib",
"test:build": "nx affected --target=test:build --exclude=examples/**",
"test:types": "nx affected --target=test:types --exclude=examples/**",
"build": "nx affected --target=build --exclude=examples/**",
"build:all": "nx run-many --target=build --exclude=examples/**",
"watch": "pnpm run build:all && nx watch --all -- pnpm run build:all",
"dev": "pnpm run watch",
"prettier": "prettier --ignore-unknown '**/*'",
Expand Down
14 changes: 11 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ddf5539

Please sign in to comment.