eslint-release
Advanced tools
Comparing version 3.2.2 to 3.3.0
@@ -142,4 +142,6 @@ /** | ||
function getVersionTags() { | ||
const tags = ShellOps.execSilent("git tag").trim().split("\n"); | ||
// Using `--merged` to only list tags whose commits are reachable from HEAD | ||
const tags = ShellOps.execSilent("git tag --merged").trim().split("\n"); | ||
return tags.reduce((list, tag) => { | ||
@@ -351,6 +353,8 @@ if (semver.valid(tag)) { | ||
releaseInfo.markdownChangelog = `v${releaseInfo.version} - ${today}\n\n${releaseInfo.rawChangelog}\n\n`; | ||
// output header and changelog | ||
fs.writeFileSync( | ||
"CHANGELOG.tmp", | ||
`v${releaseInfo.version} - ${today}\n\n${releaseInfo.rawChangelog}\n\n` | ||
releaseInfo.markdownChangelog | ||
); | ||
@@ -375,5 +379,6 @@ | ||
* Only include when doing a prerelease. | ||
* @param {string} [packageTag] Tag added to the package submitted to the npm registry. | ||
* @returns {Object} The information about the release. | ||
*/ | ||
function generateRelease(prereleaseId) { | ||
function generateRelease(prereleaseId, packageTag = prereleaseId ? "next" : "latest") { | ||
@@ -388,3 +393,6 @@ validateSetup(); | ||
releaseInfo.packageTag = packageTag; | ||
console.log("Release is %s", releaseInfo.version); | ||
console.log("Package tag is %s", releaseInfo.packageTag); | ||
@@ -451,3 +459,4 @@ console.log("Generating changelog"); | ||
body: generateReleaseBody(releaseInfo.changelog), | ||
prerelease: !!semver.prerelease(releaseInfo.version) | ||
prerelease: !!semver.prerelease(releaseInfo.version), | ||
make_latest: String(releaseInfo.packageTag === "latest") // eslint-disable-line camelcase | ||
}).then(() => { | ||
@@ -488,8 +497,4 @@ console.log("Posted release notes to GitHub"); | ||
let command = "npm publish"; | ||
let command = `npm publish --tag ${releaseInfo.packageTag}`; | ||
if (semver.prerelease(releaseInfo.version)) { | ||
command += " --tag next"; | ||
} | ||
if (process.env.NPM_OTP && /^\d+$/.test(process.env.NPM_OTP)) { | ||
@@ -496,0 +501,0 @@ command += ` --otp=${process.env.NPM_OTP}`; |
{ | ||
"name": "eslint-release", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "ESLint Release Tools", | ||
@@ -5,0 +5,0 @@ "main": "./lib/release-ops", |
@@ -69,3 +69,4 @@ [![NPM version][npm-image]][npm-url] | ||
1. Runs `npm version` to update the version | ||
1. Pushes the repository to origin/master with tags (only outside of CI release) | ||
1. Pushes the current branch to origin, with tags | ||
1. Creates GitHub release marked as Latest | ||
1. Converts all line endings to Unix style | ||
@@ -75,4 +76,42 @@ 1. Publishes the package to npm | ||
When you do a prerelease, the same steps are taken except that package is published to npm under the `next` tag instead of `latest`. | ||
When you do a prerelease, the same steps are taken except that package is published to npm under the `next` tag instead of `latest`, and the GitHub release is marked as Pre-release. | ||
## API Usage | ||
This package exports two functions: | ||
* `generateRelease(prereleaseId, packageTag)` - This corresponds to the CLI command `eslint-generate-release` when `prereleaseId` is `undefined`, and the CLI command `eslint-generate-prerelease prereleaseId` when `prereleaseId` is a string value. | ||
* `publishRelease()` - This corresponds to the CLI command `eslint-publish-release`. | ||
`packageTag` is used as the `--tag` value in the `npm publish` command. It's also used to determine whether a regular release will be marked as Latest on GitHub: it will be marked as Latest only if `packageTag` is `"latest"`. This parameter is optional and defaults to `"latest"` when `prereleaseId` is `undefined`, `"next"` otherwise. | ||
### Examples | ||
Publish a regular latest release: | ||
```js | ||
const ReleaseOps = require("eslint-release"); | ||
ReleaseOps.generateRelease(); | ||
ReleaseOps.publishRelease(); | ||
``` | ||
Publish a regular release with `maintenance` tag: | ||
```js | ||
const ReleaseOps = require("eslint-release"); | ||
ReleaseOps.generateRelease(undefined, "maintenance"); | ||
ReleaseOps.publishRelease(); | ||
``` | ||
Publish an `alpha` prerelease: | ||
```js | ||
const ReleaseOps = require("eslint-release"); | ||
ReleaseOps.generateRelease("alpha"); | ||
ReleaseOps.publishRelease(); | ||
``` | ||
## Contributing | ||
@@ -79,0 +118,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30023
581
133