package-json-flatten

0.6.0 • Public • Published

package-json-flatten

npm Version Build Status Dependency Status Coverage Status

Tools flatten package.json format.

Getting Started

Install to using npm.

$ npm install -g package-json-flatten

The package-json-flatten command should be available right now.

Here is an example of package.json.

{
  "name": "my-node-project",
  "version": "0.1.0",
  "description": "My Node.js Project",
  "scripts": {
    "test": "grunt"
  },
  "dependencies": {
    "express": "*"
  },
  "main": "index.js",
  "homepage": "http://www.example.com/",
  "author": "Ryuichi Okumura <okuryu@okuryu.com>",
  "repository": {
    "type": "git",
    "url": "http://www.example.com/"
  },
  "devDependencies": {
    "jshint": "*"
  }
}

Run package-json-flatten command.

$ package-json-flatten

It finds the package.json file in the current directory in default and reformat it based on order the npm official package.json reference.

{
  "name": "my-node-project",
  "version": "0.1.0",
  "description": "My Node.js Project",
  "homepage": "http://www.example.com/",
  "author": "Ryuichi Okumura <okuryu@okuryu.com>",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "http://www.example.com/"
  },
  "scripts": {
    "test": "grunt"
  },
  "dependencies": {
    "express": "*"
  },
  "devDependencies": {
    "jshint": "*"
  }
}

Options

-f, --file [file]

An option to pass a path to package.json. It read the package.json in the current directory in default.

$ package-json-flatten -f src/package.json

-i, --indent [indent]

An option to change an indent style of the package.json. It detects indent style from the package.json and use it, or use default indent style 4 whitespace.

$ package-json-flatten -i '  '

Contributing

See the CONTRIBUTING.md.

Author

License

package-json-flatten is licensed under the BSD license.

Dependencies (2)

Dev Dependencies (11)

Package Sidebar

Install

npm i package-json-flatten

Weekly Downloads

2

Version

0.6.0

License

BSD-3-Clause

Last publish

Collaborators

  • okuryu