mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
fix(cli): fix misuse of configPath as readNapiConfig first argument (#2900)
Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
parent
df80a8447a
commit
c034e1e4f0
@ -1,4 +1,4 @@
|
||||
import { join, parse } from 'node:path'
|
||||
import { join, resolve, parse } from 'node:path'
|
||||
|
||||
import * as colors from 'colorette'
|
||||
|
||||
@ -20,9 +20,12 @@ const debug = debugFactory('artifacts')
|
||||
export async function collectArtifacts(userOptions: ArtifactsOptions) {
|
||||
const options = applyDefaultArtifactsOptions(userOptions)
|
||||
|
||||
const packageJsonPath = join(options.cwd, options.packageJsonPath)
|
||||
const { targets, binaryName, packageName } =
|
||||
await readNapiConfig(packageJsonPath)
|
||||
const resolvePath = (...paths: string[]) => resolve(options.cwd, ...paths)
|
||||
const packageJsonPath = resolvePath(options.packageJsonPath)
|
||||
const { targets, binaryName, packageName } = await readNapiConfig(
|
||||
packageJsonPath,
|
||||
options.configPath ? resolvePath(options.configPath) : undefined,
|
||||
)
|
||||
|
||||
const distDirs = targets.map((platform) =>
|
||||
join(options.cwd, options.npmDir, platform.platformArchABI),
|
||||
|
||||
@ -82,9 +82,7 @@ export async function buildProject(rawOptions: BuildOptions) {
|
||||
)
|
||||
}
|
||||
const config = await readNapiConfig(
|
||||
resolvePath(
|
||||
options.configPath ?? options.packageJsonPath ?? 'package.json',
|
||||
),
|
||||
resolvePath(options.packageJsonPath ?? 'package.json'),
|
||||
options.configPath ? resolvePath(options.configPath) : undefined,
|
||||
)
|
||||
|
||||
|
||||
@ -11,9 +11,7 @@ interface MinimalNapiOptions {
|
||||
export async function readConfig(options: MinimalNapiOptions) {
|
||||
const resolvePath = (...paths: string[]) => resolve(options.cwd, ...paths)
|
||||
const config = await readNapiConfig(
|
||||
resolvePath(
|
||||
options.configPath ?? options.packageJsonPath ?? 'package.json',
|
||||
),
|
||||
resolvePath(options.packageJsonPath ?? 'package.json'),
|
||||
options.configPath ? resolvePath(options.configPath) : undefined,
|
||||
)
|
||||
return config
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user