Skip to content

Commit

Permalink
fix: support invocation without semantic-release (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
skeggse authored Jul 15, 2020
1 parent 507e732 commit a064464
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const getConfig = require('semantic-release/lib/get-config');
const getLogger = require('semantic-release/lib/get-logger');
let getConfig = null,
getLogger = null;
try {
getConfig = require('semantic-release/lib/get-config');
getLogger = require('semantic-release/lib/get-logger');
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') throw err;
}
const { Writable } = require('stream');

const devNull = () =>
Expand All @@ -15,6 +21,10 @@ const devNull = () =>
* @return {Promise<Object>} The configuration object, which includes an options field among others.
*/
async function getReleaseConfig() {
if (!getLogger || !getConfig) {
throw new Error('cannot get release config - semantic-release not available');
}

const context = {
cwd: process.cwd(),
// The logger logs a bunch of unhelpful stuff when loading plugins, and we're only loading
Expand Down

0 comments on commit a064464

Please sign in to comment.