mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-24 10:01:48 -04:00
34 lines
843 B
TypeScript
34 lines
843 B
TypeScript
import * as execa from 'execa'
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
const artifactsDir = path.join(__dirname, '../../artifacts')
|
|
|
|
function build (target: string) {
|
|
let artifactFile = path.join(artifactsDir, target, 'pnpm')
|
|
if (target.startsWith('win-')) {
|
|
artifactFile += '.exe'
|
|
}
|
|
try {
|
|
fs.unlinkSync(artifactFile)
|
|
} catch (err) {}
|
|
execa.sync('pkg', ['../pnpm/dist/pnpm.cjs', `--config=../pnpm/package-${target}.json`], {
|
|
cwd: path.join(__dirname, '..'),
|
|
stdio: 'inherit',
|
|
})
|
|
// Verifying that the artifact was created.
|
|
fs.statSync(artifactFile);
|
|
}
|
|
|
|
build('win-x64')
|
|
build('linux-x64')
|
|
build('linuxstatic-x64')
|
|
build('macos-x64')
|
|
|
|
const isM1Mac = process.platform === 'darwin' && process.arch === 'arm64'
|
|
if (process.platform === 'linux' || isM1Mac) {
|
|
build('macos-arm64')
|
|
build('linux-arm64')
|
|
}
|
|
|