Skip to content

Commit

Permalink
chore: fix typecheck and run it in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Jun 13, 2024
1 parent b4cd264 commit f322ef4
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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
6 changes: 5 additions & 1 deletion discord-webhook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import fetch from 'node-fetch'
import { getPermanentRef, setupEnvironment, teardownEnvironment } from './utils'
import {
getPermanentRef,
setupEnvironment,
teardownEnvironment,
} 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 @@ -11,8 +11,8 @@ import {
bisectVue,
parseVueMajor,
parseMajorVersion,
} from './utils'
import { CommandOptions, RunOptions } from './types'
} from './utils.ts'
import { CommandOptions, RunOptions } from './types.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 @@ -11,6 +11,7 @@
"lint:fix": "pnpm lint --fix",
"format": "prettier --ignore-path .gitignore --check .",
"format:fix": "pnpm format --write",
"typecheck": "tsc",
"test:self": "tsx ecosystem-ci.ts _selftest",
"test": "tsx ecosystem-ci.ts",
"clean": "rimraf .verdaccio-cache/.local workspace && pnpm store prune",
Expand Down
2 changes: 0 additions & 2 deletions registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ export const REGISTRY_ADDRESS = `http://localhost:${LOCAL_REGISTRY_PORT}/`
export async function startRegistry() {
// It's not ideal to repeat this config option here,
// luckily, `self_path` would no longer be required in verdaccio 6
// @ts-expect-error import.meta
const cache = fileURLToPath(new URL('./.verdaccio-cache', import.meta.url))
const config = {
...parseConfigFile(
// @ts-expect-error import.meta
fileURLToPath(new URL('./verdaccio.yaml', import.meta.url)),
),
self_path: cache,
Expand Down
4 changes: 2 additions & 2 deletions tests/_selftest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'node:path'
import { runInRepo } from '../utils'
import { RunOptions } from '../types'
import { runInRepo } from '../utils.ts'
import { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/language-tools.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/naive-ui.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 { RunOptions } from '../types.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/pinia.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/primevue.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/quasar.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/radix-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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/router.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/test-utils.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vant.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 { RunOptions } from '../types.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 { RunOptions } from '../types.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vue-i18n.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vue-macros.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vue-simple-compiler.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vuetify.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 { RunOptions } from '../types.ts'

export async function test(options: RunOptions) {
await runInRepo({
Expand Down
4 changes: 2 additions & 2 deletions tests/vueuse.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 { RunOptions } from '../types.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
Expand Up @@ -4,7 +4,8 @@
"compilerOptions": {
"target": "esnext",
"module": "NodeNext",
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": true,
"strict": true,
"declaration": true,
"noImplicitOverride": true,
Expand All @@ -14,6 +15,8 @@
"allowSyntheticDefaultImports": true,
"lib": ["esnext"],
"sourceMap": true,
"typeRoots": ["./typings/node_modules/@types"]
"typeRoots": ["./typings/node_modules/@types"],
"noEmit": true,
"skipLibCheck": true
}
}
5 changes: 2 additions & 3 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
RepoOptions,
RunOptions,
Task,
} from './types'
import { REGISTRY_ADDRESS, startRegistry } from './registry'
} from './types.ts'
import { REGISTRY_ADDRESS, startRegistry } from './registry.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 @@ -87,7 +87,6 @@ let app: any
export async function setupEnvironment(): Promise<EnvironmentData> {
app = await startRegistry()

// @ts-expect-error import.meta
const root = dirnameFrom(import.meta.url)
const workspace = path.resolve(root, 'workspace')
vuePath = path.resolve(workspace, 'core')
Expand Down

0 comments on commit f322ef4

Please sign in to comment.