Skip to content

Commit

Permalink
chore: use type PackageJson from type-fest
Browse files Browse the repository at this point in the history
  • Loading branch information
shulaoda committed Aug 20, 2024
1 parent 4e20196 commit 0ed5213
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"prebundle": "1.1.0",
"rslib": "npm:@rslib/[email protected]",
"rslog": "^1.2.2",
"type-fest": "^4.24.0",
"typescript": "^5.5.4"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
mergeRsbuildConfig,
} from '@rsbuild/core';
import glob from 'fast-glob';
import type { PackageJson } from 'type-fest';
import { DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS } from './constant';
import type {
AutoExternal,
Format,
LibConfig,
PkgJson,
RslibConfig,
RslibConfigAsyncFn,
RslibConfigExport,
Expand Down Expand Up @@ -89,7 +89,7 @@ export async function loadConfig({

export const composeAutoExternalConfig = (options: {
autoExternal: AutoExternal;
pkgJson?: PkgJson;
pkgJson?: PackageJson;
userExternals?: NonNullable<RsbuildConfig['output']>['externals'];
}): RsbuildConfig => {
const { autoExternal, pkgJson, userExternals } = options;
Expand Down Expand Up @@ -242,7 +242,7 @@ const composeFormatConfig = (format: Format): RsbuildConfig => {
const composeAutoExtensionConfig = (
config: LibConfig,
autoExtension: boolean,
pkgJson?: PkgJson,
pkgJson?: PackageJson,
): {
config: RsbuildConfig;
jsExtension: string;
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export type * from './config';
export type * from './utils';
6 changes: 0 additions & 6 deletions packages/core/src/types/utils.ts

This file was deleted.

5 changes: 3 additions & 2 deletions packages/core/src/utils/extension.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { Format, PkgJson } from '../types';
import type { PackageJson } from 'type-fest';
import type { Format } from '../types';
import { logger } from './logger';

export const getDefaultExtension = (options: {
format: Format;
pkgJson?: PkgJson;
pkgJson?: PackageJson;
autoExtension: boolean;
}): {
jsExtension: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs';
import fsP from 'node:fs/promises';
import path from 'node:path';
import color from 'picocolors';
import type { PkgJson } from '../types';
import type { PackageJson } from 'type-fest';
import { logger } from './logger';

/**
Expand Down Expand Up @@ -107,7 +107,7 @@ export async function calcLongestCommonPath(
return lca;
}

export const readPackageJson = (rootPath: string): undefined | PkgJson => {
export const readPackageJson = (rootPath: string): undefined | PackageJson => {
const pkgJsonPath = path.join(rootPath, './package.json');

if (!fs.existsSync(pkgJsonPath)) {
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0ed5213

Please sign in to comment.