decrease bundle size

This commit is contained in:
Zoltan Kochan 2022-02-08 14:44:50 +02:00
parent eafb777c56
commit 9eb14dd77c
No known key found for this signature in database
GPG Key ID: 649E4D4AF74E7DEC

View File

@ -1,7 +1,7 @@
import * as core from '@actions/core' import { addPath, exportVariable } from '@actions/core'
import { spawn } from 'child_process' import { spawn } from 'child_process'
import { execPath } from 'process' import { execPath } from 'process'
import { join } from 'path' import path from 'path'
import { remove, ensureFile, writeFile } from 'fs-extra' import { remove, ensureFile, writeFile } from 'fs-extra'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
@ -9,7 +9,7 @@ import { Inputs } from '../inputs'
export async function runSelfInstaller(inputs: Inputs): Promise<number> { export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest } = inputs const { version, dest } = inputs
const target = version ? `pnpm@${version}` : 'pnpm' const target = version ? `pnpm@${version}` : 'pnpm'
const pkgJson = join(dest, 'package.json') const pkgJson = path.join(dest, 'package.json')
await remove(dest) await remove(dest)
await ensureFile(pkgJson) await ensureFile(pkgJson)
@ -28,9 +28,9 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
cp.on('close', resolve) cp.on('close', resolve)
}) })
if (exitCode === 0) { if (exitCode === 0) {
const pnpmHome = join(dest, 'node_modules/.bin') const pnpmHome = path.join(dest, 'node_modules/.bin')
core.addPath(pnpmHome) addPath(pnpmHome)
core.exportVariable('PNPM_HOME', pnpmHome) exportVariable('PNPM_HOME', pnpmHome)
} }
return exitCode return exitCode
} }