{"id":16618364,"url":"https://github.com/andreasonny83/package-json-from-template","last_synced_at":"2026-05-08T05:50:18.168Z","repository":{"id":57317695,"uuid":"112768050","full_name":"andreasonny83/package-json-from-template","owner":"andreasonny83","description":"Generate new package.json file from a template","archived":false,"fork":false,"pushed_at":"2018-06-11T19:10:54.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T10:40:49.238Z","etag":null,"topics":["cli","cli-app","cli-tool","json","npm","package","package-json","pkg"],"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/andreasonny83.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":"2017-12-01T17:30:23.000Z","updated_at":"2019-05-04T06:25:08.000Z","dependencies_parsed_at":"2022-08-25T21:12:03.357Z","dependency_job_id":null,"html_url":"https://github.com/andreasonny83/package-json-from-template","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasonny83%2Fpackage-json-from-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasonny83%2Fpackage-json-from-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasonny83%2Fpackage-json-from-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasonny83%2Fpackage-json-from-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreasonny83","download_url":"https://codeload.github.com/andreasonny83/package-json-from-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242980782,"owners_count":20216285,"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":["cli","cli-app","cli-tool","json","npm","package","package-json","pkg"],"created_at":"2024-10-12T02:19:42.285Z","updated_at":"2026-05-08T05:50:13.148Z","avatar_url":"https://github.com/andreasonny83.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Package.json From Template [![Build Status](https://travis-ci.org/andreasonny83/package-json-from-template.svg?branch=master)](https://travis-ci.org/andreasonny83/package-json-from-template)\n\n\u003e Generate a package.json file from a template\n\n## Why\n\n- You might find this project useful if you need to generate a node module inside a different folder in your project but you want to avoid manually updating the version number before each release\n- It saves you time\n- It's DRY\n\n## When to use it\n\nSometimes you create a repository that generates a packaged version of your project and you want that to have it own `package.json` file but the same name and version inherited from your original project.\n\n## Install\n\nIf you want to install package-json-from-template globally, use the follow command from your terminal:\n\n```\n$ npm install -g package-json-from-template\n```\n\nOtherwise just add PackageJsonFromTemplate to your project with:\n\n```\n$ npm install --save-dev package-json-from-template\n```\n\nIf you prefer using Yarn:\n\n```\n$ yarn add --dev package-json-from-template\n```\n\n## Usage\n\n```txt\n  $ Usage: pack-gen [path] [options] -- [diff args]\n\n  Options\n    -t, --template=\u003cfilename\u003e   The template file to be used for generating the new package.json file. [default: \u003cpath\u003e/package.tpl.json]\n\n    -s, --source=\u003cfilename\u003e     The location of your `package.json` file. [default: the root project directory will be used]\n\n  [path]  The working directory in where generating package.json file\n\n  Examples\n  Generate a new package.json file inside the ./package folder\n  $ pack-gen package\n\n  Generate a new package.json using the base package.json file located under the src directory\n  $ pack-gen package --source=src/package.json\n\n  Generate a new package.json file inside the ./package folder using a my-template.json file as a template\n  $ pack-gen package --template=my-template.json\n```\n\n## Example\n\nNow, assuming that your project generate a distribution version\nof your node module inside a `dist` folder, add a `pack-gen` script\nto generate a `package.json` file inside that directory to\ncall after your build task is completed.\n\n```json\n\"scripts\": {\n  \"pack-gen\": \"pack-gen ./dist\",\n}\n```\n\nNote that your `dist` folder will need to contain a `package.tpl.json` file to use as a template.\nIf you wish to use a template file sitting elsewhere, you can use the `template` flag and specify a different path like this:\n\n```json\n\"scripts\": {\n  \"pack-gen\": \"pack-gen ./dist --template=/templates/my-package.teplate.json\",\n}\n```\n\n## Contributing\n\n1.  Fork it!\n1.  Create your feature branch: `git checkout -b my-new-feature`\n1.  Add your changes: `git add .`\n1.  Commit your changes: `git commit -am 'Add some feature'`\n1.  Push to the branch: `git push origin my-new-feature`\n1.  Submit a pull request :sunglasses:\n\n## License\n\n[MIT License](https://andreasonny.mit-license.org/2017) © SonnY\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasonny83%2Fpackage-json-from-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreasonny83%2Fpackage-json-from-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasonny83%2Fpackage-json-from-template/lists"}