|
%!s(int64=2) %!d(string=hai) anos | |
---|---|---|
.. | ||
node_modules | %!s(int64=2) %!d(string=hai) anos | |
index.d.ts | %!s(int64=2) %!d(string=hai) anos | |
index.js | %!s(int64=2) %!d(string=hai) anos | |
license | %!s(int64=2) %!d(string=hai) anos | |
package.json | %!s(int64=2) %!d(string=hai) anos | |
readme.md | %!s(int64=2) %!d(string=hai) anos |
Write a
package.json
file
Writes atomically and creates directories for you as needed. Sorts dependencies when writing. Preserves the indentation if the file already exists.
$ npm install write-pkg
const path = require('path');
const writePackage = require('write-pkg');
(async () => {
await writePackage({foo: true});
console.log('done');
await writePackage(__dirname, {foo: true});
console.log('done');
await writePackage(path.join('unicorn', 'package.json'), {foo: true});
console.log('done');
})();
Returns a Promise
.
Type: string
Default: process.cwd()
Path to where the package.json
file should be written or its directory.
Type: object
Type: boolean
Default: true
Remove empty dependencies
, devDependencies
, optionalDependencies
and peerDependencies
objects.
package.json
fileMIT © Sindre Sorhus