-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4199fa8
commit 6de93b9
Showing
5 changed files
with
225 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,36 @@ | ||
#!/usr/bin/env node | ||
|
||
if (process.argv.includes("--watchspawn")) { | ||
require("../lib/spawnHook").hook(); | ||
} | ||
const meow = require("meow"); | ||
const pairs = require("lodash.pairs"); | ||
const set = require("lodash.set"); | ||
const runner = require("./runner"); | ||
const cli = meow( | ||
` | ||
Usage | ||
$ multi-semantic-release | ||
// Execa hook. | ||
if (process.argv.includes("--execasync")) { | ||
require("../lib/execaHook").hook(); | ||
} | ||
Options | ||
--sync, Forces all execa calls to be synchronous | ||
--debug, Enables all additional logging | ||
--debug.spawn Turns on logging for process.spawn | ||
// Imports. | ||
const getWorkspacesYarn = require("../lib/getWorkspacesYarn"); | ||
const multiSemanticRelease = require("../lib/multiSemanticRelease"); | ||
|
||
// Get directory. | ||
const cwd = process.cwd(); | ||
Examples | ||
$ multi-semantic-release --sync --debug | ||
$ multi-semantic-release --debug.spawn | ||
`, | ||
{ | ||
flags: { | ||
sync: { | ||
type: "boolean", | ||
alias: "execasync" // Legacy | ||
}, | ||
debug: { | ||
type: "boolean" | ||
} | ||
} | ||
} | ||
); | ||
|
||
// Catch errors. | ||
try { | ||
// Get list of package.json paths according to Yarn workspaces. | ||
const paths = getWorkspacesYarn(cwd); | ||
const processFlags = flags => pairs(flags).reduce((m, [k, v]) => set(m, k, v), {}); | ||
|
||
// Do multirelease (log out any errors). | ||
multiSemanticRelease(paths, {}, { cwd }).then( | ||
() => { | ||
// Success. | ||
process.exit(0); | ||
}, | ||
error => { | ||
// Log out errors. | ||
console.error(`[multi-semantic-release]:`, error); | ||
process.exit(1); | ||
} | ||
); | ||
} catch (error) { | ||
// Log out errors. | ||
console.error(`[multi-semantic-release]:`, error); | ||
process.exit(1); | ||
} | ||
runner(processFlags(cli.flags)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const get = require("lodash.get"); | ||
|
||
module.exports = flags => { | ||
if (flags.watchspawn || get(flags, "debug.spawn")) { | ||
require("../lib/spawnHook").hook(); | ||
} | ||
|
||
// Execa hook. | ||
if (flags.sync) { | ||
require("../lib/execaHook").hook(); | ||
} | ||
|
||
// Imports. | ||
const getWorkspacesYarn = require("../lib/getWorkspacesYarn"); | ||
const multiSemanticRelease = require("../lib/multiSemanticRelease"); | ||
|
||
// Get directory. | ||
const cwd = process.cwd(); | ||
|
||
// Catch errors. | ||
try { | ||
// Get list of package.json paths according to Yarn workspaces. | ||
const paths = getWorkspacesYarn(cwd); | ||
|
||
// Do multirelease (log out any errors). | ||
multiSemanticRelease(paths, {}, { cwd }).then( | ||
() => { | ||
// Success. | ||
process.exit(0); | ||
}, | ||
error => { | ||
// Log out errors. | ||
console.error(`[multi-semantic-release]:`, error); | ||
process.exit(1); | ||
} | ||
); | ||
} catch (error) { | ||
// Log out errors. | ||
console.error(`[multi-semantic-release]:`, error); | ||
process.exit(1); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.