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
85
node_modules/make-dir/index.js
generated
vendored
Normal file
85
node_modules/make-dir/index.js
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const pify = require('pify');
|
||||
|
||||
const defaults = {
|
||||
mode: 0o777 & (~process.umask()),
|
||||
fs
|
||||
};
|
||||
|
||||
// https://github.com/nodejs/node/issues/8987
|
||||
// https://github.com/libuv/libuv/pull/1088
|
||||
const checkPath = pth => {
|
||||
if (process.platform === 'win32') {
|
||||
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''));
|
||||
|
||||
if (pathHasInvalidWinCharacters) {
|
||||
const err = new Error(`Path contains invalid characters: ${pth}`);
|
||||
err.code = 'EINVAL';
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = (input, opts) => Promise.resolve().then(() => {
|
||||
checkPath(input);
|
||||
opts = Object.assign({}, defaults, opts);
|
||||
|
||||
const mkdir = pify(opts.fs.mkdir);
|
||||
const stat = pify(opts.fs.stat);
|
||||
|
||||
const make = pth => {
|
||||
return mkdir(pth, opts.mode)
|
||||
.then(() => pth)
|
||||
.catch(err => {
|
||||
if (err.code === 'ENOENT') {
|
||||
if (err.message.includes('null bytes') || path.dirname(pth) === pth) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
return make(path.dirname(pth)).then(() => make(pth));
|
||||
}
|
||||
|
||||
return stat(pth)
|
||||
.then(stats => stats.isDirectory() ? pth : Promise.reject())
|
||||
.catch(() => {
|
||||
throw err;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return make(path.resolve(input));
|
||||
});
|
||||
|
||||
module.exports.sync = (input, opts) => {
|
||||
checkPath(input);
|
||||
opts = Object.assign({}, defaults, opts);
|
||||
|
||||
const make = pth => {
|
||||
try {
|
||||
opts.fs.mkdirSync(pth, opts.mode);
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
if (err.message.includes('null bytes') || path.dirname(pth) === pth) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
make(path.dirname(pth));
|
||||
return make(pth);
|
||||
}
|
||||
|
||||
try {
|
||||
if (!opts.fs.statSync(pth).isDirectory()) {
|
||||
throw new Error('The path is not a directory');
|
||||
}
|
||||
} catch (_) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
return pth;
|
||||
};
|
||||
|
||||
return make(path.resolve(input));
|
||||
};
|
9
node_modules/make-dir/license
generated
vendored
Normal file
9
node_modules/make-dir/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
86
node_modules/make-dir/package.json
generated
vendored
Normal file
86
node_modules/make-dir/package.json
generated
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"_from": "make-dir@^1.0.0",
|
||||
"_id": "make-dir@1.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
|
||||
"_location": "/make-dir",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "make-dir@^1.0.0",
|
||||
"name": "make-dir",
|
||||
"escapedName": "make-dir",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/configstore"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
|
||||
"_shasum": "79c1033b80515bd6d24ec9933e860ca75ee27f0c",
|
||||
"_spec": "make-dir@^1.0.0",
|
||||
"_where": "/home/shimataro/projects/actions/ssh-key-action/node_modules/configstore",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/make-dir/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"pify": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Make a directory and its parents if needed - Think `mkdir -p`",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"codecov": "^3.0.0",
|
||||
"graceful-fs": "^4.1.11",
|
||||
"nyc": "^11.3.0",
|
||||
"path-type": "^3.0.0",
|
||||
"tempy": "^0.2.1",
|
||||
"xo": "^0.20.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/make-dir#readme",
|
||||
"keywords": [
|
||||
"mkdir",
|
||||
"mkdirp",
|
||||
"make",
|
||||
"directories",
|
||||
"dir",
|
||||
"dirs",
|
||||
"folders",
|
||||
"directory",
|
||||
"folder",
|
||||
"path",
|
||||
"parent",
|
||||
"parents",
|
||||
"intermediate",
|
||||
"recursively",
|
||||
"recursive",
|
||||
"create",
|
||||
"fs",
|
||||
"filesystem",
|
||||
"file-system"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "make-dir",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/make-dir.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"version": "1.3.0"
|
||||
}
|
116
node_modules/make-dir/readme.md
generated
vendored
Normal file
116
node_modules/make-dir/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
# make-dir [](https://travis-ci.org/sindresorhus/make-dir) [](https://ci.appveyor.com/project/sindresorhus/make-dir/branch/master) [](https://codecov.io/gh/sindresorhus/make-dir)
|
||||
|
||||
> Make a directory and its parents if needed - Think `mkdir -p`
|
||||
|
||||
|
||||
## Advantages over [`mkdirp`](https://github.com/substack/node-mkdirp)
|
||||
|
||||
- Promise API *(Async/await ready!)*
|
||||
- Fixes many `mkdirp` issues: [#96](https://github.com/substack/node-mkdirp/pull/96) [#70](https://github.com/substack/node-mkdirp/issues/70) [#66](https://github.com/substack/node-mkdirp/issues/66)
|
||||
- 100% test coverage
|
||||
- CI-tested on macOS, Linux, and Windows
|
||||
- Actively maintained
|
||||
- Doesn't bundle a CLI
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install make-dir
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/Users/sindresorhus/fun
|
||||
$ tree
|
||||
.
|
||||
```
|
||||
|
||||
```js
|
||||
const makeDir = require('make-dir');
|
||||
|
||||
makeDir('unicorn/rainbow/cake').then(path => {
|
||||
console.log(path);
|
||||
//=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'
|
||||
});
|
||||
```
|
||||
|
||||
```
|
||||
$ tree
|
||||
.
|
||||
└── unicorn
|
||||
└── rainbow
|
||||
└── cake
|
||||
```
|
||||
|
||||
Multiple directories:
|
||||
|
||||
```js
|
||||
const makeDir = require('make-dir');
|
||||
|
||||
Promise.all([
|
||||
makeDir('unicorn/rainbow')
|
||||
makeDir('foo/bar')
|
||||
]).then(paths => {
|
||||
console.log(paths);
|
||||
/*
|
||||
[
|
||||
'/Users/sindresorhus/fun/unicorn/rainbow',
|
||||
'/Users/sindresorhus/fun/foo/bar'
|
||||
]
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### makeDir(path, [options])
|
||||
|
||||
Returns a `Promise` for the path to the created directory.
|
||||
|
||||
### makeDir.sync(path, [options])
|
||||
|
||||
Returns the path to the created directory.
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
Directory to create.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### mode
|
||||
|
||||
Type: `integer`<br>
|
||||
Default: `0o777 & (~process.umask())`
|
||||
|
||||
Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).
|
||||
|
||||
##### fs
|
||||
|
||||
Type: `Object`<br>
|
||||
Default: `require('fs')`
|
||||
|
||||
Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module
|
||||
- [del](https://github.com/sindresorhus/del) - Delete files and directories
|
||||
- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching
|
||||
- [cpy](https://github.com/sindresorhus/cpy) - Copy files
|
||||
- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line
|
||||
- [move-file](https://github.com/sindresorhus/move-file) - Move a file
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Loading…
Add table
Add a link
Reference in a new issue