mirror of
				https://github.com/pnpm/action-setup.git
				synced 2025-11-04 13:29:08 +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 { 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
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user