Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix typecheck and run it in CI #261

Merged
merged 1 commit into from
Nov 3, 2023
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
run: pnpm format
- name: lint
run: pnpm run lint
- name: typecheck
run: pnpm run typecheck
- name: audit
if: (${{ success() }} || ${{ failure() }})
run: pnpm audit
Expand Down
4 changes: 2 additions & 2 deletions builds/vite-plugin-react.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function build(options: RunOptions) {
return runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions builds/vite-plugin-svelte.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function build(options: RunOptions) {
if (options.viteMajor < 4) {
Expand Down
4 changes: 2 additions & 2 deletions builds/vite-plugin-vue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function build(options: RunOptions) {
return runInRepo({
Expand Down
2 changes: 1 addition & 1 deletion discord-webhook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetch from 'node-fetch'
import { getPermanentRef, setupEnvironment } from './utils'
import { getPermanentRef, setupEnvironment } from './utils.ts'

type RefType = 'branch' | 'tag' | 'commit' | 'release'
type Status = 'success' | 'failure' | 'cancelled'
Expand Down
4 changes: 2 additions & 2 deletions ecosystem-ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
bisectVite,
parseViteMajor,
parseMajorVersion,
} from './utils'
import { CommandOptions, RunOptions } from './types'
} from './utils.ts'
import type { CommandOptions, RunOptions } from './types.d.ts'

const cli = cac()
cli
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"prepare": "pnpm exec simple-git-hooks",
"lint": "eslint --ignore-path .gitignore '**/*.ts'",
"lint:fix": "pnpm lint --fix",
"typecheck": "tsc",
"format": "prettier --ignore-path .gitignore --check .",
"format:fix": "pnpm format --write",
"test:self": "tsx ecosystem-ci.ts _selftest",
Expand Down
4 changes: 2 additions & 2 deletions tests/_hydrogen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/_iles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo, $ } from '../utils'
import { RunOptions } from '../types'
import { runInRepo, $ } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/_selftest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import fs from 'fs'
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/_storybook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/analogjs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/astro.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/histoire.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/ladle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/laravel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
//see https://github.com/laravel/vite-plugin/blob/73466441b0c9eb0c1a5ce0a0e937bd83eaef4b70/.github/workflows/tests.yml#L10
Expand Down
4 changes: 2 additions & 2 deletions tests/marko.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/nuxt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/nx.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/previewjs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RunOptions } from '../types'
import { runInRepo } from '../utils'
import type { RunOptions } from '../types.d.ts'
import { runInRepo } from '../utils.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/qwik.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/rakkas.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/sveltekit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/unocss.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vike.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-plugin-laravel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-plugin-pwa.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-plugin-react-pages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-plugin-react-swc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-plugin-react.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-plugin-svelte.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-plugin-vue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vite-setup-catalogue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vitepress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vitest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"include": ["./**/*.ts"],
"exclude": ["**/node_modules/**"],
"exclude": ["**/node_modules/**", "./workspace/**"],
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"moduleResolution": "node",
"moduleResolution": "nodenext",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsconfig.json:7:23 - error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'.

7   "moduleResolution": "node",
                        ~~~~~~

This error was happening. Therefore I changed to nodenext and also added "allowImportingTsExtensions": true and "noEmit": true.

"allowImportingTsExtensions": true,
"noEmit": true,
"skipLibCheck": true,
"strict": true,
"declaration": true,
"noImplicitOverride": true,
Expand Down
5 changes: 2 additions & 3 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import path from 'path'
import fs from 'fs'
import { fileURLToPath, pathToFileURL } from 'url'
import { execaCommand } from 'execa'
import {
import type {
PackageInfo,
EnvironmentData,
Overrides,
ProcessEnv,
RepoOptions,
RunOptions,
Task,
} from './types'
} from './types.d.ts'
//eslint-disable-next-line n/no-unpublished-import
import { detect, AGENTS, Agent, getCommand } from '@antfu/ni'
import actionsCore from '@actions/core'
Expand Down Expand Up @@ -58,7 +58,6 @@ export async function $(literals: TemplateStringsArray, ...values: any[]) {
}

export async function setupEnvironment(): Promise<EnvironmentData> {
// @ts-expect-error import.meta
const root = dirnameFrom(import.meta.url)
const workspace = path.resolve(root, 'workspace')
vitePath = path.resolve(workspace, 'vite')
Expand Down