You've already forked setup-node
							
							
				mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-31 07:06:24 +07:00 
			
		
		
		
	Add auth support (#21)
* Updates * Update * Update * Update * Update * Yarn sometimes prefers npmrc, so use same token * Description * Update readme * Feedback * Add type * new toolkit and scoped registries * npmrc in RUNNER_TEMP * Dont always auth * Try exporting blank token * Get auth working for now pending runner changes * Fix string interpolation for auth token. * Don't export both userconfigs * Update authutil.js * Add single quotes for authString * Fix the registry string. * Use userconfig and append trailing slash * Keep in root of repo * Try just adding auth token * Remove auth token * Try changes again * Add tests * Npm and GPR samples * Add types
This commit is contained in:
		
							
								
								
									
										5
									
								
								node_modules/pump/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/pump/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| language: node_js | ||||
| node_js: | ||||
|   - "0.10" | ||||
|  | ||||
| script: "npm test" | ||||
							
								
								
									
										21
									
								
								node_modules/pump/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/pump/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| The MIT License (MIT) | ||||
|  | ||||
| Copyright (c) 2014 Mathias Buus | ||||
|  | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | ||||
| in the Software without restriction, including without limitation the rights | ||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| copies of the Software, and to permit persons to whom the Software is | ||||
| furnished to do so, subject to the following conditions: | ||||
|  | ||||
| The above copyright notice and this permission notice shall be included in | ||||
| all copies or substantial portions of the Software. | ||||
|  | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
| THE SOFTWARE. | ||||
							
								
								
									
										65
									
								
								node_modules/pump/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								node_modules/pump/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,65 @@ | ||||
| # pump | ||||
|  | ||||
| pump is a small node module that pipes streams together and destroys all of them if one of them closes. | ||||
|  | ||||
| ``` | ||||
| npm install pump | ||||
| ``` | ||||
|  | ||||
| [](http://travis-ci.org/mafintosh/pump) | ||||
|  | ||||
| ## What problem does it solve? | ||||
|  | ||||
| When using standard `source.pipe(dest)` source will _not_ be destroyed if dest emits close or an error. | ||||
| You are also not able to provide a callback to tell when then pipe has finished. | ||||
|  | ||||
| pump does these two things for you | ||||
|  | ||||
| ## Usage | ||||
|  | ||||
| Simply pass the streams you want to pipe together to pump and add an optional callback | ||||
|  | ||||
| ``` js | ||||
| var pump = require('pump') | ||||
| var fs = require('fs') | ||||
|  | ||||
| var source = fs.createReadStream('/dev/random') | ||||
| var dest = fs.createWriteStream('/dev/null') | ||||
|  | ||||
| pump(source, dest, function(err) { | ||||
|   console.log('pipe finished', err) | ||||
| }) | ||||
|  | ||||
| setTimeout(function() { | ||||
|   dest.destroy() // when dest is closed pump will destroy source | ||||
| }, 1000) | ||||
| ``` | ||||
|  | ||||
| You can use pump to pipe more than two streams together as well | ||||
|  | ||||
| ``` js | ||||
| var transform = someTransformStream() | ||||
|  | ||||
| pump(source, transform, anotherTransform, dest, function(err) { | ||||
|   console.log('pipe finished', err) | ||||
| }) | ||||
| ``` | ||||
|  | ||||
| If `source`, `transform`, `anotherTransform` or `dest` closes all of them will be destroyed. | ||||
|  | ||||
| Similarly to `stream.pipe()`, `pump()` returns the last stream passed in, so you can do: | ||||
|  | ||||
| ``` | ||||
| return pump(s1, s2) // returns s2 | ||||
| ``` | ||||
|  | ||||
| If you want to return a stream that combines *both* s1 and s2 to a single stream use | ||||
| [pumpify](https://github.com/mafintosh/pumpify) instead. | ||||
|  | ||||
| ## License | ||||
|  | ||||
| MIT | ||||
|  | ||||
| ## Related | ||||
|  | ||||
| `pump` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one. | ||||
							
								
								
									
										82
									
								
								node_modules/pump/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								node_modules/pump/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,82 @@ | ||||
| var once = require('once') | ||||
| var eos = require('end-of-stream') | ||||
| var fs = require('fs') // we only need fs to get the ReadStream and WriteStream prototypes | ||||
|  | ||||
| var noop = function () {} | ||||
| var ancient = /^v?\.0/.test(process.version) | ||||
|  | ||||
| var isFn = function (fn) { | ||||
|   return typeof fn === 'function' | ||||
| } | ||||
|  | ||||
| var isFS = function (stream) { | ||||
|   if (!ancient) return false // newer node version do not need to care about fs is a special way | ||||
|   if (!fs) return false // browser | ||||
|   return (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close) | ||||
| } | ||||
|  | ||||
| var isRequest = function (stream) { | ||||
|   return stream.setHeader && isFn(stream.abort) | ||||
| } | ||||
|  | ||||
| var destroyer = function (stream, reading, writing, callback) { | ||||
|   callback = once(callback) | ||||
|  | ||||
|   var closed = false | ||||
|   stream.on('close', function () { | ||||
|     closed = true | ||||
|   }) | ||||
|  | ||||
|   eos(stream, {readable: reading, writable: writing}, function (err) { | ||||
|     if (err) return callback(err) | ||||
|     closed = true | ||||
|     callback() | ||||
|   }) | ||||
|  | ||||
|   var destroyed = false | ||||
|   return function (err) { | ||||
|     if (closed) return | ||||
|     if (destroyed) return | ||||
|     destroyed = true | ||||
|  | ||||
|     if (isFS(stream)) return stream.close(noop) // use close for fs streams to avoid fd leaks | ||||
|     if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want | ||||
|  | ||||
|     if (isFn(stream.destroy)) return stream.destroy() | ||||
|  | ||||
|     callback(err || new Error('stream was destroyed')) | ||||
|   } | ||||
| } | ||||
|  | ||||
| var call = function (fn) { | ||||
|   fn() | ||||
| } | ||||
|  | ||||
| var pipe = function (from, to) { | ||||
|   return from.pipe(to) | ||||
| } | ||||
|  | ||||
| var pump = function () { | ||||
|   var streams = Array.prototype.slice.call(arguments) | ||||
|   var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop | ||||
|  | ||||
|   if (Array.isArray(streams[0])) streams = streams[0] | ||||
|   if (streams.length < 2) throw new Error('pump requires two streams per minimum') | ||||
|  | ||||
|   var error | ||||
|   var destroys = streams.map(function (stream, i) { | ||||
|     var reading = i < streams.length - 1 | ||||
|     var writing = i > 0 | ||||
|     return destroyer(stream, reading, writing, function (err) { | ||||
|       if (!error) error = err | ||||
|       if (err) destroys.forEach(call) | ||||
|       if (reading) return | ||||
|       destroys.forEach(call) | ||||
|       callback(error) | ||||
|     }) | ||||
|   }) | ||||
|  | ||||
|   return streams.reduce(pipe) | ||||
| } | ||||
|  | ||||
| module.exports = pump | ||||
							
								
								
									
										63
									
								
								node_modules/pump/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								node_modules/pump/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,63 @@ | ||||
| { | ||||
|   "_args": [ | ||||
|     [ | ||||
|       "pump@3.0.0", | ||||
|       "C:\\Users\\Administrator\\Documents\\setup-node" | ||||
|     ] | ||||
|   ], | ||||
|   "_development": true, | ||||
|   "_from": "pump@3.0.0", | ||||
|   "_id": "pump@3.0.0", | ||||
|   "_inBundle": false, | ||||
|   "_integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", | ||||
|   "_location": "/pump", | ||||
|   "_phantomChildren": {}, | ||||
|   "_requested": { | ||||
|     "type": "version", | ||||
|     "registry": true, | ||||
|     "raw": "pump@3.0.0", | ||||
|     "name": "pump", | ||||
|     "escapedName": "pump", | ||||
|     "rawSpec": "3.0.0", | ||||
|     "saveSpec": null, | ||||
|     "fetchSpec": "3.0.0" | ||||
|   }, | ||||
|   "_requiredBy": [ | ||||
|     "/get-stream" | ||||
|   ], | ||||
|   "_resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", | ||||
|   "_spec": "3.0.0", | ||||
|   "_where": "C:\\Users\\Administrator\\Documents\\setup-node", | ||||
|   "author": { | ||||
|     "name": "Mathias Buus Madsen", | ||||
|     "email": "mathiasbuus@gmail.com" | ||||
|   }, | ||||
|   "browser": { | ||||
|     "fs": false | ||||
|   }, | ||||
|   "bugs": { | ||||
|     "url": "https://github.com/mafintosh/pump/issues" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "end-of-stream": "^1.1.0", | ||||
|     "once": "^1.3.1" | ||||
|   }, | ||||
|   "description": "pipe streams together and close all of them if one of them closes", | ||||
|   "homepage": "https://github.com/mafintosh/pump#readme", | ||||
|   "keywords": [ | ||||
|     "streams", | ||||
|     "pipe", | ||||
|     "destroy", | ||||
|     "callback" | ||||
|   ], | ||||
|   "license": "MIT", | ||||
|   "name": "pump", | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|     "url": "git://github.com/mafintosh/pump.git" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "test": "node test-browser.js && node test-node.js" | ||||
|   }, | ||||
|   "version": "3.0.0" | ||||
| } | ||||
							
								
								
									
										66
									
								
								node_modules/pump/test-browser.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								node_modules/pump/test-browser.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,66 @@ | ||||
| var stream = require('stream') | ||||
| var pump = require('./index') | ||||
|  | ||||
| var rs = new stream.Readable() | ||||
| var ws = new stream.Writable() | ||||
|  | ||||
| rs._read = function (size) { | ||||
|   this.push(Buffer(size).fill('abc')) | ||||
| } | ||||
|  | ||||
| ws._write = function (chunk, encoding, cb) { | ||||
|   setTimeout(function () { | ||||
|     cb() | ||||
|   }, 100) | ||||
| } | ||||
|  | ||||
| var toHex = function () { | ||||
|   var reverse = new (require('stream').Transform)() | ||||
|  | ||||
|   reverse._transform = function (chunk, enc, callback) { | ||||
|     reverse.push(chunk.toString('hex')) | ||||
|     callback() | ||||
|   } | ||||
|  | ||||
|   return reverse | ||||
| } | ||||
|  | ||||
| var wsClosed = false | ||||
| var rsClosed = false | ||||
| var callbackCalled = false | ||||
|  | ||||
| var check = function () { | ||||
|   if (wsClosed && rsClosed && callbackCalled) { | ||||
|     console.log('test-browser.js passes') | ||||
|     clearTimeout(timeout) | ||||
|   } | ||||
| } | ||||
|  | ||||
| ws.on('finish', function () { | ||||
|   wsClosed = true | ||||
|   check() | ||||
| }) | ||||
|  | ||||
| rs.on('end', function () { | ||||
|   rsClosed = true | ||||
|   check() | ||||
| }) | ||||
|  | ||||
| var res = pump(rs, toHex(), toHex(), toHex(), ws, function () { | ||||
|   callbackCalled = true | ||||
|   check() | ||||
| }) | ||||
|  | ||||
| if (res !== ws) { | ||||
|   throw new Error('should return last stream') | ||||
| } | ||||
|  | ||||
| setTimeout(function () { | ||||
|   rs.push(null) | ||||
|   rs.emit('close') | ||||
| }, 1000) | ||||
|  | ||||
| var timeout = setTimeout(function () { | ||||
|   check() | ||||
|   throw new Error('timeout') | ||||
| }, 5000) | ||||
							
								
								
									
										53
									
								
								node_modules/pump/test-node.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								node_modules/pump/test-node.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | ||||
| var pump = require('./index') | ||||
|  | ||||
| var rs = require('fs').createReadStream('/dev/random') | ||||
| var ws = require('fs').createWriteStream('/dev/null') | ||||
|  | ||||
| var toHex = function () { | ||||
|   var reverse = new (require('stream').Transform)() | ||||
|  | ||||
|   reverse._transform = function (chunk, enc, callback) { | ||||
|     reverse.push(chunk.toString('hex')) | ||||
|     callback() | ||||
|   } | ||||
|  | ||||
|   return reverse | ||||
| } | ||||
|  | ||||
| var wsClosed = false | ||||
| var rsClosed = false | ||||
| var callbackCalled = false | ||||
|  | ||||
| var check = function () { | ||||
|   if (wsClosed && rsClosed && callbackCalled) { | ||||
|     console.log('test-node.js passes') | ||||
|     clearTimeout(timeout) | ||||
|   } | ||||
| } | ||||
|  | ||||
| ws.on('close', function () { | ||||
|   wsClosed = true | ||||
|   check() | ||||
| }) | ||||
|  | ||||
| rs.on('close', function () { | ||||
|   rsClosed = true | ||||
|   check() | ||||
| }) | ||||
|  | ||||
| var res = pump(rs, toHex(), toHex(), toHex(), ws, function () { | ||||
|   callbackCalled = true | ||||
|   check() | ||||
| }) | ||||
|  | ||||
| if (res !== ws) { | ||||
|   throw new Error('should return last stream') | ||||
| } | ||||
|  | ||||
| setTimeout(function () { | ||||
|   rs.destroy() | ||||
| }, 1000) | ||||
|  | ||||
| var timeout = setTimeout(function () { | ||||
|   throw new Error('timeout') | ||||
| }, 5000) | ||||
		Reference in New Issue
	
	Block a user
	 Danny McCormick
					Danny McCormick