Skip to content

Commit 5732bf8

Browse files
committed
1 parent f73f462 commit 5732bf8

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

utils/bump/extension-manifests.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
(async () => {
1010

1111
// Parse ARGS
12-
const args = process.argv.slice(2),
13-
chromiumOnly = args.some(arg => /chrom/i.test(arg)),
14-
ffOnly = args.some(arg => /f{2}/i.test(arg)),
15-
noCommit = args.some(arg => ['--no-commit', '-nc'].includes(arg)),
16-
noPush = args.some(arg => ['--no-push', '-np'].includes(arg))
12+
const args = process.argv.slice(2)
13+
const config = {
14+
chromiumOnly: args.some(arg => /chrom/i.test(arg)),
15+
ffOnly: args.some(arg => /f{2}/i.test(arg)),
16+
noCommit: args.some(arg => ['--no-commit', '-nc'].includes(arg)),
17+
noPush: args.some(arg => ['--no-push', '-np'].includes(arg))
18+
}
1719

1820
// Import LIBS
1921
const fs = require('fs'),
@@ -40,7 +42,7 @@
4042

4143
// Check latest commit for extension changes if forcible platform flag not set
4244
const platformManifestPath = path.dirname(manifestPath)
43-
if (!chromiumOnly && !ffOnly) {
45+
if (!config.chromiumOnly && !config.ffOnly) {
4446
console.log(`Checking last commit details for ${platformManifestPath}...`)
4547
try {
4648
const latestCommitMsg = spawnSync('git',
@@ -53,7 +55,8 @@
5355
} catch (err) { bump.log.error('Error checking git history\n') }
5456
}
5557

56-
console.log(`Bumping version in ${chromiumOnly ? 'Chromium' : ffOnly ? 'Firefox' : ''} manifest...`)
58+
console.log(`Bumping version in ${
59+
config.chromiumOnly ? 'Chromium' : config.ffOnly ? 'Firefox' : ''} manifest...`)
5760
const { oldVer, newVer } = bump.bumpDateVer({ filePath: manifestPath })
5861
bumpedManifests[`${platformManifestPath}/manifest.json`] = `${oldVer};${newVer}`
5962
}
@@ -66,7 +69,7 @@
6669

6770

6871
// ADD/COMMIT/PUSH bump(s)
69-
if (!noCommit) {
72+
if (!config.noCommit) {
7073
bump.log.working(`\nCommitting bump${pluralSuffix} to Git...\n`)
7174

7275
// Init commit msg
@@ -80,14 +83,14 @@
8083
try {
8184
execSync('git add ./**/manifest.json')
8285
spawnSync('git', ['commit', '-n', '-m', commitMsg], { stdio: 'inherit', encoding: 'utf-8' })
83-
if (!noPush) {
86+
if (!config.noPush) {
8487
bump.log.working('\nPulling latest changes from remote to sync local repository...\n')
8588
execSync('git pull')
8689
bump.log.working('\nPushing bump${pluralSuffix} to Git...\n')
8790
execSync('git push')
8891
}
8992
bump.log.success(`Success! ${Object.keys(bumpedManifests).length} manifest${pluralSuffix} updated${
90-
!noCommit ? '/committed' : '' }${ !noPush ? '/pushed' : '' } to GitHub`)
93+
!config.noCommit ? '/committed' : '' }${ !config.noPush ? '/pushed' : '' } to GitHub`)
9194
} catch (err) { bump.log.error('Git operation failed: ' + err.message) }
9295
}
9396

0 commit comments

Comments
 (0)