Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main

# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml
env:
# 7 GiB by default on GitHub, setting to 6 GiB
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: --max-old-space-size=6144

# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}

jobs:
typecheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- run: corepack enable
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Typecheck
run: pnpm typecheck
28 changes: 28 additions & 0 deletions .scripts/typecheck.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { basename } from 'node:path'
import { globby } from 'globby'
import { exec } from 'tinyexec'
import {consola} from 'consola'

const packages = await globby([
'shared/**/package.json',
'examples/**/package.json',
'!**/node_modules',
'!**/.nitro',
'!**/.vercel',
'!**/.output',
], { absolute: true })

for (const pkg of packages) {
const cwd = pkg.replace('/package.json', '')
const options = { nodeOptions: { cwd } }

await exec('nuxi', ['prepare'], options)
const res = await exec('tsc', ['--noEmit'], options)
const output = (res.stderr).trim()
if (output) {
consola.withTag(basename(cwd)).error(output)
process.exit(1)
} else {
consola.success('type checked', basename(cwd))
}
}
3 changes: 2 additions & 1 deletion examples/advanced/jsx/components/MyComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export default defineComponent({
props: {
message: String
},
render: (props) => {
// @ts-expect-error investigate why this is not typed
render(props) {
return (
<div>
{ props.message }
Expand Down
3 changes: 3 additions & 0 deletions examples/hello-world/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./.nuxt/tsconfig.json"
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
"version": "1.0.0",
"license": "MIT",
"scripts": {
"build": "turbo run build && node .scripts/build.mjs"
"build": "turbo run build && node .scripts/build.mjs",
"typecheck": "node .scripts/typecheck.mjs"
},
"devDependencies": {
"@nuxt/kit": "3.12.2",
"@types/node": "^20.11.30",
"consola": "^3.2.3",
"globby": "^14.0.1",
"pathe": "^1.1.2",
"pkg-types": "^1.0.3",
"turbo": "^2.1.2"
"tinyexec": "^0.3.0",
"turbo": "^2.1.2",
"typescript": "^5.6.2"
},
"resolutions": {
"@nuxt/kit": "3.12.2",
Expand Down
Loading