Skip to content

Commit

Permalink
Add typecheck command (#951)
Browse files Browse the repository at this point in the history
* Add `typecheck` command

* Add one more missing typecheck command
  • Loading branch information
alvarlagerlof authored May 10, 2024
1 parent 4542777 commit e09465a
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .changeset/empty-sheep-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@rsc-parser/chrome-extension": patch
"@rsc-parser/storybook": patch
"@rsc-parser/embedded": patch
"@rsc-parser/website": patch
"@rsc-parser/core": patch
"@rsc-parser/embedded-example": patch
---

Add typecheck command
1 change: 1 addition & 0 deletions examples/embedded-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build": "next build",
"start": "next start",
"lint": "eslint",
"typecheck": "tsc --noEmit",
"clean": "rm -rf .next"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/chrome-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"scripts": {
"lint": "eslint",
"format": "prettier . --check --config ../../.prettierrc",
"typecheck": "tsc --noEmit",
"dev": "vite build --mode development && vite dev",
"build": "vite build && sed -i'.backup' 's| http://localhost:6020||g' dist/manifest.json && rm dist/manifest.json.backup",
"clean": "rm -rf dist"
Expand Down
4 changes: 4 additions & 0 deletions packages/chrome-extension/src/react-preamble.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// @ts-expect-error Vite special sauce
import RefreshRuntime from "http://localhost:6020/@react-refresh";
RefreshRuntime.injectIntoGlobalHook(window);
// @ts-expect-error Vite special sauce
window.$RefreshReg$ = () => {};
// @ts-expect-error Vite special sauce
window.$RefreshSig$ = () => (type) => type;
// @ts-expect-error Vite special sauce
window.__vite_plugin_react_preamble_installed__ = true;
2 changes: 1 addition & 1 deletion packages/chrome-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"types": ["chrome-types"]
},
"include": ["**/*.ts", "**/*.tsx", "jest.config.js"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "vite.config.ts.timestamp*"]
}
2 changes: 2 additions & 0 deletions packages/chrome-extension/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const build = {
export default defineConfig(({ mode }) => {
if (mode === "development") {
return {
// @ts-expect-error TODO: Fix type
plugins: [react(), htmlPlugin(dev)],
base: "",
build: {
Expand Down Expand Up @@ -60,6 +61,7 @@ export default defineConfig(({ mode }) => {
}

return {
// @ts-expect-error TODO: Fix type
plugins: [react(), htmlPlugin(build)],
base: "",
build: {
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"test:dev": "yarn test --watch",
"lint": "eslint",
"format": "prettier . --check --config ../../.prettierrc",
"typecheck": "tsc --noEmit",
"clean": "rm -rf dist"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"jsx": "preserve",
"incremental": true
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "vite.config.ts.timestamp*"]
}
2 changes: 2 additions & 0 deletions packages/embedded/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "vite build",
"dev": "vite build --watch",
"lint": "eslint",
"typecheck": "tsc --noEmit",
"clean": "rm -rf dist"
},
"types": "./dist/js/RscDevtoolsPanel.d.ts",
Expand All @@ -33,6 +34,7 @@
"react": "18.3.1",
"react-dom": "18.3.1",
"rollup-plugin-preserve-directives": "0.4.0",
"typescript": "5.4.5",
"vite": "5.2.11",
"vite-plugin-dts": "3.9.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/embedded/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"jsx": "preserve",
"incremental": true
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "vite.config.ts.timestamp*"]
}
4 changes: 3 additions & 1 deletion packages/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"type": "module",
"scripts": {
"dev": "storybook dev -p 6006 --no-open",
"typecheck": "tsc --noEmit",
"build": "storybook build",
"clean": "rm -rf storybook-static"
},
Expand All @@ -27,6 +28,7 @@
"@rsc-parser/core": "workspace:^",
"storybook": "8.0.10",
"storybook-dark-mode": "4.0.1",
"turbo": "1.13.3"
"turbo": "1.13.3",
"typescript": "5.4.5"
}
}
20 changes: 20 additions & 0 deletions packages/storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"strict": true,
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": [".storybook/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 2 additions & 0 deletions packages/storybook/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"extends": ["//"],
"pipeline": {
"build": {
"cache": false,
"inputs": ["storybook-static/**"],
"outputs": ["storybook-static/**"]
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"start": "next start",
"lint": "eslint",
"format": "prettier . --check --config ../../.prettierrc",
"typecheck": "tsc --noEmit",
"clean": "rm -rf .next"
},
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
"lint": {},
"test": {},
"format": {},
"typecheck": {
"dependsOn": ["^build"]
},
"ci": {
"dependsOn": ["build", "lint", "test", "format"]
"dependsOn": ["build", "typecheck", "lint", "test", "format"]
},
"dev": {}
}
Expand Down
2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3655,6 +3655,7 @@ __metadata:
react: "npm:18.3.1"
react-dom: "npm:18.3.1"
rollup-plugin-preserve-directives: "npm:0.4.0"
typescript: "npm:5.4.5"
vite: "npm:5.2.11"
vite-plugin-dts: "npm:3.9.1"
peerDependencies:
Expand Down Expand Up @@ -3682,6 +3683,7 @@ __metadata:
storybook: "npm:8.0.10"
storybook-dark-mode: "npm:4.0.1"
turbo: "npm:1.13.3"
typescript: "npm:5.4.5"
languageName: unknown
linkType: soft

Expand Down

0 comments on commit e09465a

Please sign in to comment.