Skip to content

Commit

Permalink
fix(config): fix options and plugins resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Dec 29, 2020
1 parent fb9b8db commit 56e974c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/multiSemanticRelease.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { dirname } = require("path");
const semanticRelease = require("semantic-release");
const { uniq, omit } = require("lodash");
const { uniq } = require("lodash");
const { check } = require("./blork");
const getLogger = require("./getLogger");
const getSynchronizer = require("./getSynchronizer");
Expand Down Expand Up @@ -64,8 +64,7 @@ async function multiSemanticRelease(

// Vars.
const globalOptions = await getConfig(cwd);
const options = Object.assign({}, globalOptions, inputOptions);
const multiContext = { options, cwd, env, stdout, stderr };
const multiContext = { globalOptions, inputOptions, cwd, env, stdout, stderr };

// Load packages from paths.
const packages = await Promise.all(paths.map((path) => getPackage(path, multiContext)));
Expand Down Expand Up @@ -118,7 +117,7 @@ module.exports = multiSemanticRelease;
*
* @internal
*/
async function getPackage(path, { options: globalOptions, env, cwd, stdout, stderr }) {
async function getPackage(path, { globalOptions, inputOptions, env, cwd, stdout, stderr }) {
// Make path absolute.
path = cleanPath(path, cwd);
const dir = dirname(path);
Expand All @@ -136,11 +135,11 @@ async function getPackage(path, { options: globalOptions, env, cwd, stdout, stde
});

// Load the package-specific options.
const pkgOptions = omit(await getConfig(dir), "plugins", "tagFormat");
const pkgOptions = await getConfig(dir);

// The 'final options' are the global options merged with package-specific options.
// We merge this ourselves because package-specific options can override global options.
const finalOptions = Object.assign({}, globalOptions, pkgOptions);
const finalOptions = Object.assign({}, globalOptions, pkgOptions, inputOptions);

// Make a fake logger so semantic-release's get-config doesn't fail.
const logger = { error() {}, log() {} };
Expand Down
1 change: 1 addition & 0 deletions test/lib/multiSemanticRelease.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ describe("multiSemanticRelease()", () => {
expect(false).toBe(true);
} catch (e) {
// Error bubbles up through semantic-release and multi-semantic-release and out.

expect(e.message).toBe("NOPE");
}
});
Expand Down

0 comments on commit 56e974c

Please sign in to comment.