Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auto-release-cli

Package Overview
Dependencies
Maintainers
2
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-release-cli - npm Package Compare versions

Comparing version 0.32.2 to 0.33.0

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# 0.33.0 (Sun Dec 16 2018)
#### 🚀 Enhancement
- Default `label` to last merged PR [#83](https://github.com/intuit/auto-release/pull/83) ([@hipstersmoothie](https://github.com/hipstersmoothie))
#### Authors: 1
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
---
# 0.32.2 (Sun Dec 16 2018)

@@ -2,0 +14,0 @@

5

dist/cli/args.js

@@ -192,4 +192,5 @@ "use strict";

summary: 'Get the labels for a pull request',
require: ['pr'],
options: __spread([pr], defaultOptions),
options: __spread([
__assign({}, pr, { description: pr.description + " (default to last merged PR)" })
], defaultOptions),
examples: ['{green $} auto label --pr 123']

@@ -196,0 +197,0 @@ },

1

dist/git.d.ts

@@ -38,2 +38,3 @@ import GHub from '@octokit/rest';

getProject(): Promise<GHub.Response<GHub.ReposGetResponse>>;
getPullRequests(options?: Partial<GHub.PullsListParams>): Promise<GHub.PullsListResponseItem[]>;
getCommitsForPR(pr: number): Promise<GHub.PullsListCommitsResponseItem[]>;

@@ -40,0 +41,0 @@ createComment(message: string, pr: number, context: string): Promise<GHub.Response<GHub.IssuesCreateCommentResponse>>;

@@ -399,2 +399,22 @@ "use strict";

};
Github.prototype.getPullRequests = function (options) {
return __awaiter(this, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.logger.verbose.info('Getting pull requests...');
return [4 /*yield*/, this.authenticate()];
case 1:
_a.sent();
return [4 /*yield*/, this.ghub.pulls.list(__assign({ owner: this.options.owner.toLowerCase(), repo: this.options.repo.toLowerCase() }, options))];
case 2:
result = (_a.sent()).data;
this.logger.veryVerbose.info('Got response from pull requests', result);
this.logger.verbose.info('Got pull request');
return [2 /*return*/, result];
}
});
});
};
Github.prototype.getCommitsForPR = function (pr) {

@@ -401,0 +421,0 @@ return __awaiter(this, void 0, void 0, function () {

@@ -0,1 +1,2 @@

import GHub from '@octokit/rest';
import signale from 'signale';

@@ -49,9 +50,10 @@ import { IPRInfo } from './git';

getCommits(from: string, to?: string): Promise<IExtendedCommit[]>;
publish(releaseNotes: string, tag: string): Promise<import("@octokit/rest").Response<import("@octokit/rest").ReposCreateReleaseResponse>>;
publish(releaseNotes: string, tag: string): Promise<GHub.Response<GHub.ReposCreateReleaseResponse>>;
getLabels(pr: number): Promise<string[]>;
createStatus(prInfo: IPRInfo): Promise<import("@octokit/rest").Response<import("@octokit/rest").ReposCreateStatusResponse>>;
createStatus(prInfo: IPRInfo): Promise<GHub.Response<GHub.ReposCreateStatusResponse>>;
getSha(): Promise<string>;
getLatestRelease(): Promise<string>;
getPullRequest(pr: number): Promise<import("@octokit/rest").Response<import("@octokit/rest").PullsGetResponse>>;
createComment(message: string, pr: number, context?: string): Promise<import("@octokit/rest").Response<import("@octokit/rest").IssuesCreateCommentResponse>>;
getPullRequest(pr: number): Promise<GHub.Response<GHub.PullsGetResponse>>;
createComment(message: string, pr: number, context?: string): Promise<GHub.Response<GHub.IssuesCreateCommentResponse>>;
getPullRequests(options?: Partial<GHub.PullsListParams>): Promise<GHub.PullsListResponseItem[]>;
addLabelsToProject(labels: Map<string, string>, onlyPublishWithReleaseLabel?: boolean): Promise<void>;

@@ -58,0 +60,0 @@ getSemverBump(from: string, to?: string, onlyPublishWithReleaseLabel?: boolean, noReleaseLabels?: string[]): Promise<SEMVER>;

@@ -408,2 +408,15 @@ "use strict";

};
GithubRelease.prototype.getPullRequests = function (options) {
return __awaiter(this, void 0, void 0, function () {
var client;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.github];
case 1:
client = _a.sent();
return [2 /*return*/, client.getPullRequests(options)];
}
});
});
};
GithubRelease.prototype.addLabelsToProject = function (labels, onlyPublishWithReleaseLabel) {

@@ -410,0 +423,0 @@ return __awaiter(this, void 0, void 0, function () {

@@ -276,3 +276,3 @@ #!/usr/bin/env node

return __awaiter(this, void 0, void 0, function () {
var logger, log, verbose, veryVerbose, explorer, result, rawConfig, prefixRelease, config, semVerLabels, githubRelease, _a, version, labels, msg, res, labels, labelTexts_1, releaseTag, noReleaseTag, semverTag, description, error_1, res, _b, bump;
var logger, log, verbose, veryVerbose, explorer, result, rawConfig, prefixRelease, config, semVerLabels, githubRelease, _a, version, labels, pulls, lastMerged, msg, res, labels, labelTexts_1, releaseTag, noReleaseTag, semverTag, description, error_1, res, _b, bump;
return __generator(this, function (_c) {

@@ -321,18 +321,18 @@ switch (_c.label) {

case 'label': return [3 /*break*/, 17];
case 'pr-check': return [3 /*break*/, 19];
case 'pr': return [3 /*break*/, 28];
case 'comment': return [3 /*break*/, 36];
case 'version': return [3 /*break*/, 38];
case 'changelog': return [3 /*break*/, 40];
case 'release': return [3 /*break*/, 42];
case 'pr-check': return [3 /*break*/, 22];
case 'pr': return [3 /*break*/, 31];
case 'comment': return [3 /*break*/, 39];
case 'version': return [3 /*break*/, 41];
case 'changelog': return [3 /*break*/, 43];
case 'release': return [3 /*break*/, 45];
}
return [3 /*break*/, 44];
return [3 /*break*/, 47];
case 3: return [4 /*yield*/, init_1.default(args['only-labels'])];
case 4:
_c.sent();
return [3 /*break*/, 45];
return [3 /*break*/, 48];
case 5: return [4 /*yield*/, githubRelease.addLabelsToProject(new Map(__spread(semVerLabels, new Map(__spread(Object.keys(github_release_1.defaultChangelogTitles), Object.keys(config.changelogTitles || {})).map(function (label) { return [label, label]; })))), args.onlyPublishWithReleaseLabel)];
case 6:
_c.sent();
return [3 /*break*/, 45];
return [3 /*break*/, 48];
case 7: return [4 /*yield*/, getVersion(githubRelease, __assign({}, config, { command: args.command }))];

@@ -367,11 +367,23 @@ case 8:

_c.sent();
return [3 /*break*/, 45];
return [3 /*break*/, 48];
case 17:
verbose.info("Using command: 'label'");
return [4 /*yield*/, githubRelease.getLabels(args.pr)];
labels = [];
if (!!args.pr) return [3 /*break*/, 19];
return [4 /*yield*/, githubRelease.getPullRequests({ state: 'closed' })];
case 18:
pulls = _c.sent();
lastMerged = pulls.find(function (pull) { return !!pull.merged_at; });
if (lastMerged) {
labels = lastMerged.labels.map(function (label) { return label.name; });
}
return [3 /*break*/, 21];
case 19: return [4 /*yield*/, githubRelease.getLabels(args.pr)];
case 20:
labels = _c.sent();
_c.label = 21;
case 21:
console.log(labels.join('\n'));
return [3 /*break*/, 45];
case 19:
return [3 /*break*/, 48];
case 22:
verbose.info("Using command: 'pr-check' for '" + args.url + "'");

@@ -381,11 +393,11 @@ args.target_url = args.url;

msg = void 0;
_c.label = 20;
case 20:
_c.trys.push([20, 23, , 24]);
_c.label = 23;
case 23:
_c.trys.push([23, 26, , 27]);
return [4 /*yield*/, githubRelease.getPullRequest(args.pr)];
case 21:
case 24:
res = _c.sent();
args.sha = res.data.head.sha;
return [4 /*yield*/, githubRelease.getLabels(args.pr)];
case 22:
case 25:
labels = _c.sent();

@@ -414,4 +426,4 @@ labelTexts_1 = Object.values(semVerLabels);

};
return [3 /*break*/, 24];
case 23:
return [3 /*break*/, 27];
case 26:
error_1 = _c.sent();

@@ -422,77 +434,77 @@ msg = {

};
return [3 /*break*/, 24];
case 24:
return [3 /*break*/, 27];
case 27:
verbose.info('Posting comment to Github\n', msg);
if (!!args.dry_run) return [3 /*break*/, 26];
if (!!args.dry_run) return [3 /*break*/, 29];
return [4 /*yield*/, githubRelease.createStatus(__assign({}, args, msg))];
case 25:
case 28:
_c.sent();
log.success('Posted status to Pull Request.');
return [3 /*break*/, 27];
case 26:
return [3 /*break*/, 30];
case 29:
verbose.info('`pr-check` dry run complete.');
_c.label = 27;
case 27:
_c.label = 30;
case 30:
verbose.success('Finished `pr-check` command');
return [3 /*break*/, 45];
case 28:
return [3 /*break*/, 48];
case 31:
verbose.info("Using command: 'pr'");
if (!(!args.sha && args.pr)) return [3 /*break*/, 30];
if (!(!args.sha && args.pr)) return [3 /*break*/, 33];
verbose.info('Getting commit SHA from PR.');
return [4 /*yield*/, githubRelease.getPullRequest(args.pr)];
case 29:
case 32:
res = _c.sent();
args.sha = res.data.head.sha;
return [3 /*break*/, 32];
case 30:
if (!!args.sha) return [3 /*break*/, 32];
return [3 /*break*/, 35];
case 33:
if (!!args.sha) return [3 /*break*/, 35];
verbose.info('No PR found, getting commit SHA from HEAD.');
_b = args;
return [4 /*yield*/, githubRelease.getSha()];
case 31:
case 34:
_b.sha = _c.sent();
_c.label = 32;
case 32:
_c.label = 35;
case 35:
verbose.info('Found PR SHA:', args.sha);
args.target_url = args.url;
delete args.url;
if (!!args.dry_run) return [3 /*break*/, 34];
if (!!args.dry_run) return [3 /*break*/, 37];
return [4 /*yield*/, githubRelease.createStatus(args)];
case 33:
case 36:
_c.sent();
return [3 /*break*/, 35];
case 34:
return [3 /*break*/, 38];
case 37:
verbose.info('`pr` dry run complete.');
_c.label = 35;
case 35:
_c.label = 38;
case 38:
verbose.success('Finished `pr` command');
return [3 /*break*/, 45];
case 36:
return [3 /*break*/, 48];
case 39:
verbose.info("Using command: 'comment'");
return [4 /*yield*/, githubRelease.createComment(args.message, args.pr, args.context || undefined)];
case 37:
case 40:
_c.sent();
log.success("Commented on PR #" + args.pr);
return [3 /*break*/, 45];
case 38:
return [3 /*break*/, 48];
case 41:
verbose.info("Using command: 'version'");
return [4 /*yield*/, getVersion(githubRelease, __assign({ command: args.command }, config))];
case 39:
case 42:
bump = _c.sent();
console.log(bump);
return [3 /*break*/, 45];
case 40:
return [3 /*break*/, 48];
case 43:
verbose.info("Using command: 'changelog'");
return [4 /*yield*/, makeChangelog(args, githubRelease, log, prefixRelease, veryVerbose, verbose)];
case 41:
case 44:
_c.sent();
return [3 /*break*/, 45];
case 42:
return [3 /*break*/, 48];
case 45:
verbose.info("Using command: 'release'");
return [4 /*yield*/, makeRelease(args, githubRelease, log, prefixRelease, veryVerbose, verbose)];
case 43:
case 46:
_c.sent();
return [3 /*break*/, 45];
case 44: throw new Error("idk what i'm doing.");
case 45: return [2 /*return*/];
return [3 /*break*/, 48];
case 47: throw new Error("idk what i'm doing.");
case 48: return [2 /*return*/];
}

@@ -499,0 +511,0 @@ });

{
"name": "auto-release-cli",
"description": "CLI tools to help facilitate semantic versioning based on Github PR labels.",
"version": "0.32.2",
"version": "0.33.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Andrew Lisowski",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc