{"id":15547467,"url":"https://github.com/joemaller/version-everything","last_synced_at":"2025-04-23T18:23:56.189Z","repository":{"id":14277998,"uuid":"76220723","full_name":"joemaller/version-everything","owner":"joemaller","description":"Use npm to version all kinds of projects, not just javascript.","archived":false,"fork":false,"pushed_at":"2024-09-09T13:23:56.000Z","size":1541,"stargazers_count":3,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T15:40:58.469Z","etag":null,"topics":["npm","semver"],"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/joemaller.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-12T04:01:02.000Z","updated_at":"2024-09-09T13:24:00.000Z","dependencies_parsed_at":"2024-09-09T16:04:56.272Z","dependency_job_id":"8b24dc74-b9d2-435c-ab15-498797b0e897","html_url":"https://github.com/joemaller/version-everything","commit_stats":{"total_commits":261,"total_committers":5,"mean_commits":52.2,"dds":0.3486590038314177,"last_synced_commit":"25740bd3b8d08e9c55fece86fef1052220f5907c"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemaller%2Fversion-everything","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemaller%2Fversion-everything/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemaller%2Fversion-everything/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemaller%2Fversion-everything/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joemaller","download_url":"https://codeload.github.com/joemaller/version-everything/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250488412,"owners_count":21438776,"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":["npm","semver"],"created_at":"2024-10-02T13:09:18.482Z","updated_at":"2025-04-23T18:23:56.172Z","avatar_url":"https://github.com/joemaller.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# version-everything\n\n#### Version: 0.11.4\n\nUse npm to version all kinds of projects, not just JavaScript\n\n[![npm](https://img.shields.io/npm/v/version-everything.svg)](https://www.npmjs.com/package/version-everything)\n[![codecov](https://codecov.io/gh/joemaller/version-everything/branch/master/graph/badge.svg)](https://codecov.io/gh/joemaller/version-everything)\n[![Coverage Status](https://coveralls.io/repos/github/joemaller/version-everything/badge.svg)](https://coveralls.io/github/joemaller/version-everything)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6b0958bcd94274198117/maintainability)](https://codeclimate.com/github/joemaller/version-everything/maintainability)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://prettier.io)\n\nSynchronize versions from package.json into additional text or structured data files. When called from npm's **version** script, all versioned files in a project will be updated and committed with a single command.\n\n```sh\n    npm install --save-dev version-everything\n```\n\n## How to version everything\n\nThere are several ways version-everything can be used, the only requirement is an array of files to synchronize versions into. The files can be text (php, css, markdown, whatever) or structured data (JSON, YAML, XML or plists).\n\nThe file list is an array specified in one of the following forms, in order of precedence:\n\n1. Command line arguments\n2. `files` key in a **version-everything.config.js** file\n3. `version-everything.files` key in the parent project's **package.json** file\n\n### npm lifecycle script in package.json\n\nThe simplest way to use _version-everything_ is to hook into npm's version event. Once set up, a single `npm` command will update, commit and tag all versioned files in a project.\n\nAdd something like the following to your project's package.json file:\n\n```json\n{\n  \"version\": \"1.3.6\",\n  \"scripts\": {\n    \"version\": \"version-everything \u0026\u0026 git add -u\"\n  },\n  \"version-everything\": {\n    \"files\": [\n      \"README.md\",\n      \"example_wordpress_plugin.php\",\n      \"styles.css\",\n      \"manifest.json\",\n      \"sadness.xml\"\n    ]\n  }\n}\n```\n\nNow running a command like `npm version minor` will bump the project version and update version strings in all listed files. It's that easy!\n\nSome structured data files may be formatted using default settings.\n\n### Replacing version strings\n\nIn text files, the following version strings will be updated.\n\n- `Version: 1.2.34`\n- `### Version: 2.34.5` (Markdown headings)\n- `* @version 4.5.67` and `/** @version 4.5.67 */` ([PHPDoc tags](https://docs.phpdoc.org/guide/references/phpdoc/tags/version.html#version))\n- `v0.6.0` (At end-of-line)\n- `LABEL version=\"1.2.34\"` (Dockerfiles)\n\n_Notes:_ Colons are optional. Simple v-prefixed, [git-tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) style version strings must appear at the end of a line.\n\n#### Additional Prefixes\n\nAdditional string or RegExp patterns can be added to the list of default patterns and will match against plain text files. When prefixes are specified, structured data files will be processed first as plain text, then again as structured data if no versions are found.\n\nIf a stuctured data file contains a comment and a version attribute, including an empty prefix will update both. (ref: [#15](https://github.com/joemaller/version-everything/issues/15#issuecomment-1685039468))\n\n### version-everything config files\n\nThis project uses [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) to load config files. The file-key should be `version-everything`, so files like `.version-everythingrc` or `.version-everythingrc.js` will work.\n\nConfig files should export a simple JS object and look something like this:\n\n```js\nmodule.exports = {\n  files: [\"README.md\", \"example_wordpress_plugin.php\", \"styles.css\"],\n  prefix: /* a string, regexp literal or mixed array of either */\n  json: {\n    /* optional json config object, keys pass directly to JSON.stringify */\n  },\n  yaml: {\n    /* optional yaml config object, passes directly to js-yaml */\n  },\n  xml: {\n    /* optional xml config object, passes directly to xml2js */\n  },\n};\n```\n\n### Replacing xml attribute values\n\nVersion-everything can increment custom attributes in xml files when a keys array is set in the xml config object:\n\n```js\n{\n\t\"xml\": {\n\t\t\"keys\": [\n\t\t\t\"~project-version\",\n\t\t\t\"root~project-version\",\n\t\t\t\"element/hierarchy/relative/to/root~attribute-name\"\n\t\t]\n\t}\n}\n```\n\nThis option will add the attribute when missing, set the value when attribute is present but has no value and modify the value when attribute exists and has value.\n\nThe `/` character is used to specify nesting of elements (based on element names). When using this syntax the first element is **always the root element**.\n\nThe `~` character is used to specify the end of the hierarchy and beginning of attribute name. When the `~` character is missing or is the first character the operation will be applied to the root element (regardless of its name). To perform the operation only on a specific root element specify its name before the `~` character.\n\n### Plist files\n\nApple's plist files are parsed independently from standard XML. A `Version` key will be added to the root `\u003cdict\u003e` element. Following convention, all plist keys are title-case.\n\n### ES Module Imports\n\nVersion-everything can be used like any other esm Node module. The version string will be pulled from package.json and should be treated as a global constant or envvar.\n\n```js\nimport versionEverything from \"./index.js\";\n\nversionEverything({ files: [\"README.md\", \"file.json\"], json: { space: 4 } });\n```\n\nThis project is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).\n\n### Command Line Interface (CLI)\n\nWhen run from the command line, all arguments following the command are assumed to be file paths. This command would sync versions into `readme.md` and `manifest.json`:\n\n```sh\n$ version-everything readme.md manifest.json\n```\n\n#### Other CLI flags\n\nThe following additional flags map to version-everything settings. Run `version-everything -h` for full usage info.\n\n- `-p`, `--package-json` `\u003cpath to package.json file\u003e`\u003cbr\u003eLoads a specific package.json file. When present, this will also be used as the starting location for Cosmiconfig.\n\n- `n`, `--dry-run`\u003cbr\u003e Runs the command without modifying any files.\n- `q`, `--quiet`\u003cbr\u003e Run the command silently, without showing update messages.\n- `--prefix \u003cprefixes...\u003e`\u003cbr\u003eOne or more additional pattern prefixes to match against.\n\n#### Conflicting arguments\n\nIf a **package.json** is specified, it will be loaded first, then any subsequent args will be applied on top. So if **package.json** were to contain a `version-everything.files` array, that array would be overwritten by any list of files provided to the command line.\n\n### Recognized File Extensions\n\nFiles with the following extensions will be recognized as structured text and parsed accordingly.\n\n- **JSON** - `.json`\n- **XML** - `.xml`\n- **YAML** - `.yml`, `.yaml`\n- **PLIST** - `.plist`\n- **TEXT** - `.markdown`, `.md`, `.mdown`, `.sh`, `.text`, `.txt`\n\n## API\n\n### versionEverything([options])\n\nAll keys are optional. `options.files` is _practically_ required, without a list of files there's nothing to do.\n\n#### options\n\nType: `object`\nAll keys are optional.\n\n##### options.files\n\nType: `array`\n\nAn array containing the files which will be versioned.\n\n##### options.version\n\nType: `string`\n\nA valid SemVer version.\n\n##### options.prefix\n\nType: `string|RegExp|[string|RegExp]`\n\nA string, RegExp, or a mixed array of either. Will be added to the list of standard version patterns to be replaced in plain-text files.\n\n##### options.json\n\nType: `object`\n\nThree keys from the `json` object will be passed directly to [`JSON.parse`][jsonparse] or [`JSON.stringify`][stringify]: **`space`** which sets indentation from an integer or string, a **[`reviver`][reviver]** function and a **[`replacer`][replacer]** function/array. See the [JSON docs][stringify] for more info.\n\nDefault JSON Options:\n\n```js\n{\n  space: 2,\n  replacer: null,\n  reviver: null,\n}\n```\n\n##### options.xml\n\nType: `object`\n\nMerged with a minimal set of defaults, then passed to the [xml-js `js2xml` converter][xml-js convert]. See [xml-js docs][] for available options.\n\nDefault XML Options:\n\n```js\n{\n  compact: false,\n  spaces: 2,\n  indentCdata: true,\n}\n```\n\n##### options.yaml\n\nType: `object`\n\nPassed directly to the [js-yaml safeDump method][safedump]. See [js-yaml][] docs for available options.\n\n### Notes\n\n**npm** may fail to commit/tag files when `package.json` is nested below the git repository root. Ref: [npm#18795][npm18795]\n\nEnabling `push.followTags` in Git's global config is highly recommended: `git config --global push.followTags true`\n\nEmpty CData blocks `\u003c![CDATA[]]\u003e` will be removed from processed XML Documents. To preserve empty blocks, add one or more spaces: `\u003c![CDATA[ ]]\u003e`\n\n[webpack]: https://webpack.github.io/docs/configuration.html\n[eslint]: http://eslint.org/docs/user-guide/configuring#configuration-file-formats\n[xml-js]: https://www.npmjs.com/package/xml-js\n[xml-js convert]: https://www.npmjs.com/package/xml-js#convert-js-object--json-%E2%86%92-xml\n[jsondocs]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON\n[jsonparse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse\n[stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n[reviver]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter\n[replacer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter\n[js-yaml]: https://www.npmjs.com/package/js-yaml\n[safedump]: https://www.npmjs.com/package/js-yaml#safedump-object---options-\n[npm18795]: https://github.com/npm/npm/issues/18795\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoemaller%2Fversion-everything","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoemaller%2Fversion-everything","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoemaller%2Fversion-everything/lists"}