MCPcopy
hub / github.com/conventional-changelog/standard-version / execCommit

Function execCommit

lib/lifecycles/commit.js:16–69  ·  view source on GitHub ↗
(args, newVersion)

Source from the content-addressed store, hash-verified

14}
15
16async function execCommit (args, newVersion) {
17 let msg = 'committing %s'
18 let paths = []
19 const verify = args.verify === false || args.n ? ['--no-verify'] : []
20 const sign = args.sign ? ['-S'] : []
21 const toAdd = []
22
23 // only start with a pre-populated paths list when CHANGELOG processing is not skipped
24 if (!args.skip.changelog) {
25 paths = [args.infile]
26 toAdd.push(args.infile)
27 }
28
29 // commit any of the config files that we've updated
30 // the version # for.
31 Object.keys(bump.getUpdatedConfigs()).forEach(function (p) {
32 paths.unshift(p)
33 toAdd.push(path.relative(process.cwd(), p))
34
35 // account for multiple files in the output message
36 if (paths.length > 1) {
37 msg += ' and %s'
38 }
39 })
40
41 if (args.commitAll) {
42 msg += ' and %s'
43 paths.push('all staged files')
44 }
45
46 checkpoint(args, msg, paths)
47
48 // nothing to do, exit without commit anything
49 if (args.skip.changelog && args.skip.bump && toAdd.length === 0) {
50 return
51 }
52
53 await runExecFile(args, 'git', ['add'].concat(toAdd))
54 await runExecFile(
55 args,
56 'git',
57 [
58 'commit'
59 ].concat(
60 verify,
61 sign,
62 args.commitAll ? [] : toAdd,
63 [
64 '-m',
65 `${formatCommitMessage(args.releaseCommitMessageFormat, newVersion)}`
66 ]
67 )
68 )
69}

Callers 1

commit.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…