mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 05:14:44 +00:00
.
This commit is contained in:
parent
a004f0ae58
commit
fc725ba36b
7280 changed files with 19 additions and 1796407 deletions
67
node_modules/read-pkg/index.d.ts
generated
vendored
67
node_modules/read-pkg/index.d.ts
generated
vendored
|
@ -1,67 +0,0 @@
|
|||
import * as typeFest from 'type-fest';
|
||||
import normalize = require('normalize-package-data');
|
||||
|
||||
declare namespace readPkg {
|
||||
interface Options {
|
||||
/**
|
||||
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly normalize?: boolean;
|
||||
|
||||
/**
|
||||
Current working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
}
|
||||
|
||||
interface NormalizeOptions extends Options {
|
||||
readonly normalize?: true;
|
||||
}
|
||||
|
||||
type NormalizedPackageJson = PackageJson & normalize.Package;
|
||||
type PackageJson = typeFest.PackageJson;
|
||||
}
|
||||
|
||||
declare const readPkg: {
|
||||
/**
|
||||
@returns The parsed JSON.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkg = require('read-pkg');
|
||||
|
||||
(async () => {
|
||||
console.log(await readPkg());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(await readPkg({cwd: 'some-other-directory'});
|
||||
//=> {name: 'unicorn', …}
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(options?: readPkg.NormalizeOptions): Promise<readPkg.NormalizedPackageJson>;
|
||||
(options: readPkg.Options): Promise<readPkg.PackageJson>;
|
||||
|
||||
/**
|
||||
@returns The parsed JSON.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkg = require('read-pkg');
|
||||
|
||||
console.log(readPkg.sync());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(readPkg.sync({cwd: 'some-other-directory'});
|
||||
//=> {name: 'unicorn', …}
|
||||
```
|
||||
*/
|
||||
sync(options?: readPkg.NormalizeOptions): readPkg.NormalizedPackageJson;
|
||||
sync(options: readPkg.Options): readPkg.PackageJson;
|
||||
};
|
||||
|
||||
export = readPkg;
|
41
node_modules/read-pkg/index.js
generated
vendored
41
node_modules/read-pkg/index.js
generated
vendored
|
@ -1,41 +0,0 @@
|
|||
'use strict';
|
||||
const {promisify} = require('util');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const parseJson = require('parse-json');
|
||||
|
||||
const readFileAsync = promisify(fs.readFile);
|
||||
|
||||
module.exports = async options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
normalize: true,
|
||||
...options
|
||||
};
|
||||
|
||||
const filePath = path.resolve(options.cwd, 'package.json');
|
||||
const json = parseJson(await readFileAsync(filePath, 'utf8'));
|
||||
|
||||
if (options.normalize) {
|
||||
require('normalize-package-data')(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
module.exports.sync = options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
normalize: true,
|
||||
...options
|
||||
};
|
||||
|
||||
const filePath = path.resolve(options.cwd, 'package.json');
|
||||
const json = parseJson(fs.readFileSync(filePath, 'utf8'));
|
||||
|
||||
if (options.normalize) {
|
||||
require('normalize-package-data')(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
9
node_modules/read-pkg/license
generated
vendored
9
node_modules/read-pkg/license
generated
vendored
|
@ -1,9 +0,0 @@
|
|||
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.
|
85
node_modules/read-pkg/package.json
generated
vendored
85
node_modules/read-pkg/package.json
generated
vendored
|
@ -1,85 +0,0 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"read-pkg@5.1.1",
|
||||
"/Users/eric/repos/actions/setup-node"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "read-pkg@5.1.1",
|
||||
"_id": "read-pkg@5.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-dFcTLQi6BZ+aFUaICg7er+/usEoqFdQxiEBsEMNGoipenihtxxtdrQuBXvyANCEI8VuUIVYFgeHGx9sLLvim4w==",
|
||||
"_location": "/read-pkg",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "read-pkg@5.1.1",
|
||||
"name": "read-pkg",
|
||||
"escapedName": "read-pkg",
|
||||
"rawSpec": "5.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/husky"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.1.1.tgz",
|
||||
"_spec": "5.1.1",
|
||||
"_where": "/Users/eric/repos/actions/setup-node",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/read-pkg/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/normalize-package-data": "^2.4.0",
|
||||
"normalize-package-data": "^2.5.0",
|
||||
"parse-json": "^4.0.0",
|
||||
"type-fest": "^0.4.1"
|
||||
},
|
||||
"description": "Read a package.json file",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/read-pkg#readme",
|
||||
"keywords": [
|
||||
"json",
|
||||
"read",
|
||||
"parse",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"load",
|
||||
"package",
|
||||
"normalize"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "read-pkg",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/read-pkg.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "5.1.1",
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test/test.js"
|
||||
]
|
||||
}
|
||||
}
|
73
node_modules/read-pkg/readme.md
generated
vendored
73
node_modules/read-pkg/readme.md
generated
vendored
|
@ -1,73 +0,0 @@
|
|||
# read-pkg [](https://travis-ci.org/sindresorhus/read-pkg)
|
||||
|
||||
> Read a package.json file
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
|
||||
- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
|
||||
- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install read-pkg
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const readPkg = require('read-pkg');
|
||||
|
||||
(async () => {
|
||||
console.log(await readPkg());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(await readPkg({cwd: 'some-other-directory'});
|
||||
//=> {name: 'unicorn', …}
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### readPkg([options])
|
||||
|
||||
Returns a `Promise<object>` with the parsed JSON.
|
||||
|
||||
### readPkg.sync([options])
|
||||
|
||||
Returns the parsed JSON.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory.
|
||||
|
||||
##### normalize
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
|
||||
- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file
|
||||
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Loading…
Add table
Add a link
Reference in a new issue