mirror of
https://github.com/actions/setup-node.git
synced 2025-06-29 06:03:50 +00:00
.
This commit is contained in:
parent
9fff29ba6c
commit
00c3b50fca
7278 changed files with 0 additions and 1778943 deletions
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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue