mirror of
				https://github.com/pnpm/action-setup.git
				synced 2025-11-04 11:22:11 +08:00 
			
		
		
		
	decrease bundle size
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
import * as core from '@actions/core'
 | 
			
		||||
import { addPath, exportVariable } from '@actions/core'
 | 
			
		||||
import { spawn } from 'child_process'
 | 
			
		||||
import { execPath } from 'process'
 | 
			
		||||
import { join } from 'path'
 | 
			
		||||
import path from 'path'
 | 
			
		||||
import { remove, ensureFile, writeFile } from 'fs-extra'
 | 
			
		||||
import fetch from 'node-fetch'
 | 
			
		||||
import { Inputs } from '../inputs'
 | 
			
		||||
@@ -9,7 +9,7 @@ import { Inputs } from '../inputs'
 | 
			
		||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
 | 
			
		||||
  const { version, dest } = inputs
 | 
			
		||||
  const target = version ? `pnpm@${version}` : 'pnpm'
 | 
			
		||||
  const pkgJson = join(dest, 'package.json')
 | 
			
		||||
  const pkgJson = path.join(dest, 'package.json')
 | 
			
		||||
 | 
			
		||||
  await remove(dest)
 | 
			
		||||
  await ensureFile(pkgJson)
 | 
			
		||||
@@ -28,9 +28,9 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
 | 
			
		||||
    cp.on('close', resolve)
 | 
			
		||||
  })
 | 
			
		||||
  if (exitCode === 0) {
 | 
			
		||||
    const pnpmHome = join(dest, 'node_modules/.bin')
 | 
			
		||||
    core.addPath(pnpmHome)
 | 
			
		||||
    core.exportVariable('PNPM_HOME', pnpmHome)
 | 
			
		||||
    const pnpmHome = path.join(dest, 'node_modules/.bin')
 | 
			
		||||
    addPath(pnpmHome)
 | 
			
		||||
    exportVariable('PNPM_HOME', pnpmHome)
 | 
			
		||||
  }
 | 
			
		||||
  return exitCode
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user