Closed davikawasaki closed 3 years ago
@davikawasaki,
by default msr relies on package.json.workspaces
value, but it's very easy override with custom glob pattern.
I suggest to introduce workspaces
CLI flag / JS API option and handle this value in getWorkspaces
.
["packages/*"] — include all
["packages/*", "!packages/app"] — exclude `app`
["packages/admin"] — include `admin` only
meow parser supports "array-like" args notation, I've checked: https://github.com/imagemin/imagemin-cli/pull/23/files
bin/runner.js
// Imports.
const getWorkspacesYarn = require("../lib/getWorkspacesYarn");
const multiSemanticRelease = require("../lib/multiSemanticRelease");
const multisemrelPkgJson = require("../package.json");
const semrelPkgJson = require("semantic-release/package.json");
// Get directory.
const cwd = process.cwd();
// Catch errors.
try {
console.log(`multi-semantic-release version: ${multisemrelPkgJson.version}`);
console.log(`semantic-release version: ${semrelPkgJson.version}`);
console.log(`flags: ${JSON.stringify(flags, null, 2)}`);
// Get list of package.json paths according to Yarn workspaces.
const paths = getWorkspaces(cwd, flags.workspaces);
console.log("yarn paths", paths);
lib/getWorkspacesYarn.js
/**
* Return array of package.json for Yarn workspaces.
*
* @param {string} cwd The current working directory where a package.json file can be found.
* @returns {string[]} An array of package.json files corresponding to the workspaces setting in package.json
*/
function getWorkspacesYarn(cwd, workspaces) {
// Load package.json
const manifest = getManifest(`${cwd}/package.json`);
let packages = manifest.workspaces;
if (packages && packages.packages) {
packages = packages.packages;
}
@antongolub so basically what's needed is parsing the package.json.workspaces
value?
Yep, it's just needed to override this value in some way.
Thanks, I'll have something done and send here.
Working after #42 is merged. Closing.
@antongolub do we have a feature that enable the semantic release workflow to fully ignore packages we want? For instance, I have three packages:
What I'd want to have is have only app and admin be bumped and released, whilst the lib to maintain in the same version. If not, can you walk me through which points in the code should we tweak to enable such functionality?