Compare commits

...
4 Commits
9 changed files with 41 additions and 10 deletions
+4
View File
@@ -53,3 +53,7 @@
- [verifyConditions](https://github.com/GabrielDuarteM/semantic-release-chrome#verifyconditions) Verify the presence of the authentication (set via environment variables).
- [prepare](https://github.com/GabrielDuarteM/semantic-release-chrome#prepare) Write the correct version to the manifest.json and creates a zip file of the whole dist folder.
- [publish](https://github.com/GabrielDuarteM/semantic-release-chrome#publish) Uploads the generated zip file to the webstore, and publish the item.
- [semantic-release-firefox](https://github.com/felixfbecker/semantic-release-firefox) Set of semantic-release plugins for publishing a Firefox extension release.
- [verifyConditions](https://github.com/felixfbecker/semantic-release-firefox#verifyconditions) Verify the presence of the authentication (set via environment variables).
- [prepare](https://github.com/felixfbecker/semantic-release-firefox#prepare) Write the correct version to the manifest.json, creates a xpi file of the dist folder and a zip of the sources.
- [publish](https://github.com/felixfbecker/semantic-release-firefox#publish) Submit the generated archives to the webstore for review, and publish the item including release notes.
-1
View File
@@ -1,4 +1,3 @@
const process = require('process');
const {template, pick} = require('lodash');
const marked = require('marked');
const TerminalRenderer = require('marked-terminal');
+10 -2
View File
@@ -47,10 +47,18 @@ module.exports = async ({cwd, env, options: {repositoryUrl, branch}}) => {
const envVar = Object.keys(GIT_TOKENS).find(envVar => !isUndefined(env[envVar]));
const gitCredentials = `${GIT_TOKENS[envVar] || ''}${env[envVar] || ''}`;
const {protocols, ...parsed} = gitUrlParse(repositoryUrl);
const protocol = protocols.includes('https') ? 'https' : protocols.includes('http') ? 'http' : 'https';
const protocol = protocols.includes('https')
? 'https'
: protocols.includes('http')
? 'http'
: protocols.includes('ssh')
? 'ssh'
: 'https';
// If credentials are set via anvironment variables, convert the URL to http/https and add basic auth, otherwise return `repositoryUrl` as is
return gitCredentials ? {...parsed, protocols: [protocol], user: gitCredentials}.toString(protocol) : repositoryUrl;
return gitCredentials && ['https', 'http'].includes(protocol)
? {...parsed, protocols: [protocol], user: gitCredentials}.toString(protocol)
: repositoryUrl;
}
return repositoryUrl;
+8 -3
View File
@@ -1,11 +1,11 @@
const {dirname} = require('path');
const {isString, isPlainObject, isFunction, noop, cloneDeep} = require('lodash');
const {isString, isPlainObject, isFunction, noop, cloneDeep, omit} = require('lodash');
const resolveFrom = require('resolve-from');
const getError = require('../get-error');
const {extractErrors} = require('../utils');
const PLUGINS_DEFINITIONS = require('../definitions/plugins');
module.exports = ({cwd, options, logger}, type, pluginOpt, pluginsPath) => {
module.exports = ({cwd, stdout, stderr, options, logger}, type, pluginOpt, pluginsPath) => {
if (!pluginOpt) {
return noop;
}
@@ -31,7 +31,12 @@ module.exports = ({cwd, options, logger}, type, pluginOpt, pluginsPath) => {
const {outputValidator} = PLUGINS_DEFINITIONS[type] || {};
try {
logger.log(`Start step "${type}" of plugin "${pluginName}"`);
const result = await func({...cloneDeep(input), logger: logger.scope(logger.scopeName, pluginName)});
const result = await func({
...cloneDeep(omit(input, ['stdout', 'stderr', 'logger'])),
stdout,
stderr,
logger: logger.scope(logger.scopeName, pluginName),
});
if (outputValidator && !outputValidator(result)) {
throw getError(`E${type.toUpperCase()}OUTPUT`, {result, pluginName});
}
+1 -1
View File
@@ -66,7 +66,7 @@
"proxyquire": "^2.0.0",
"sinon": "^6.0.0",
"tempy": "^0.2.1",
"xo": "^0.21.0"
"xo": "^0.22.0"
},
"engines": {
"node": ">=8.3"
-1
View File
@@ -1,2 +1 @@
module.exports = () => {};
+1 -1
View File
@@ -1,7 +1,7 @@
const SemanticReleaseError = require('@semantic-release/error');
class InheritedError extends SemanticReleaseError {
constructor(message, code, newProperty) {
constructor(message, code) {
super(message);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
+13
View File
@@ -265,3 +265,16 @@ test('Do not add git credential to repositoryUrl if push is allowed', async t =>
repositoryUrl
);
});
test('Do not add git credentials if repositoryUrl is a "ssh" URL', async t => {
const {cwd} = await gitRepo();
t.is(
await getAuthUrl({
cwd,
env: {...env, GIT_CREDENTIALS: 'user:pass'},
options: {branch: 'master', repositoryUrl: 'ssh://git@host.null/owner/repo.git'},
}),
'ssh://git@host.null/owner/repo.git'
);
});
+4 -1
View File
@@ -160,7 +160,10 @@ test('Plugin is called with "pluginConfig" (omitting "path", adding global confi
await plugin({param: 'param'});
t.true(
pluginFunction.calledWith({conf: 'confValue', global: 'globalValue'}, {param: 'param', logger: t.context.logger})
pluginFunction.calledWithMatch(
{conf: 'confValue', global: 'globalValue'},
{param: 'param', logger: t.context.logger}
)
);
});