Skip to content

Commit

Permalink
chore: use knip to ensure repository is 💯
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jan 6, 2025
1 parent 2c1e14e commit ee63f74
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 53 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- run: pnpm lint
- run: pnpm test:types
- run: pnpm build
- run: pnpm knip
- run: pnpm test:dist
- run: pnpm test:unit
- if: matrix.os != 'windows-latest'
Expand Down
16 changes: 16 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"workspaces": {
".": {
"ignoreDependencies": [
"pkg-pr-new"
]
},
"playground": {
"ignoreDependencies": [
"nuxi",
"nuxt"
]
}
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"knip": "^5.41.1",
"listhen": "^1.9.0",
"magicast": "^0.3.5",
"mlly": "^1.7.3",
"nitropack": "npm:nitropack-nightly",
"nypm": "^0.4.1",
"ofetch": "^1.4.1",
Expand Down
17 changes: 8 additions & 9 deletions src/commands/module/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const categories = [
'UI',
]

export interface NuxtApiModulesResponse {
interface NuxtApiModulesResponse {
version: string
generatedAt: string
stats: Stats
Expand All @@ -33,43 +33,42 @@ export interface NuxtApiModulesResponse {
modules: NuxtModule[]
}

export interface Contributor {
interface Contributor {
id: number
username: string
contributions: number
modules: string[]
}

export interface Stats {
interface Stats {
downloads: number
stars: number
maintainers: number
contributors: number
modules: number
}

export interface ModuleCompatibility {
interface ModuleCompatibility {
nuxt: string
requires: { bridge?: boolean | 'optional' }
versionMap: {
[nuxtVersion: string]: string
}
}

export interface MaintainerInfo {
interface MaintainerInfo {
name: string
github: string
twitter?: string
}

export interface GithubContributor {
interface GitHubContributor {
username: string
name?: string
avatar_url?: string
}

export type CompatibilityStatus = 'working' | 'wip' | 'unknown' | 'not-working'
export type ModuleType = 'community' | 'official' | '3rd-party'
type ModuleType = 'community' | 'official' | '3rd-party'

export interface NuxtModule {
name: string
Expand All @@ -83,7 +82,7 @@ export interface NuxtModule {
category: (typeof categories)[number]
type: ModuleType
maintainers: MaintainerInfo[]
contributors?: GithubContributor[]
contributors?: GitHubContributor[]
compatibility: ModuleCompatibility
aliases?: string[]
stats: Stats
Expand Down
2 changes: 1 addition & 1 deletion src/commands/module/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from './_utils'
import type { NuxtModule } from './_utils'

export type RegistryMeta = {
type RegistryMeta = {
registry: string
authToken: string | null
}
Expand Down
3 changes: 0 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { commands } from './commands'
import { setupGlobalConsole } from './utils/console'
import { checkEngines } from './utils/engines'

// import { checkForUpdates } from './utils/update'

export const main = defineCommand({
meta: {
name: nuxiPkg.name,
Expand All @@ -24,7 +22,6 @@ export const main = defineCommand({
if (command !== '_dev' && provider !== 'stackblitz') {
backgroundTasks = Promise.all([
checkEngines(),
// checkForUpdates(),
]).catch(err => console.error(err))
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface NuxtDevContext {
}
}

export interface NuxtDevServerOptions {
interface NuxtDevServerOptions {
cwd: string
logLevel: 'silent' | 'info' | 'verbose'
dotenv: boolean
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from 'pathe'
import { consola } from 'consola'

// Check if a file exists
export async function exists(path: string) {
async function exists(path: string) {
try {
await fsp.access(path)
return true
Expand Down
4 changes: 2 additions & 2 deletions src/utils/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { hash } from 'ohash'
import type { Nuxt } from '@nuxt/schema'
import { rmRecursive } from './fs'

export interface NuxtProjectManifest {
interface NuxtProjectManifest {
_hash: string | null
project: {
rootDir: string
Expand Down Expand Up @@ -39,7 +39,7 @@ export function nuxtVersionToGitIdentifier(version: string) {
return `v${version}`
}

export function resolveNuxtManifest(nuxt: Nuxt): NuxtProjectManifest {
function resolveNuxtManifest(nuxt: Nuxt): NuxtProjectManifest {
const manifest: NuxtProjectManifest = {
_hash: null,
project: {
Expand Down
35 changes: 0 additions & 35 deletions src/utils/update.ts

This file was deleted.

7 changes: 7 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
coverage: {},
},
})

0 comments on commit ee63f74

Please sign in to comment.