cli: 'artifacts' command update to deal with universal builds
This commit is contained in:
parent
cfd8d3dc50
commit
fed35841e0
1 changed files with 17 additions and 0 deletions
|
@ -6,6 +6,7 @@ import { fdir } from 'fdir'
|
||||||
|
|
||||||
import { getNapiConfig } from './consts'
|
import { getNapiConfig } from './consts'
|
||||||
import { debugFactory } from './debug'
|
import { debugFactory } from './debug'
|
||||||
|
import { UniArchsByPlatform } from './parse-triple'
|
||||||
import { readFileAsync, writeFileAsync } from './utils'
|
import { readFileAsync, writeFileAsync } from './utils'
|
||||||
|
|
||||||
const debug = debugFactory('artifacts')
|
const debug = debugFactory('artifacts')
|
||||||
|
@ -38,6 +39,14 @@ export class ArtifactsCommand extends Command {
|
||||||
join(process.cwd(), this.distDir, platform.platformArchABI),
|
join(process.cwd(), this.distDir, platform.platformArchABI),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const universalSourceBins = new Set(
|
||||||
|
platforms
|
||||||
|
.filter((platform) => platform.arch === 'universal')
|
||||||
|
.flatMap((p) =>
|
||||||
|
UniArchsByPlatform[p.platform].map((a) => `${p.platform}-${a}`),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
await sourceApi.withPromise().then((output) =>
|
await sourceApi.withPromise().then((output) =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
(output as string[]).map(async (filePath) => {
|
(output as string[]).map(async (filePath) => {
|
||||||
|
@ -53,6 +62,14 @@ export class ArtifactsCommand extends Command {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const dir = distDirs.find((dir) => dir.includes(platformArchABI))
|
const dir = distDirs.find((dir) => dir.includes(platformArchABI))
|
||||||
|
if (!dir && universalSourceBins.has(platformArchABI)) {
|
||||||
|
debug(
|
||||||
|
`[${chalk.yellowBright(
|
||||||
|
platformArchABI,
|
||||||
|
)}] has no dist dir but it is source bin for universal arch, skip`,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
throw new TypeError(`No dist dir found for ${filePath}`)
|
throw new TypeError(`No dist dir found for ${filePath}`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue