{"id":16471847,"url":"https://github.com/abranhe/init-pkg-json","last_synced_at":"2025-10-27T14:30:54.526Z","repository":{"id":57273927,"uuid":"143386045","full_name":"abranhe/init-pkg-json","owner":"abranhe","description":"📦 Complex generator of Package.json ","archived":false,"fork":false,"pushed_at":"2022-12-21T02:02:16.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-08T09:34:02.030Z","etag":null,"topics":["generator","init","initers","json","package-json"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abranhe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-03T06:16:52.000Z","updated_at":"2020-09-08T19:03:19.000Z","dependencies_parsed_at":"2023-01-30T02:31:22.432Z","dependency_job_id":null,"html_url":"https://github.com/abranhe/init-pkg-json","commit_stats":null,"previous_names":["abranhe/init-pkg-json","abrahamhba/init-pkg-json"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abranhe%2Finit-pkg-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abranhe%2Finit-pkg-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abranhe%2Finit-pkg-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abranhe%2Finit-pkg-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abranhe","download_url":"https://codeload.github.com/abranhe/init-pkg-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861094,"owners_count":16556007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","init","initers","json","package-json"],"created_at":"2024-10-11T12:14:58.226Z","updated_at":"2025-10-27T14:30:54.183Z","avatar_url":"https://github.com/abranhe.png","language":"JavaScript","readme":"\u003cp align=\"center\" id=\"top\"\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/init-pkg-json\"\u003e\u003cimg src=\"https://cdn.abraham.gq/projects/init-pkg-json/logo.png\" width=\"300\"\u003e\u003c/a\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/init-pkg-json\"\u003e\u003cb\u003einit-pkg-json\u003c/b\u003e\u003c/a\u003e\n\t: Complex generator of Package.json\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://travis-ci.org/abranhe/init-pkg-json\"\u003e\u003cimg src=\"https://img.shields.io/travis/abranhe/init-pkg-json.svg?logo=travis\" /\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/abranhe/init-pkg-json/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/abranhe/init-pkg-json.svg\" /\u003e\u003c/a\u003e\n\t\u003ca href=\"https://travis-ci.org/abranhe/init-pkg-json\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/init-pkg-json.svg\" /\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/abranhe\"\u003e\u003cimg src=\"https://abranhe.com/badge.svg\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://cash.me/$abranhe\"\u003e\u003cimg src=\"https://cdn.abraham.gq/badges/cash-me.svg\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://www.patreon.com/abranhe\"\u003e\u003cimg src=\"https://cdn.abraham.gq/badges/patreon.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# See\n\n- [Overview](#overview)\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [Related](#related)\n- [Team](#team)\n- [License](#license)\n\n# Overview\n\n**Package.json** is the the [*npm*](https://npmjs.com) or [*yarn*](https://yarnpkg.com) root of the project. This file holds various metadata relevant to the project. This file is used to give information that allows it to identify the project as well as handle the project's dependencies\n\n[`init-pkg-json`](https://github.com/abranhe/init-pkg-json) allows you create and easily customize package.json files. We are based on the [yarn](https://yarnpkg.com/lang/en/docs/package-json/) and [npm](https://docs.npmjs.com/files/package.json) documentation for the package.json configuration.\n\n# Install\n\n```\n$ npm install init-pkg-json\n```\n\n# Usage\n\n## Essentials\n\nThe two most important fields in your `package.json` are `name` and `version`,\nwithout them your package won't be able to install. The `name` and `version`\nfields are used together to create a unique id.\n\n###  `name` and `version`\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.init('awesome-package', '1.0.0');\n```\n\n### Result in JSON\n\n```json\n{\n  \"name\": \"awesome-package\",\n  \"version\": \"1.0.0\"\n}\n```\n\n## Info\n\n### `description`\n\nThe description is just a string that helps people understand the purpose of the package. It can be used when searching for packages in a package manager as well.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.description('My short description of my awesome package');\n```\n\n### Result in JSON\n\n```json\n{\n  \"description\": \"My short description of my awesome package\"\n}\n```\n\n### `keywords`\n\nKeywords are an array of strings that are useful when searching for packages in a package manager.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.keywords([\n\t'short',\n\t'relevant',\n\t'keywords',\n\t'for',\n\t'searching'\n]);\n```\n\n### Result in JSON\n\n```json\n{\n  \"keywords\": [\"short\", \"relevant\", \"keywords\", \"for\", \"searching\"]\n}\n```\n\n### `license`\n\nAll packages should specify a license so that users know how they are permitted to use it and any restrictions that you are placing on it.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.license('MIT');\n```\n\n### Result in JSON\n\n```json\n{\n  \"license\": \"MIT\"\n}\n```\n\n\n## Links\n\nVarious links to documentation, places to file issues and where your package code actually lives.\n\n### `homepage`\n\nThe homepage is the URL to the landing page or documentation for your package.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.homepage('https://your-package.org');\n```\n\n### Result in JSON\n\n```json\n{\n  \"homepage\": \"https://your-package.org\"\n}\n```\n\n### `bugs`\n\nThe URL to your project's issue tracker. This can also be something like an email address as well. It provides users a way to find out where to send issues with your package.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.bugs('https://github.com/user/repo/issues');\n```\n\n### Result in JSON\n\n```json\n{\n  \"bugs\": \"https://github.com/user/repo/issues\"\n}\n```\n\n### `repository`\n\nThe repository is the location where the actual code for your package lives.\n\n```js\nconst pkg = require('init-pkg-json');\n\n// Make sure the url is the first parameter\npkg.repository('https://github.com/an-amazing-user/amazing-package/', 'git');\n```\n\n### Result in JSON\n\n```json\n{\n  \"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/user/repo.git\"\n\t}\n}\n```\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.repository('github:user/repo');\n```\n\n### Result in JSON\n\n```json\n{\n  \"repository\": \"github:user/repo\"\n}\n```\n\n## Maintainers\n\nThe maintainers of your project.\n\n### `author`\n\nPackage author information. An author is one person.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.author('Your Name \u003cyou@example.com\u003e (http://your-website.com)');\n```\n\n### Result in JSON\n\n```json\n{\n\t\"author\": \"Your Name \u003cyou@example.com\u003e (http://your-website.com)\"\n}\n```\n\nand:\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.author('Your Name', 'you@example.com', 'http://your-website.com');\n```\n\n### Result in JSON\n\n```json\n{\n  \"author\": {\n\t\t\"name\": \"Your Name\",\n\t\t\"email\": \"you@example.com\",\n\t\t\"url\": \"http://your-website.com\"\n\t}\n}\n```\n\n### `contributors`\n\nThose that have contributed to your package. Contributors are an array of people.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.contributors([{\n\tname: 'Your Friend',\n\temail: 'friend@example.com',\n\turl: 'http://friends-website.com',\n},{\n\tname: 'Other Friend',\n\temail: 'other@example.com',\n\turl: 'http://other-website.com',\n}]);\n```\n\n### Result in JSON\n\n```json\n{\n  \"contributors\": [\n    { \"name\": \"Your Friend\", \"email\": \"friend@example.com\", \"url\": \"http://friends-website.com\" }\n    { \"name\": \"Other Friend\", \"email\": \"other@example.com\", \"url\": \"http://other-website.com\" }\n  ],\n}\n```\n\nor just:\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.contributors(['Your Friend \u003cfriend@example.com\u003e (http://friends-website.com)',\n'Other Friend \u003cother@example.com\u003e (http://other-website.com)']);\n```\n\n### Result in JSON\n\n```json\n{\n\t\"contributors\": [\n\t\t\"Your Friend \u003cfriend@example.com\u003e (http://friends-website.com)\",\n\t\t\"Other Friend \u003cother@example.com\u003e (http://other-website.com)\"\n\t]\n}\n```\n## Files\n\nYou can specify files that will be included in your project, along with the main entry point for your project.\n\n### `files`\n\nThese are files that are included in your project. You can specify single files, whole directories or use wildcards to include files that meet a certain criteria.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.files(['filename.js', 'directory/', 'glob/*.{js.json}']);\n```\n\n### Result in JSON\n\n```json\n{\n  \"files\": [\n    \"filename.js\",\n    \"directory/\",\n    \"glob/*.{js,json}\"\n  ]\n}\n```\n\n### `main`\n\nThis is the primary entry point for the functionality for your project.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.main('filename.js');\n```\n\n### Result in JSON\n\n```json\n{\n  \"main\": \"filename.js\"\n}\n```\n\n### `bin`\n\nExecutable files included with your project that will be installed.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.bin('bin.js');\n```\n\n### Result in JSON\n\n```json\n{\n  \"bin\": \"bin.js\"\n}\n```\n\nor:\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.bin({\n\t'command-name': 'bin/command-name.js',\n\t'other-command': 'bin/other-command'\n});\n```\n\n### Result in JSON\n\n```json\n{\n\t\"bin\": {\n    \"command-name\": \"bin/command-name.js\",\n    \"other-command\": \"bin/other-command\"\n  }\n}\n```\n\n### `man`\n\nIf you have man pages associated with your project, add them here.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.man([\n\t'./man/doc.1', './man/doc.2'\n]);\n```\n\n### Result in JSON\n\n```json\n{\n  \"man\": [\"./man/doc.1\", \"./man/doc.2\"]\n}\n```\n\n### `directories`\n\nWhen installing your package, you can specify exact locations to put binary files, man pages, documentation, examples, etc.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.directories({\n\t'lib': 'path/to/lib/',\n\t'bin': 'path/to/bin/',\n\t'man': 'path/to/man/',\n\t'doc': 'path/to/doc/',\n\t'example': 'path/to/example/'\n});\n```\n\n### Result in JSON\n\n```json\n{\n  \"directories\": {\n    \"lib\": \"path/to/lib/\",\n    \"bin\": \"path/to/bin/\",\n    \"man\": \"path/to/man/\",\n    \"doc\": \"path/to/doc/\",\n    \"example\": \"path/to/example/\"\n  }\n}\n```\n\n## Tasks\n\nYour package can include runnable scripts or other configuration.\n\n### `scripts`\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.scripts({\n\t'build-project': 'node build-project.js'\n});\n```\n\n### Result in JSON\n\n```json\n{\n  \"scripts\": {\n    \"build-project\": \"node build-project.js\"\n  }\n}\n```\n\nRead more at: [npm docs](https://docs.npmjs.com/misc/scripts).\n\n### `config`\n\nConfiguration options or parameters used in your scripts.\n\n```js\nconst pkg = require('init-pkg-json');\n\npkg.config({\n\t'port': '8080'\n});\n```\n\n### Result in JSON\n\n```json\n{\n  \"config\": {\n    \"port\": \"8080\"\n  }\n}\n```\n\n## Dependencies\n\nYour package will very likely depend on other packages. You can specify those dependencies in your `package.json` file.\n\n### `dependencies`\n\n```json\n{\n  \"dependencies\": {\n    \"package-1\": \"^3.1.4\"\n  }\n}\n```\n\nThese are dependencies that are required in both development and production for your package.\n\n\u003e You can specify an exact version, a minimum version (e.g., `\u003e=`) or a range of versions (e.g. `\u003e= ... \u003c`).\n\n### `devDependencies`\n\n```json\n{\n  \"devDependencies\": {\n    \"package-2\": \"^0.4.2\"\n  }\n}\n```\n\nThese are packages that are only required when developing your package but will not be installed in production.\n\n### `peerDependencies`\n\n```json\n{\n  \"peerDependencies\": {\n    \"package-3\": \"^2.7.18\"\n  }\n}\n```\n\nPeer dependencies allow you to state compatibility of your package with versions of other packages.\n\n### `optionalDependencies`\n\n```json\n{\n  \"optionalDependencies\": {\n    \"package-5\": \"^1.6.1\"\n  }\n}\n```\n\nOptional dependencies can be used with your package, but are not required. If the optional package is not found, installation still continues.\n\n### `bundledDependencies`\n\n```json\n{\n  \"bundledDependencies\": [\n    \"package-4\"\n  ]\n}\n```\n\nBundled dependencies are an array of package names that will be bundled together when publishing your package.\n\n## System\n\nYou can provide system-level information associated with your package, such as operating system compatibility, etc.\n\n### `engines`\n\n```json\n{\n  \"engines\": {\n    \"node\": \"\u003e=4.4.7 \u003c7.0.0\",\n    \"zlib\": \"^1.2.8\",\n    \"yarn\": \"^0.14.0\"\n  }\n}\n```\n\nThe engines specify versions of clients that must be used with your package. This checks against `process.versions` as well as the current version of yarn.\n\n### `os`\n\n```json\n{\n  \"os\": [\"darwin\", \"linux\"],\n  \"os\": [\"!win32\"]\n}\n```\n\nThis specifies operating system compatibility for your package. It checks against `process.platform`.\n\n### `cpu`\n\n```json\n{\n  \"cpu\": [\"x64\", \"ia32\"],\n  \"cpu\": [\"!arm\", \"!mips\"]\n}\n```\n\nUse this to specify your package will only run on certain CPU architectures. This checks against `process.arch`.\n\n## Publishing\n\n### `private`\n\n```json\n{\n  \"private\": true\n}\n```\n\nIf you do not want your package published in a package manager, set this to `true`.\n\n### `publishConfig`\n\n```json\n{\n  \"publishConfig\": {\n    \"...\"\n  }\n}\n```\n\nThese configuration values will be used when publishing your package. You can tag your package, for example.\n\n\n# API\n\n**indentation(size)**\n\n\u003e Set the indentation size in package.json file\n\n**init(name, version)**\n\n\u003e Init package.json with name and version\n\n**description(description)**\n\n\u003e Add description to package.json\n\n**keywords([keywords])**\n\n\u003e Add keywords to package.json\n\n**license(license)**\n\n\u003e Add license to package.json\n\n**homepage(link)**\n\n\u003e Add homepage to package.json\n\n**bugs(link)**\n\n\u003e Add bugs link to package.json\n\n**repository(link)**\n\n\u003e Add repository to package.json\n\n**repository(link, type)**\n\n\u003e Add repository and type to package.json\n\n**autor(author)**\n\n\u003e Add author to package.json\n\n**autor(name, email, website)**\n\n\u003e Add author name, email and website to package.json\n\n**contributors([contributors])**\n\n\u003e Add contributors to package.json\n\n**files([files])**\n\n\u003e Add files to package.json\n\n**main(main)**\n\n\u003e Add main to package.json\n\n**man([manuals])**\n\n\u003e Add manuals to package.json\n\n**dir({directories})**\n\n\u003e Add directories to package.json\n\n**scripts({scripts})**\n\n\u003e Add scripts to package.json\n\n**config({config})**\n\n\u003e Add config to package.json\n\n**dependencies({dependencies})**\n\n\u003e Add dependencies to package.json\n\n**devDependencies({devDependencies})**\n\n\u003e Add devDependencies to package.json\n\n**peerDependencies({peerDependencies})**\n\n\u003e Add peerDependencies to package.json\n\n**optionalDependencies({optionalDependencies})**\n\n\u003e Add optionalDependencies to package.json\n\n**bundledDependencies({bundledDependencies})**\n\n\u003e Add bundledDependencies to package.json\n\n**flat(stringBoolean)**\n\n\u003e Add flat to package.json\n\n**resolutions({resolutions})**\n\n\u003e Add resolutions to package.json\n\n**engines({engines})**\n\n\u003e Add engines to package.json\n\n**os([os])**\n\n\u003e Add operating systems to package.json\n\n**cpu([cpu])**\n\n\u003e Add cpu to package.json\n\n**private(stringBoolean)**\n\n\u003e Add privacy to package.json\n\n**publishConfig({config})**\n\n\u003e Add publish config to package.json\n\n# Related\n\n-  [init-pkg-json-cli](https://github.com/abranhe/init-pkg-json-cli): CLI for this module.\n\n# Team\n\n|[![Carlos Abraham Logo](https://avatars3.githubusercontent.com/u/21347264?s=50\u0026v=4)](https://19cah.com)|\n| :-: |\n| [Carlos Abraham](https://github.com/abranhe) |\n\n# License\n\n[MIT](https://github.com/abranhe/init-pkg-json/blob/master/LICENSE) License © [Carlos Abraham](https://github.com/abranhe/)\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"#top\"\u003e\u003cimg src=\"https://cdn.abraham.gq/projects/init-pkg-json/logo.png\" width=\"30\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n","funding_links":["https://www.patreon.com/abranhe"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabranhe%2Finit-pkg-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabranhe%2Finit-pkg-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabranhe%2Finit-pkg-json/lists"}