auto-release-cli
Advanced tools
Comparing version 0.36.0 to 0.36.1
@@ -0,1 +1,13 @@ | ||
# 0.36.1 (Tue Dec 18 2018) | ||
#### 🐛 Bug Fix | ||
- print link to token create when there is no GH_TOKEN. [#104](https://github.com/intuit/auto-release/pull/104) ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
#### Authors: 1 | ||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
--- | ||
# 0.36.0 (Tue Dec 18 2018) | ||
@@ -2,0 +14,0 @@ |
@@ -457,3 +457,3 @@ "use strict"; | ||
signale_1.default.error("Missing required flag" + (multiple ? 's' : '') + ": " + missing.join(', ')); | ||
process.exit(0); | ||
return process.exit(1); | ||
} | ||
@@ -460,0 +460,0 @@ } |
@@ -22,2 +22,3 @@ import GHub from '@octokit/rest'; | ||
readonly ghub: GHub; | ||
readonly baseUrl: string; | ||
readonly options: IGithubOptions; | ||
@@ -24,0 +25,0 @@ private readonly logger; |
@@ -96,2 +96,3 @@ "use strict"; | ||
var exec_promise_1 = __importDefault(require("./utils/exec-promise")); | ||
var settings_url_1 = __importDefault(require("./utils/settings-url")); | ||
var GithubAPIError = /** @class */ (function (_super) { | ||
@@ -111,6 +112,6 @@ __extends(GithubAPIError, _super); | ||
this.options = options; | ||
this.options.baseUrl = this.options.baseUrl || 'https://api.github.com'; | ||
this.logger.veryVerbose.info("Initializing Github with: " + this.options.baseUrl); | ||
this.baseUrl = this.options.baseUrl || 'https://api.github.com'; | ||
this.logger.veryVerbose.info("Initializing Github with: " + this.baseUrl); | ||
this.ghub = new rest_1.default({ | ||
baseUrl: this.options.baseUrl, | ||
baseUrl: this.baseUrl, | ||
headers: { | ||
@@ -126,3 +127,3 @@ accept: 'application/vnd.github.symmetra-preview+json' | ||
if (authToken === undefined && this.options.token === undefined) { | ||
throw new Error('Auth needs a Github token.'); | ||
throw new Error("Authentication needs a Github token. Try setting up an access token " + settings_url_1.default(this.baseUrl)); | ||
} | ||
@@ -129,0 +130,0 @@ token = authToken || this.options.token; |
@@ -45,2 +45,3 @@ import GHub from '@octokit/rest'; | ||
private readonly jira?; | ||
private readonly githubApi; | ||
private readonly slack?; | ||
@@ -47,0 +48,0 @@ constructor(options?: IOptionalGithubOptions, releaseOptions?: IGithubReleaseOptions); |
@@ -120,2 +120,3 @@ "use strict"; | ||
this.jira = releaseOptions.jira; | ||
this.githubApi = releaseOptions.githubApi || 'https://api.github.com'; | ||
this.slack = releaseOptions.slack; | ||
@@ -128,4 +129,4 @@ this.userLabels = releaseOptions.labels || new Map(); | ||
var args = __assign({ owner: options.owner, repo: options.repo, logger: this.logger }, options); | ||
if (releaseOptions && releaseOptions.githubApi) { | ||
args.baseUrl = releaseOptions.githubApi; | ||
if (releaseOptions && this.githubApi) { | ||
args.baseUrl = this.githubApi; | ||
} | ||
@@ -141,8 +142,8 @@ this.logger.verbose.info('Initializing Github API with:\n', args); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, github_token_1.default()]; | ||
case 0: return [4 /*yield*/, github_token_1.default(this.githubApi)]; | ||
case 1: | ||
token = _a.sent(); | ||
finalOptions = __assign({}, options, gOptions, { logger: this.logger, token: token }); | ||
if (releaseOptions && releaseOptions.githubApi) { | ||
finalOptions.baseUrl = releaseOptions.githubApi; | ||
if (releaseOptions && this.githubApi) { | ||
finalOptions.baseUrl = this.githubApi; | ||
} | ||
@@ -149,0 +150,0 @@ finalOptions.owner = |
@@ -1,1 +0,1 @@ | ||
export default function getGithubToken(): Promise<string>; | ||
export default function getGithubToken(apiUrl: string): Promise<string>; |
@@ -45,2 +45,3 @@ "use strict"; | ||
var util_1 = require("util"); | ||
var settings_url_1 = __importDefault(require("./settings-url")); | ||
var readFile = util_1.promisify(fs_1.default.readFile); | ||
@@ -50,5 +51,5 @@ var registry = registry_url_1.default(); | ||
var normalizedRegistry = registry.replace('http:', '').replace('https:', ''); | ||
function getGithubToken() { | ||
function getGithubToken(apiUrl) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var rcLocation, rc, regex, token; | ||
var helpText, rcLocation, rc, regex, token; | ||
return __generator(this, function (_a) { | ||
@@ -60,4 +61,5 @@ switch (_a.label) { | ||
} | ||
helpText = "Try setting an access token up " + settings_url_1.default(apiUrl); | ||
if (!process.env.HOME) { | ||
throw new Error("Can't find the GH_TOKEN. No HOME defined."); | ||
throw new Error("Can't find the GH_TOKEN and no HOME defined. " + helpText); | ||
} | ||
@@ -74,4 +76,4 @@ rcLocation = path_1.default.resolve(process.env.HOME, '.npmrc'); | ||
} | ||
throw new Error('No token in the .npmrc.'); | ||
case 2: throw new Error("Can't find a GitHub token to use."); | ||
throw new Error("No token in the .npmrc. " + helpText); | ||
case 2: throw new Error("Can't find a GitHub token to use. " + helpText); | ||
} | ||
@@ -78,0 +80,0 @@ }); |
{ | ||
"name": "auto-release-cli", | ||
"description": "CLI tools to help facilitate semantic versioning based on Github PR labels.", | ||
"version": "0.36.0", | ||
"version": "0.36.1", | ||
"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
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
255587
46
3339