Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -1,10 +1,9 @@
'use strict';
var path = require('path');
var loadJsonFile = require('load-json-file');
var normalizePackageData = require('normalize-package-data');
var pathType = require('path-type');
const path = require('path');
const loadJsonFile = require('load-json-file');
const pathType = require('path-type');
module.exports = function (fp, opts) {
module.exports = (fp, opts) => {
if (typeof fp !== 'string') {
opts = fp;
fp = '.';
@@ -13,23 +12,23 @@ module.exports = function (fp, opts) {
opts = opts || {};
return pathType.dir(fp)
.then(function (isDir) {
.then(isDir => {
if (isDir) {
fp = path.join(fp, 'package.json');
}
return loadJsonFile(fp);
})
.then(function (x) {
.then(x => {
if (opts.normalize !== false) {
normalizePackageData(x);
require('normalize-package-data')(x);
}
return x;
});
};
module.exports.sync = function (fp, opts) {
module.exports.sync = (fp, opts) => {
if (typeof fp !== 'string') {
opts = fp;
fp = '.';
@@ -38,10 +37,10 @@ module.exports.sync = function (fp, opts) {
opts = opts || {};
fp = pathType.dirSync(fp) ? path.join(fp, 'package.json') : fp;
var x = loadJsonFile.sync(fp);
const x = loadJsonFile.sync(fp);
if (opts.normalize !== false) {
normalizePackageData(x);
require('normalize-package-data')(x);
}
return x;

View File

@@ -1,31 +1,31 @@
{
"_args": [
[
"read-pkg@1.1.0",
"read-pkg@2.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "read-pkg@1.1.0",
"_id": "read-pkg@1.1.0",
"_from": "read-pkg@2.0.0",
"_id": "read-pkg@2.0.0",
"_inBundle": false,
"_integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
"_integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
"_location": "/react-scripts/read-pkg",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "read-pkg@1.1.0",
"raw": "read-pkg@2.0.0",
"name": "read-pkg",
"escapedName": "read-pkg",
"rawSpec": "1.1.0",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "1.1.0"
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/react-scripts/read-pkg-up"
],
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"_spec": "1.1.0",
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -36,9 +36,9 @@
"url": "https://github.com/sindresorhus/read-pkg/issues"
},
"dependencies": {
"load-json-file": "^1.0.0",
"load-json-file": "^2.0.0",
"normalize-package-data": "^2.3.2",
"path-type": "^1.0.0"
"path-type": "^2.0.0"
},
"description": "Read a package.json file",
"devDependencies": {
@@ -46,7 +46,7 @@
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
@@ -73,5 +73,8 @@
"scripts": {
"test": "xo && ava"
},
"version": "1.1.0"
"version": "2.0.0",
"xo": {
"esnext": true
}
}

View File

@@ -21,19 +21,19 @@ $ npm install --save read-pkg
## Usage
```js
var readPkg = require('read-pkg');
const readPkg = require('read-pkg');
readPkg().then(function (pkg) {
readPkg().then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(__dirname).then(function (pkg) {
readPkg(__dirname).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(path.join('unicorn', 'package.json')).then(function (pkg) {
readPkg(path.join('unicorn', 'package.json')).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
@@ -44,7 +44,7 @@ readPkg(path.join('unicorn', 'package.json')).then(function (pkg) {
### readPkg([path], [options])
Returns a promise that resolves to the parsed JSON.
Returns a `Promise` for the parsed JSON.
### readPkg.sync([path], [options])
@@ -52,7 +52,7 @@ Returns the parsed JSON.
#### path
Type: `string`
Type: `string`<br>
Default: `.`
Path to a `package.json` file or its directory.
@@ -61,7 +61,7 @@ Path to a `package.json` file or its directory.
##### normalize
Type: `boolean`
Type: `boolean`<br>
Default: `true`
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
@@ -76,4 +76,4 @@ Default: `true`
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)