{"id":22202146,"url":"https://github.com/rumkin/allow-publish-tag","last_synced_at":"2026-05-10T19:04:47.098Z","repository":{"id":57176642,"uuid":"162051955","full_name":"rumkin/allow-publish-tag","owner":"rumkin","description":"Publish package with allowed dist-tags only","archived":false,"fork":false,"pushed_at":"2020-11-18T15:01:46.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T20:36:37.374Z","etag":null,"topics":["cli","development","dist-tags","hook","npm","tools","util"],"latest_commit_sha":null,"homepage":"","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":"2018-12-16T23:54:06.000Z","updated_at":"2023-02-14T02:54:57.000Z","dependencies_parsed_at":"2022-09-04T10:20:25.553Z","dependency_job_id":null,"html_url":"https://github.com/rumkin/allow-publish-tag","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-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fallow-publish-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fallow-publish-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fallow-publish-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumkin","download_url":"https://codeload.github.com/rumkin/allow-publish-tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245116624,"owners_count":20563388,"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","development","dist-tags","hook","npm","tools","util"],"created_at":"2024-12-02T16:12:33.206Z","updated_at":"2026-05-10T19:04:47.016Z","avatar_url":"https://github.com/rumkin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Allow Publish Tag\n\nAllow publish tag prevents your NPM package from being accidentally\npublished with `latest` dist-tag for prereleases, e.g. alpha, beta, etc. Instead it\nenforces you to use proper dist-tag (`next` by default). It works with\n`prepublishOnly` hook from `package.json`.\n\n## Installation\n\n```\nnpm i allow-publish-tag\n```\n\n## Usage\n\n1. Add `prepublishOnly` script in `package.json`.\n2. Run `npm publish` when you're ready to publish your package, or `npm publish --dry-run`.\n\nExample `package.json`:\n```js\n{\n  \"version\" : \"1.0.0-alpha.1\",\n  \"scripts\": {\n    \"prepublishOnly\": \"allow-publish-tag\"\n  }\n}\n```\n\n## Configuration\n\nYou can configure allow publish tag to use ccustom release scheme. For example use `nightly` and\n`beta` prereleases, like Electron does:\n\n```js\n{\n  \"version\" : \"1.0.0-nightly.1\",\n  \"scripts\": {\n    \"prepublishOnly\": \"allow-publish-tag\"\n  },\n  \"allowPublishTags\": {\n    // Match all nightly or beta releases e.g \"nightly\", \"beta.3\", etc.\n    \"next\": \"{nightly,beta}?(.+([0-9]))\"\n  }\n}\n```\n\n## API\n\n### CLI\n\n```text\nallow-publish-tags [...TAGS]\n```\n\n* `[...TAGS]` – is a list of allowed dist-tags to be used with the current package version from `package.json`.\n\nUsing CLI with TAGS specified will allow to publish current version with any of provided dist-tags. If this\nlist is empty, then `allowPublishTag` field from `package.json` will be used as configuration. If there is\nno `allowPublishTag` field, then the default configuration will be used.\n\n### `AllowPublishTagRecord`\n\n\n```text\nAllowPublishTagFlag | AllowPublishTagList | AllowPublishTagDict\n```\n\nConfiguration value `AllowPublishTagRecord` describes the value of `allowPublishTag` field of `package.json`.\n\n### `AllowPublishTagFlag`\n\n```text\ntrue\n```\n\nBoolean value `true` turns default APT configuration on.\n\nExample:\n\n```js\n{\n  \"allowPublishTag\": true\n}\n```\n\n### `AllowPublishTagList`\n\n```text\nArray\u003cstring\u003e|string\n```\n\nArray should contain allowed prerelease names for the `next` dist-tag, which are strings or [picomatch](https://npmjs.com/package/picomatch)-compatible glob patterns.\n\nExample:\n\n```js\n{\n  \"allowPublishTag\": [\"alpha\", \"beta\", \"pre.*\"]\n}\n```\n\n### `AllowPublishTagDict`\n\n```text\n{\n  [string]: Array\u003cstring\u003e|string,\n  '*': Array\u003cstring\u003e|string,\n}\n```\n\nDictionary contains records where key is a dist-tag and value is a list of allowed prereleases. Prerelease name could be a string or a [picomatch](https://npmjs.com/package/picomatch)-compatible glob pattern. If there is the asterisk key, then\nthis rules will match all dist-tags.\n\nExample:\n\n```js\n{\n  \"allowPublishTag\": {\n    \"next\": \"{alpha,beta,rc}?(.+([0-9]))\"\n  }\n}\n```\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fallow-publish-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumkin%2Fallow-publish-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fallow-publish-tag/lists"}