mirror of
				https://github.com/pnpm/action-setup.git
				synced 2025-11-04 13:29:08 +08:00 
			
		
		
		
	Fix pruneStore
This commit is contained in:
		
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -1,14 +1,10 @@
 | 
			
		||||
import process from 'process'
 | 
			
		||||
import path from 'path'
 | 
			
		||||
import { spawnSync } from 'child_process'
 | 
			
		||||
import { setFailed } from '@actions/core'
 | 
			
		||||
import { Inputs } from '../inputs'
 | 
			
		||||
import { patchPnpmEnv } from '../utils'
 | 
			
		||||
 | 
			
		||||
export function runPnpmInstall(inputs: Inputs) {
 | 
			
		||||
  const env = {
 | 
			
		||||
    ...process.env,
 | 
			
		||||
    PATH: inputs.binDest + path.delimiter + process.env.PATH
 | 
			
		||||
  }
 | 
			
		||||
  const env = patchPnpmEnv(inputs)
 | 
			
		||||
 | 
			
		||||
  for (const options of inputs.runInstall) {
 | 
			
		||||
    const args = ['install']
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
import { spawnSync } from 'child_process'
 | 
			
		||||
import { setFailed } from '@actions/core'
 | 
			
		||||
import { Inputs } from '../inputs'
 | 
			
		||||
import { patchPnpmEnv } from '../utils'
 | 
			
		||||
 | 
			
		||||
export function pruneStore(inputs: Inputs) {
 | 
			
		||||
  if (inputs.runInstall.length === 0) {
 | 
			
		||||
@@ -11,6 +12,8 @@ export function pruneStore(inputs: Inputs) {
 | 
			
		||||
  console.log('Running pnpm store prune')
 | 
			
		||||
  const { error, status } = spawnSync('pnpm', ['store', 'prune'], {
 | 
			
		||||
    stdio: 'inherit',
 | 
			
		||||
    shell: true,
 | 
			
		||||
    env: patchPnpmEnv(inputs)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  if (error) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								src/utils/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/utils/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
import process from 'process'
 | 
			
		||||
import path from 'path'
 | 
			
		||||
import { Inputs } from '../inputs'
 | 
			
		||||
 | 
			
		||||
export const patchPnpmEnv = (inputs: Inputs): NodeJS.ProcessEnv => ({
 | 
			
		||||
  ...process.env,
 | 
			
		||||
  PATH: inputs.binDest + path.delimiter + process.env.PATH
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user