Skip to content

Commit

Permalink
refactor: drop support for versionedSources as comma-separated list
Browse files Browse the repository at this point in the history
BREAKING CHANGE: setting ``versionedSources`` as a comma-separated list of file
names is no longer supported. That was deprecated in version 3.0.0.
  • Loading branch information
lddubeau committed Jun 8, 2018
1 parent b8db171 commit da0490c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
19 changes: 9 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,16 @@ exports.getSources = function getSources(extraSources) {
const pkg = JSON.parse(data);
const { versionedSources } = pkg;
if (versionedSources) {
if (versionedSources instanceof Array) {
sources = sources.concat(versionedSources);
}
else {
if (versionedSources.indexOf(",") !== -1) {
console.warn( // eslint-disable-line no-console
"WARNING: the use of comma in versionedSources is " +
"deprecated.");
}
sources = sources.concat(versionedSources.split(","));
if (!(versionedSources instanceof Array ||
typeof versionedSources === "string")) {
throw new Error(
"versionedSources must be an array or a string");
}

sources =
sources.concat(versionedSources instanceof Array ?
versionedSources :
[versionedSources]);
}

return sources;
Expand Down
3 changes: 0 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ describe("getSources", () => {
makeTest("a single string", ["package.json", "literal.js"], "literal.js");
makeTest("an array", ["package.json", "literal.js", "tsmodule.ts"],
["literal.js", "tsmodule.ts"]);
makeTest("a comma-separated list",
["package.json", "literal.js", "tsmodule.ts"],
"literal.js,tsmodule.ts");
});
});

Expand Down

0 comments on commit da0490c

Please sign in to comment.