{"id":22202253,"url":"https://github.com/rumkin/allow-publish-version","last_synced_at":"2025-03-25T01:42:23.186Z","repository":{"id":57176640,"uuid":"313919933","full_name":"rumkin/allow-publish-version","owner":"rumkin","description":"Publish package with allowed versions only","archived":false,"fork":false,"pushed_at":"2020-11-18T11:57:56.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T01:27:14.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rumkin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-18T11:55:15.000Z","updated_at":"2020-11-18T11:57:59.000Z","dependencies_parsed_at":"2022-09-04T11:10:15.396Z","dependency_job_id":null,"html_url":"https://github.com/rumkin/allow-publish-version","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fallow-publish-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fallow-publish-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fallow-publish-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fallow-publish-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumkin","download_url":"https://codeload.github.com/rumkin/allow-publish-version/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245383118,"owners_count":20606265,"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":[],"created_at":"2024-12-02T16:13:00.689Z","updated_at":"2025-03-25T01:42:23.167Z","avatar_url":"https://github.com/rumkin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Allow Publish Version\n\nAllow Publish Version util protects your NPM package from being accidentally\npublished with invalid version. Use it with `prepublishOnly` script of package.json.\n\nIt will check your package version to be valid NPM subset of [semver](https://semver.org)\nwith exact prerelease record. Valid versions might look like `1.0.0` or `1.0.0-beta.1`.\n\n## Installation\n\n```bash\nnpm i allow-publish-version\n```\n\n## Usage\n\n1. Add `prepublishOnly` script in `package.json`.\n3. Run `npm publish` when you're ready to publish your package, or `npm publish --dry-run` to test.\n\nExample `package.json`:\n```js\n{\n  \"version\" : \"1.0.0-alpha.1\",\n  \"scripts\": {\n    \"prepublishOnly\": \"allow-publish-version\"\n  },\n}\n```\n\nBy default there will be `alpha`, `beta` and `rc` prereleases allowed.\n\n## Examples\n\nValid versions:\n\n```text\n1.0.0\n1.0.0-pre.1\n1.0.0-pre.beta.1\n```\n\nInvalid versions:\n\n```ini\n1.0 # Not a valid semver.\n1.0.0-beta # No prerelease version.\n1.0.0-pre.0 # Prerelease index should start from 1.\n1.0.0-pre.1.0 # Prerelease name couldn't contain numbers.\n1.0.0-beta.0+x64 # Builds are not supported by NPM.\n```\n\n## Configuration\n\nAPV could be configured to use another prerelease scheme with `package.json`.\n\n```js\n{\n  \"version\" : \"1.0.0-nightly.1\",\n  \"scripts\": {\n    \"prepublishOnly\": \"allow-publish-version\"\n  },\n  \"allowPublishVersion\": {\n    \"prereleases\": [\"nightly\", \"beta\"]\n  }\n}\n```\n\n## API\n\n### `AllowPublishVersionRecord`\n\n```text\nAllowPublishVersionFlag | AllowPublishVersionList | AllowPublishVersionDict\n```\n\nConfiguration value `AllowPublishVersionRecord` describes the value of `allowPublishVersion` field of `package.json`.\n\n### `AllowPublishVersionFlag`\n\n```text\ntrue\n```\n\nBoolean value `true` turns default APV configuration on.\n\nExample:\n\n```js\n{\n  \"allowPublishVersion\": true\n}\n```\n\n### `AllowPublishVersionList`\n\n```text\nArray\u003cstring\u003e\n```\n\nArray should contain allowed prerelease names or [picomatch](https://npmjs.com/package/picomatch)-compatible glob patterns.\n\nExample:\n\n```js\n{\n  \"allowPublishVersion\": [\"beta\", \"pre.*\"]\n}\n```\n\n### `AllowPublishVersionDict`\n\n```text\n{\n  prereleases: Array\u003cstring\u003e\n}\n```\n\nDictionary holds single field `prereleases`. This field contains allowed prerelease names or [picomatch](https://npmjs.com/package/picomatch)-compatible glob patterns.\n\nExample:\n\n```js\n{\n  \"allowPublishVersion\": {\n    \"prereleases\": [\"beta\", \"pre.*\"]\n  }\n}\n```\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fallow-publish-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumkin%2Fallow-publish-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fallow-publish-version/lists"}