mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action! (#1)
This commit is contained in:
parent
8deacc95b1
commit
ace1e6a69a
3750 changed files with 1155519 additions and 0 deletions
14
node_modules/copy-concurrently/LICENSE
generated
vendored
Normal file
14
node_modules/copy-concurrently/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
Copyright (c) 2017, Rebecca Turner <me@re-becca.org>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
128
node_modules/copy-concurrently/README.md
generated
vendored
Normal file
128
node_modules/copy-concurrently/README.md
generated
vendored
Normal file
|
@ -0,0 +1,128 @@
|
|||
# copy-concurrently
|
||||
|
||||
Copy files, directories and symlinks
|
||||
|
||||
```
|
||||
const copy = require('copy-concurrently')
|
||||
copy('/path/to/thing', '/new/path/thing').then(() => {
|
||||
// this is now copied
|
||||
}).catch(err => {
|
||||
// oh noooo
|
||||
})
|
||||
```
|
||||
|
||||
Copies files, directories and symlinks. Ownership is maintained when
|
||||
running as root, permissions are always maintained. On Windows, if symlinks
|
||||
are unavailable then junctions will be used.
|
||||
|
||||
## PUBLIC INTERFACE
|
||||
|
||||
### copy(from, to, [options]) → Promise
|
||||
|
||||
Recursively copies `from` to `to` and resolves its promise when finished.
|
||||
If `to` already exists then the promise will be rejected with an `EEXIST`
|
||||
error.
|
||||
|
||||
Options are:
|
||||
|
||||
* maxConcurrency – (Default: `1`) The maximum number of concurrent copies to do at once.
|
||||
* recurseWith - (Default: `copy.item`) The function to call on each file after recursing into a directory.
|
||||
* isWindows - (Default: `process.platform === 'win32'`) If true enables Windows symlink semantics. This requires
|
||||
an extra `stat` to determine if the destination of a symlink is a file or directory. If symlinking a directory
|
||||
fails then we'll try making a junction instead.
|
||||
|
||||
Options can also include dependency injection:
|
||||
|
||||
* Promise - (Default: `global.Promise`) The promise implementation to use, defaults to Node's.
|
||||
* fs - (Default: `require('fs')`) The filesystem module to use. Can be used
|
||||
to use `graceful-fs` or to inject a mock.
|
||||
* writeStreamAtomic - (Default: `require('fs-write-stream-atomic')`) The
|
||||
implementation of `writeStreamAtomic` to use. Used to inject a mock.
|
||||
* getuid - (Default: `process.getuid`) A function that returns the current UID. Used to inject a mock.
|
||||
|
||||
## EXTENSION INTERFACE
|
||||
|
||||
Ordinarily you'd only call `copy` above. But it's possible to use it's
|
||||
component functions directly. This is useful if, say, you're writing
|
||||
[move-concurently](https://npmjs.com/package/move-concurrently).
|
||||
|
||||
### copy.file(from, to, options) → Promise
|
||||
|
||||
Copies an ordinary file `from` to destination `to`. Uses
|
||||
`fs-write-stream-atomic` to ensure that the file is either entirely copied
|
||||
or not at all.
|
||||
|
||||
Options are:
|
||||
|
||||
* uid, gid - (Optional) If `getuid()` is `0` then this and gid will be used to
|
||||
set the user and group of `to`. If uid is present then gid must be too.
|
||||
* mode - (Optional) If set then `to` will have its perms set to `mode`.
|
||||
* fs - (Default: `require('fs')`) The filesystem module to use. Can be used
|
||||
to use `graceful-fs` or to inject a mock.
|
||||
* Promise - (Default: `global.Promise`) The promise implementation to use, defaults to Node's.
|
||||
* writeStreamAtomic - (Default `require('fs-write-stream-atomic')`) The
|
||||
implementation of `writeStreamAtomic` to use. Used to inject a mock.
|
||||
|
||||
### copy.symlink(from, to, options) → Promise
|
||||
|
||||
Copies a symlink `from` to destination `to`. If you're using Windows and
|
||||
symlinking fails and what you're linking is a directory then junctions will
|
||||
be tried instead.
|
||||
|
||||
Options are:
|
||||
|
||||
* top - The top level the copy is being run from. This is used to determine
|
||||
if the symlink destination is within the set of files we're copying or
|
||||
outside it.
|
||||
* fs - (Default: `require('fs')`) The filesystem module to use. Can be used
|
||||
to use `graceful-fs` or to inject a mock.
|
||||
* Promise - (Default: `global.Promise`) The promise implementation to use, defaults to Node's.
|
||||
* isWindows - (Default: `process.platform === 'win32'`) If true enables Windows symlink semantics. This requires
|
||||
an extra `stat` to determine if the destination of a symlink is a file or directory. If symlinking a directory
|
||||
fails then we'll try making a junction instead.
|
||||
|
||||
### copy.recurse(from, to, options) → Promise
|
||||
|
||||
Reads all of the files in directory `from` and adds them to the `queue`
|
||||
using `recurseWith` (by default `copy.item`).
|
||||
|
||||
Options are:
|
||||
|
||||
* queue - A [`run-queue`](https://npmjs.com/package/run-queue) object to add files found inside `from` to.
|
||||
* recurseWith - (Default: `copy.item`) The function to call on each file after recursing into a directory.
|
||||
* uid, gid - (Optional) If `getuid()` is `0` then this and gid will be used to
|
||||
set the user and group of `to`. If uid is present then gid must be too.
|
||||
* mode - (Optional) If set then `to` will have its perms set to `mode`.
|
||||
* fs - (Default: `require('fs')`) The filesystem module to use. Can be used
|
||||
to use `graceful-fs` or to inject a mock.
|
||||
* getuid - (Default: `process.getuid`) A function that returns the current UID. Used to inject a mock.
|
||||
|
||||
### copy.item(from, to, options) → Promise
|
||||
|
||||
Copies some kind of `from` to destination `to`. This looks at the filetype
|
||||
and calls `copy.file`, `copy.symlink` or `copy.recurse` as appropriate.
|
||||
|
||||
Symlink copies are queued with a priority such that they happen after all
|
||||
file and directory copies as you can't create a junction on windows to a
|
||||
file that doesn't exist yet.
|
||||
|
||||
Options are:
|
||||
|
||||
* top - The top level the copy is being run from. This is used to determine
|
||||
if the symlink destination is within the set of files we're copying or
|
||||
outside it.
|
||||
* queue - The [`run-queue`](https://npmjs.com/package/run-queue) object to
|
||||
pass to `copy.recurse` if `from` is a directory.
|
||||
* recurseWith - (Default: `copy.item`) The function to call on each file after recursing into a directory.
|
||||
* uid, gid - (Optional) If `getuid()` is `0` then this and gid will be used to
|
||||
set the user and group of `to`. If uid is present then gid must be too.
|
||||
* mode - (Optional) If set then `to` will have its perms set to `mode`.
|
||||
* fs - (Default: `require('fs')`) The filesystem module to use. Can be used
|
||||
to use `graceful-fs` or to inject a mock.
|
||||
* getuid - (Default: `process.getuid`) A function that returns the current UID. Used to inject a mock.
|
||||
* isWindows - (Default: `process.platform === 'win32'`) If true enables Windows symlink semantics. This requires
|
||||
an extra `stat` to determine if the destination of a symlink is a file or directory. If symlinking a directory
|
||||
fails then we'll try making a junction instead.
|
||||
* Promise - (Default: `global.Promise`) The promise implementation to use, defaults to Node's.
|
||||
* writeStreamAtomic - (Default `require('fs-write-stream-atomic')`) The
|
||||
implementation of `writeStreamAtomic` to use. Used to inject a mock.
|
225
node_modules/copy-concurrently/copy.js
generated
vendored
Normal file
225
node_modules/copy-concurrently/copy.js
generated
vendored
Normal file
|
@ -0,0 +1,225 @@
|
|||
'use strict'
|
||||
module.exports = copy
|
||||
module.exports.item = copyItem
|
||||
module.exports.recurse = recurseDir
|
||||
module.exports.symlink = copySymlink
|
||||
module.exports.file = copyFile
|
||||
|
||||
var nodeFs = require('fs')
|
||||
var path = require('path')
|
||||
var validate = require('aproba')
|
||||
var stockWriteStreamAtomic = require('fs-write-stream-atomic')
|
||||
var mkdirp = require('mkdirp')
|
||||
var rimraf = require('rimraf')
|
||||
var isWindows = require('./is-windows')
|
||||
var RunQueue = require('run-queue')
|
||||
var extend = Object.assign || require('util')._extend
|
||||
|
||||
function promisify (Promise, fn) {
|
||||
return function () {
|
||||
var args = [].slice.call(arguments)
|
||||
return new Promise(function (resolve, reject) {
|
||||
return fn.apply(null, args.concat(function (err, value) {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
resolve(value)
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function copy (from, to, opts) {
|
||||
validate('SSO|SS', arguments)
|
||||
opts = extend({}, opts || {})
|
||||
|
||||
var Promise = opts.Promise || global.Promise
|
||||
var fs = opts.fs || nodeFs
|
||||
|
||||
if (opts.isWindows == null) opts.isWindows = isWindows
|
||||
if (!opts.Promise) opts.Promise = Promise
|
||||
if (!opts.fs) opts.fs = fs
|
||||
if (!opts.recurseWith) opts.recurseWith = copyItem
|
||||
if (!opts.lstat) opts.lstat = promisify(opts.Promise, fs.lstat)
|
||||
if (!opts.stat) opts.stat = promisify(opts.Promise, fs.stat)
|
||||
if (!opts.chown) opts.chown = promisify(opts.Promise, fs.chown)
|
||||
if (!opts.readdir) opts.readdir = promisify(opts.Promise, fs.readdir)
|
||||
if (!opts.readlink) opts.readlink = promisify(opts.Promise, fs.readlink)
|
||||
if (!opts.symlink) opts.symlink = promisify(opts.Promise, fs.symlink)
|
||||
if (!opts.chmod) opts.chmod = promisify(opts.Promise, fs.chmod)
|
||||
|
||||
opts.top = from
|
||||
opts.mkdirpAsync = promisify(opts.Promise, mkdirp)
|
||||
var rimrafAsync = promisify(opts.Promise, rimraf)
|
||||
|
||||
var queue = new RunQueue({
|
||||
maxConcurrency: opts.maxConcurrency,
|
||||
Promise: Promise
|
||||
})
|
||||
opts.queue = queue
|
||||
|
||||
queue.add(0, copyItem, [from, to, opts])
|
||||
|
||||
return queue.run().catch(function (err) {
|
||||
// if the target already exists don't clobber it
|
||||
if (err.code === 'EEXIST' || err.code === 'EPERM') {
|
||||
return passThroughError()
|
||||
} else {
|
||||
return remove(to).then(passThroughError, passThroughError)
|
||||
}
|
||||
function passThroughError () {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
})
|
||||
|
||||
function remove (target) {
|
||||
var opts = {
|
||||
unlink: fs.unlink,
|
||||
chmod: fs.chmod,
|
||||
stat: fs.stat,
|
||||
lstat: fs.lstat,
|
||||
rmdir: fs.rmdir,
|
||||
readdir: fs.readdir,
|
||||
glob: false
|
||||
}
|
||||
return rimrafAsync(target, opts)
|
||||
}
|
||||
}
|
||||
|
||||
function copyItem (from, to, opts) {
|
||||
validate('SSO', [from, to, opts])
|
||||
var fs = opts.fs || nodeFs
|
||||
var Promise = opts.Promise || global.Promise
|
||||
var lstat = opts.lstat || promisify(Promise, fs.lstat)
|
||||
|
||||
return lstat(to).then(function () {
|
||||
return Promise.reject(eexists(from, to))
|
||||
}, function (err) {
|
||||
if (err && err.code !== 'ENOENT') return Promise.reject(err)
|
||||
return lstat(from)
|
||||
}).then(function (fromStat) {
|
||||
var cmdOpts = extend(extend({}, opts), fromStat)
|
||||
if (fromStat.isDirectory()) {
|
||||
return recurseDir(from, to, cmdOpts)
|
||||
} else if (fromStat.isSymbolicLink()) {
|
||||
opts.queue.add(1, copySymlink, [from, to, cmdOpts])
|
||||
} else if (fromStat.isFile()) {
|
||||
return copyFile(from, to, cmdOpts)
|
||||
} else if (fromStat.isBlockDevice()) {
|
||||
return Promise.reject(eunsupported(from + " is a block device, and we don't know how to copy those."))
|
||||
} else if (fromStat.isCharacterDevice()) {
|
||||
return Promise.reject(eunsupported(from + " is a character device, and we don't know how to copy those."))
|
||||
} else if (fromStat.isFIFO()) {
|
||||
return Promise.reject(eunsupported(from + " is a FIFO, and we don't know how to copy those."))
|
||||
} else if (fromStat.isSocket()) {
|
||||
return Promise.reject(eunsupported(from + " is a socket, and we don't know how to copy those."))
|
||||
} else {
|
||||
return Promise.reject(eunsupported("We can't tell what " + from + " is and so we can't copy it."))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function recurseDir (from, to, opts) {
|
||||
validate('SSO', [from, to, opts])
|
||||
var recurseWith = opts.recurseWith || copyItem
|
||||
var fs = opts.fs || nodeFs
|
||||
var chown = opts.chown || promisify(Promise, fs.chown)
|
||||
var readdir = opts.readdir || promisify(Promise, fs.readdir)
|
||||
var mkdirpAsync = opts.mkdirpAsync || promisify(Promise, mkdirp)
|
||||
|
||||
return mkdirpAsync(to, {fs: fs, mode: opts.mode}).then(function () {
|
||||
var getuid = opts.getuid || process.getuid
|
||||
if (getuid && opts.uid != null && getuid() === 0) {
|
||||
return chown(to, opts.uid, opts.gid)
|
||||
}
|
||||
}).then(function () {
|
||||
return readdir(from)
|
||||
}).then(function (files) {
|
||||
files.forEach(function (file) {
|
||||
opts.queue.add(0, recurseWith, [path.join(from, file), path.join(to, file), opts])
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function copySymlink (from, to, opts) {
|
||||
validate('SSO', [from, to, opts])
|
||||
var fs = opts.fs || nodeFs
|
||||
var readlink = opts.readlink || promisify(Promise, fs.readlink)
|
||||
var stat = opts.stat || promisify(Promise, fs.symlink)
|
||||
var symlink = opts.symlink || promisify(Promise, fs.symlink)
|
||||
var Promise = opts.Promise || global.Promise
|
||||
|
||||
return readlink(from).then(function (fromDest) {
|
||||
var absoluteDest = path.resolve(path.dirname(from), fromDest)
|
||||
// Treat absolute paths that are inside the tree we're
|
||||
// copying as relative. This necessary to properly support junctions
|
||||
// on windows (which are always absolute) but is also DWIM with symlinks.
|
||||
var relativeDest = path.relative(opts.top, absoluteDest)
|
||||
var linkFrom = relativeDest.substr(0, 2) === '..' ? fromDest : path.relative(path.dirname(from), absoluteDest)
|
||||
if (opts.isWindows) {
|
||||
return stat(absoluteDest).catch(function () { return null }).then(function (destStat) {
|
||||
var isDir = destStat && destStat.isDirectory()
|
||||
var type = isDir ? 'dir' : 'file'
|
||||
return symlink(linkFrom, to, type).catch(function (err) {
|
||||
if (type === 'dir') {
|
||||
return symlink(linkFrom, to, 'junction')
|
||||
} else {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
return symlink(linkFrom, to)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function copyFile (from, to, opts) {
|
||||
validate('SSO', [from, to, opts])
|
||||
var fs = opts.fs || nodeFs
|
||||
var writeStreamAtomic = opts.writeStreamAtomic || stockWriteStreamAtomic
|
||||
var Promise = opts.Promise || global.Promise
|
||||
var chmod = opts.chmod || promisify(Promise, fs.chmod)
|
||||
|
||||
var writeOpts = {}
|
||||
var getuid = opts.getuid || process.getuid
|
||||
if (getuid && opts.uid != null && getuid() === 0) {
|
||||
writeOpts.chown = {
|
||||
uid: opts.uid,
|
||||
gid: opts.gid
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var errored = false
|
||||
function onError (err) {
|
||||
errored = true
|
||||
reject(err)
|
||||
}
|
||||
fs.createReadStream(from)
|
||||
.once('error', onError)
|
||||
.pipe(writeStreamAtomic(to, writeOpts))
|
||||
.once('error', onError)
|
||||
.once('close', function () {
|
||||
if (errored) return
|
||||
if (opts.mode != null) {
|
||||
resolve(chmod(to, opts.mode))
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function eexists (from, to) {
|
||||
var err = new Error('Could not move ' + from + ' to ' + to + ': destination already exists.')
|
||||
err.code = 'EEXIST'
|
||||
return err
|
||||
}
|
||||
|
||||
function eunsupported (msg) {
|
||||
var err = new Error(msg)
|
||||
err.code = 'EUNSUPPORTED'
|
||||
return err
|
||||
}
|
2
node_modules/copy-concurrently/is-windows.js
generated
vendored
Normal file
2
node_modules/copy-concurrently/is-windows.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
'use strict'
|
||||
module.exports = process.platform === 'win32'
|
72
node_modules/copy-concurrently/package.json
generated
vendored
Normal file
72
node_modules/copy-concurrently/package.json
generated
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"_from": "copy-concurrently@^1.0.0",
|
||||
"_id": "copy-concurrently@1.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==",
|
||||
"_location": "/copy-concurrently",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "copy-concurrently@^1.0.0",
|
||||
"name": "copy-concurrently",
|
||||
"escapedName": "copy-concurrently",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/move-concurrently"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
|
||||
"_shasum": "92297398cae34937fcafd6ec8139c18051f0b5e0",
|
||||
"_spec": "copy-concurrently@^1.0.0",
|
||||
"_where": "/home/shimataro/projects/actions/ssh-key-action/node_modules/move-concurrently",
|
||||
"author": {
|
||||
"name": "Rebecca Turner",
|
||||
"email": "me@re-becca.org",
|
||||
"url": "http://re-becca.org/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/copy-concurrently/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"aproba": "^1.1.1",
|
||||
"fs-write-stream-atomic": "^1.0.8",
|
||||
"iferr": "^0.1.5",
|
||||
"mkdirp": "^0.5.1",
|
||||
"rimraf": "^2.5.4",
|
||||
"run-queue": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Promises of copies of files, directories and symlinks, with concurrency controls and win32 junction fallback.",
|
||||
"devDependencies": {
|
||||
"standard": "^8.6.0",
|
||||
"tacks": "^1.2.6",
|
||||
"tap": "^10.1.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"copy.js",
|
||||
"is-windows.js"
|
||||
],
|
||||
"homepage": "https://www.npmjs.com/package/copy-concurrently",
|
||||
"keywords": [
|
||||
"copy",
|
||||
"cpr"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "copy.js",
|
||||
"name": "copy-concurrently",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/copy-concurrently.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tap --coverage test"
|
||||
},
|
||||
"version": "1.0.5"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue