fix: convert git+https URL in package.json to https
This commit is contained in:
committed by
Gregor Martynus
parent
6f74dcbd4a
commit
b0b4fc82de
+10
-2
@@ -2,6 +2,7 @@ const {castArray, pickBy, isUndefined, isNull, isString, isPlainObject} = requir
|
||||
const readPkgUp = require('read-pkg-up');
|
||||
const cosmiconfig = require('cosmiconfig');
|
||||
const resolveFrom = require('resolve-from');
|
||||
const gitUrlParse = require('git-url-parse');
|
||||
const debug = require('debug')('semantic-release:config');
|
||||
const {repoUrl, verifyAuth} = require('./git');
|
||||
const PLUGINS_DEFINITIONS = require('./definitions/plugins');
|
||||
@@ -61,6 +62,13 @@ module.exports = async (opts, logger) => {
|
||||
};
|
||||
|
||||
async function pkgRepoUrl() {
|
||||
const {pkg} = await readPkgUp();
|
||||
return pkg && pkg.repository ? pkg.repository.url : undefined;
|
||||
const {pkg} = await readPkgUp({normalize: false});
|
||||
const repositoryUrl = pkg && (isPlainObject(pkg.repository) ? pkg.repository.url : pkg.repository);
|
||||
|
||||
if (repositoryUrl) {
|
||||
const {protocols} = gitUrlParse(repositoryUrl);
|
||||
return `${gitUrlParse(repositoryUrl).toString(
|
||||
protocols.includes('https') ? 'https' : protocols.includes('http') ? 'http' : undefined
|
||||
)}${protocols.includes('https') || protocols.includes('http') ? '.git' : ''}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user