mirror of
				https://github.com/pnpm/action-setup.git
				synced 2025-10-31 17:32:24 +08:00 
			
		
		
		
	Rename install to install-pnpm
This commit is contained in:
		
							
								
								
									
										14
									
								
								src/install-pnpm/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/install-pnpm/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| import { setFailed } from '@actions/core' | ||||
| import { Inputs } from '../inputs' | ||||
| import runSelfInstaller from './run' | ||||
|  | ||||
| export { runSelfInstaller } | ||||
|  | ||||
| export async function install(inputs: Inputs) { | ||||
|   const status = await runSelfInstaller(inputs) | ||||
|   if (status) { | ||||
|     return setFailed(`Something does wrong, self-installer exits with code ${status}`) | ||||
|   } | ||||
| } | ||||
|  | ||||
| export default install | ||||
							
								
								
									
										26
									
								
								src/install-pnpm/run.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/install-pnpm/run.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| import { spawn } from 'child_process' | ||||
| import { execPath } from 'process' | ||||
| import { downloadSelfInstaller } from '../self-installer' | ||||
| import { Inputs } from '../inputs' | ||||
|  | ||||
| export async function runSelfInstaller(inputs: Inputs): Promise<number> { | ||||
|   const cp = spawn(execPath, { | ||||
|     env: { | ||||
|       PNPM_VERSION: inputs.version, | ||||
|       PNPM_DEST: inputs.dest, | ||||
|       PNPM_BIN_DEST: inputs.binDest, | ||||
|       PNPM_REGISTRY: inputs.registry, | ||||
|     }, | ||||
|     stdio: ['pipe', 'inherit', 'inherit'], | ||||
|   }) | ||||
|  | ||||
|   const response = await downloadSelfInstaller() | ||||
|   response.body.pipe(cp.stdin) | ||||
|  | ||||
|   return new Promise((resolve, reject) => { | ||||
|     cp.on('error', reject) | ||||
|     cp.on('close', resolve) | ||||
|   }) | ||||
| } | ||||
|  | ||||
| export default runSelfInstaller | ||||
		Reference in New Issue
	
	Block a user