From cf41257b5a0425b6c734353e804799c26aaad9a0 Mon Sep 17 00:00:00 2001 From: Sukka Date: Wed, 18 Sep 2024 22:07:01 +0800 Subject: [PATCH] refactor: replace `type-fest` w/ `@package-json/types` (#101) --- create.ts | 2 +- package.json | 2 +- packages/manual/assert/rollup.config.ts | 2 +- packages/manual/es-iterator-helpers/rollup.config.ts | 2 +- packages/tools/cli/rollup.config.ts | 2 +- packages/tools/cli/src/types.ts | 2 +- pnpm-lock.yaml | 11 ++++++++--- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/create.ts b/create.ts index 28658de1..bb6842e8 100644 --- a/create.ts +++ b/create.ts @@ -10,7 +10,7 @@ import { fileExists, compareAndWriteFile } from '@nolyfill/internal'; import { transform } from '@swc/core'; import type { Options as SwcOptions } from '@swc/core'; -import type { PackageJson } from 'type-fest'; +import type { PackageJson } from '@package-json/types'; /** * The package.json inside the project has a non-nullable "version" field, diff --git a/package.json b/package.json index bd01cf9a..cf3c73f1 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@eslint-sukka/ts": "^5.1.2", "@jsdevtools/ez-spawn": "^3.0.4", "@nolyfill/internal": "workspace:*", + "@package-json/types": "^0.0.6", "@swc-node/register": "^1.10.9", "@swc/core": "^1.7.0", "@types/node": "^20.14.11", @@ -31,7 +32,6 @@ "rollup-plugin-dts": "^6.1.1", "rollup-plugin-swc3": "^0.11.2", "turbo": "^2.0.9", - "type-fest": "^4.22.1", "typescript": "^5.5.3" }, "packageManager": "pnpm@9.5.0", diff --git a/packages/manual/assert/rollup.config.ts b/packages/manual/assert/rollup.config.ts index 9adb597b..c18d3525 100644 --- a/packages/manual/assert/rollup.config.ts +++ b/packages/manual/assert/rollup.config.ts @@ -1,4 +1,4 @@ -import type { PackageJson } from 'type-fest'; +import type { PackageJson } from '@package-json/types'; import resolve from 'resolve-pkg'; import fs from 'fs'; diff --git a/packages/manual/es-iterator-helpers/rollup.config.ts b/packages/manual/es-iterator-helpers/rollup.config.ts index 21919980..ac03be5b 100644 --- a/packages/manual/es-iterator-helpers/rollup.config.ts +++ b/packages/manual/es-iterator-helpers/rollup.config.ts @@ -1,4 +1,4 @@ -import type { PackageJson } from 'type-fest'; +import type { PackageJson } from '@package-json/types'; import resolve from 'resolve-pkg'; import fs from 'fs'; diff --git a/packages/tools/cli/rollup.config.ts b/packages/tools/cli/rollup.config.ts index 3cb10208..8d20b5c9 100644 --- a/packages/tools/cli/rollup.config.ts +++ b/packages/tools/cli/rollup.config.ts @@ -10,7 +10,7 @@ import fs from 'fs'; import { builtinModules } from 'module'; import { MagicString } from '@napi-rs/magic-string'; -import type { PackageJson } from 'type-fest'; +import type { PackageJson } from '@package-json/types'; const builtinModulesSet = new Set(builtinModules); diff --git a/packages/tools/cli/src/types.ts b/packages/tools/cli/src/types.ts index 9f79c23a..c08f23e2 100644 --- a/packages/tools/cli/src/types.ts +++ b/packages/tools/cli/src/types.ts @@ -1,4 +1,4 @@ -import type { PackageJson } from 'type-fest'; +import type { PackageJson } from '@package-json/types'; export interface PackageNode { name: string, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4ff2ef67..bf84601d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -148,6 +148,9 @@ importers: '@nolyfill/internal': specifier: workspace:* version: link:packages/tools/internal + '@package-json/types': + specifier: ^0.0.6 + version: 0.0.6 '@swc-node/register': specifier: ^1.10.9 version: 1.10.9(@swc/core@1.7.0(@swc/helpers@0.5.12))(@swc/types@0.1.12)(typescript@5.5.3) @@ -193,9 +196,6 @@ importers: turbo: specifier: ^2.0.9 version: 2.0.9 - type-fest: - specifier: ^4.22.1 - version: 4.22.1 typescript: specifier: ^5.5.3 version: 5.5.3 @@ -1248,6 +1248,9 @@ packages: cpu: [x64] os: [win32] + '@package-json/types@0.0.6': + resolution: {integrity: sha512-UBVVLQfUXvzGrgKt7TqLupdzsslRSqgel/01UTc/2yUOdqFM5ZNLCNzz/ev51SRpNrlYKtqAY8nL6FdMWBWw1A==} + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -4643,6 +4646,8 @@ snapshots: '@oxc-resolver/binding-win32-x64-msvc@1.10.2': optional: true + '@package-json/types@0.0.6': {} + '@pkgjs/parseargs@0.11.0': optional: true