write-pkg
Advanced tools
Comparing version 1.0.0 to 2.0.0
11
index.js
'use strict'; | ||
var path = require('path'); | ||
var writeJsonFile = require('write-json-file'); | ||
var opts = {indent: 2}; | ||
const path = require('path'); | ||
const writeJsonFile = require('write-json-file'); | ||
module.exports = function (fp, data) { | ||
const opts = {indent: 2}; | ||
module.exports = (fp, data) => { | ||
if (typeof fp !== 'string') { | ||
@@ -17,3 +18,3 @@ data = fp; | ||
module.exports.sync = function (fp, data) { | ||
module.exports.sync = (fp, data) => { | ||
if (typeof fp !== 'string') { | ||
@@ -20,0 +21,0 @@ data = fp; |
{ | ||
"name": "write-pkg", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Write a package.json file", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4" | ||
}, | ||
@@ -33,10 +33,13 @@ "scripts": { | ||
"dependencies": { | ||
"write-json-file": "^1.1.0" | ||
"write-json-file": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"read-pkg": "^1.0.0", | ||
"read-pkg": "^2.0.0", | ||
"tempfile": "^1.1.1", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
} |
@@ -18,14 +18,14 @@ # write-pkg [![Build Status](https://travis-ci.org/sindresorhus/write-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/write-pkg) | ||
```js | ||
var path = require('path'); | ||
var writePkg = require('write-pkg'); | ||
const path = require('path'); | ||
const writePkg = require('write-pkg'); | ||
writePkg({foo: true}).then(function () { | ||
writePkg({foo: true}).then(() => { | ||
console.log('done'); | ||
}); | ||
writePkg(__dirname, {foo: true}).then(function () { | ||
writePkg(__dirname, {foo: true}).then(() => { | ||
console.log('done'); | ||
}); | ||
writePkg(path.join('unicorn', 'package.json'), {foo: true}).then(function () { | ||
writePkg(path.join('unicorn', 'package.json'), {foo: true}).then(() => { | ||
console.log('done'); | ||
@@ -40,10 +40,10 @@ }); | ||
Returns a promise. | ||
Returns a `Promise`. | ||
### readPkg.sync([path], data) | ||
### writePkg.sync([path], data) | ||
#### path | ||
Type: `string` | ||
Default: `.` | ||
Type: `string`<br> | ||
Default: `process.cwd()` | ||
@@ -61,2 +61,2 @@ Path to where the `package.json` file should be written or its directory. | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
3507
+ Addeddetect-indent@5.0.0(transitive)
+ Addedmake-dir@1.3.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsort-keys@2.0.0(transitive)
+ Addedwrite-file-atomic@2.4.3(transitive)
+ Addedwrite-json-file@2.3.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedslide@1.1.6(transitive)
- Removedsort-keys@1.1.2(transitive)
- Removedwrite-file-atomic@1.3.4(transitive)
- Removedwrite-json-file@1.2.0(transitive)
Updatedwrite-json-file@^2.0.0