Skip to content

Commit eebbc9b

Browse files
committed
Moved config vars into obj
1 parent 2d43ce7 commit eebbc9b

File tree

11 files changed

+161
-129
lines changed

11 files changed

+161
-129
lines changed

brave-omnibox/utils/bump/extension-manifests.js

Lines changed: 15 additions & 12 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'),
@@ -34,16 +36,16 @@
3436
// Init manifest PATHS
3537
const chromiumManifestPath = 'chromium/extension/manifest.json',
3638
ffManifestPath = 'firefox/extension/manifest.json'
37-
const manifestPaths = chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
38-
: ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
39+
const manifestPaths = config.chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
40+
: config.ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
3941
: [chromiumManifestPath, ffManifestPath]
4042
// BUMP versions
4143
const bumpedManifests = {}
4244
for (const manifestPath of manifestPaths) {
4345

4446
// Check latest commit for extension changes if forcible platform flag not set
4547
const platformManifestPath = path.dirname(manifestPath)
46-
if (!chromiumOnly && !ffOnly) {
48+
if (!config.chromiumOnly && !config.ffOnly) {
4749
console.log(`Checking last commit details for ${platformManifestPath}...`)
4850
try {
4951
const latestCommitMsg = spawnSync('git',
@@ -56,7 +58,8 @@
5658
} catch (err) { bump.log.error('Error checking git history\n') }
5759
}
5860

59-
console.log(`Bumping version in ${chromiumOnly ? 'Chromium' : ffOnly ? 'Firefox' : ''} manifest...`)
61+
console.log(`Bumping version in ${
62+
config.chromiumOnly ? 'Chromium' : config.ffOnly ? 'Firefox' : ''} manifest...`)
6063
const { oldVer, newVer } = bump.bumpDateVer({ filePath: manifestPath })
6164
bumpedManifests[`${platformManifestPath}/manifest.json`] = `${oldVer};${newVer}`
6265
}
@@ -69,7 +72,7 @@
6972

7073

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

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

chatgpt-auto-continue/utils/bump/extension-manifests.js

Lines changed: 15 additions & 12 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'),
@@ -34,16 +36,16 @@
3436
// Init manifest PATHS
3537
const chromiumManifestPath = 'chromium/extension/manifest.json',
3638
ffManifestPath = 'firefox/extension/manifest.json'
37-
const manifestPaths = chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
38-
: ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
39+
const manifestPaths = config.chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
40+
: config.ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
3941
: [chromiumManifestPath, ffManifestPath]
4042
// BUMP versions
4143
const bumpedManifests = {}
4244
for (const manifestPath of manifestPaths) {
4345

4446
// Check latest commit for extension changes if forcible platform flag not set
4547
const platformManifestPath = path.dirname(manifestPath)
46-
if (!chromiumOnly && !ffOnly) {
48+
if (!config.chromiumOnly && !config.ffOnly) {
4749
console.log(`Checking last commit details for ${platformManifestPath}...`)
4850
try {
4951
const latestCommitMsg = spawnSync('git',
@@ -56,7 +58,8 @@
5658
} catch (err) { bump.log.error('Error checking git history\n') }
5759
}
5860

59-
console.log(`Bumping version in ${chromiumOnly ? 'Chromium' : ffOnly ? 'Firefox' : ''} manifest...`)
61+
console.log(`Bumping version in ${
62+
config.chromiumOnly ? 'Chromium' : config.ffOnly ? 'Firefox' : ''} manifest...`)
6063
const { oldVer, newVer } = bump.bumpDateVer({ filePath: manifestPath })
6164
bumpedManifests[`${platformManifestPath}/manifest.json`] = `${oldVer};${newVer}`
6265
}
@@ -69,7 +72,7 @@
6972

7073

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

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

chatgpt-infinity/utils/bump/extension-manifests.js

Lines changed: 15 additions & 12 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'),
@@ -34,16 +36,16 @@
3436
// Init manifest PATHS
3537
const chromiumManifestPath = 'chromium/extension/manifest.json',
3638
ffManifestPath = 'firefox/extension/manifest.json'
37-
const manifestPaths = chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
38-
: ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
39+
const manifestPaths = config.chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
40+
: config.ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
3941
: [chromiumManifestPath, ffManifestPath]
4042
// BUMP versions
4143
const bumpedManifests = {}
4244
for (const manifestPath of manifestPaths) {
4345

4446
// Check latest commit for extension changes if forcible platform flag not set
4547
const platformManifestPath = path.dirname(manifestPath)
46-
if (!chromiumOnly && !ffOnly) {
48+
if (!config.chromiumOnly && !config.ffOnly) {
4749
console.log(`Checking last commit details for ${platformManifestPath}...`)
4850
try {
4951
const latestCommitMsg = spawnSync('git',
@@ -56,7 +58,8 @@
5658
} catch (err) { bump.log.error('Error checking git history\n') }
5759
}
5860

59-
console.log(`Bumping version in ${chromiumOnly ? 'Chromium' : ffOnly ? 'Firefox' : ''} manifest...`)
61+
console.log(`Bumping version in ${
62+
config.chromiumOnly ? 'Chromium' : config.ffOnly ? 'Firefox' : ''} manifest...`)
6063
const { oldVer, newVer } = bump.bumpDateVer({ filePath: manifestPath })
6164
bumpedManifests[`${platformManifestPath}/manifest.json`] = `${oldVer};${newVer}`
6265
}
@@ -69,7 +72,7 @@
6972

7073

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

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

chatgpt-omnibox/utils/bump/extension-manifests.js

Lines changed: 15 additions & 12 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'),
@@ -34,16 +36,16 @@
3436
// Init manifest PATHS
3537
const chromiumManifestPath = 'chromium/extension/manifest.json',
3638
ffManifestPath = 'firefox/extension/manifest.json'
37-
const manifestPaths = chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
38-
: ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
39+
const manifestPaths = config.chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
40+
: config.ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
3941
: [chromiumManifestPath, ffManifestPath]
4042
// BUMP versions
4143
const bumpedManifests = {}
4244
for (const manifestPath of manifestPaths) {
4345

4446
// Check latest commit for extension changes if forcible platform flag not set
4547
const platformManifestPath = path.dirname(manifestPath)
46-
if (!chromiumOnly && !ffOnly) {
48+
if (!config.chromiumOnly && !config.ffOnly) {
4749
console.log(`Checking last commit details for ${platformManifestPath}...`)
4850
try {
4951
const latestCommitMsg = spawnSync('git',
@@ -56,7 +58,8 @@
5658
} catch (err) { bump.log.error('Error checking git history\n') }
5759
}
5860

59-
console.log(`Bumping version in ${chromiumOnly ? 'Chromium' : ffOnly ? 'Firefox' : ''} manifest...`)
61+
console.log(`Bumping version in ${
62+
config.chromiumOnly ? 'Chromium' : config.ffOnly ? 'Firefox' : ''} manifest...`)
6063
const { oldVer, newVer } = bump.bumpDateVer({ filePath: manifestPath })
6164
bumpedManifests[`${platformManifestPath}/manifest.json`] = `${oldVer};${newVer}`
6265
}
@@ -69,7 +72,7 @@
6972

7073

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

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

chatgpt-widescreen/utils/bump/extension-manifests.js

Lines changed: 15 additions & 12 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'),
@@ -34,16 +36,16 @@
3436
// Init manifest PATHS
3537
const chromiumManifestPath = 'chromium/extension/manifest.json',
3638
ffManifestPath = 'firefox/extension/manifest.json'
37-
const manifestPaths = chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
38-
: ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
39+
const manifestPaths = config.chromiumOnly ? [chromiumManifestPath].filter(p => /chrom/i.test(p))
40+
: config.ffOnly ? [ffManifestPath].filter(p => /firefox/i.test(p))
3941
: [chromiumManifestPath, ffManifestPath]
4042
// BUMP versions
4143
const bumpedManifests = {}
4244
for (const manifestPath of manifestPaths) {
4345

4446
// Check latest commit for extension changes if forcible platform flag not set
4547
const platformManifestPath = path.dirname(manifestPath)
46-
if (!chromiumOnly && !ffOnly) {
48+
if (!config.chromiumOnly && !config.ffOnly) {
4749
console.log(`Checking last commit details for ${platformManifestPath}...`)
4850
try {
4951
const latestCommitMsg = spawnSync('git',
@@ -56,7 +58,8 @@
5658
} catch (err) { bump.log.error('Error checking git history\n') }
5759
}
5860

59-
console.log(`Bumping version in ${chromiumOnly ? 'Chromium' : ffOnly ? 'Firefox' : ''} manifest...`)
61+
console.log(`Bumping version in ${
62+
config.chromiumOnly ? 'Chromium' : config.ffOnly ? 'Firefox' : ''} manifest...`)
6063
const { oldVer, newVer } = bump.bumpDateVer({ filePath: manifestPath })
6164
bumpedManifests[`${platformManifestPath}/manifest.json`] = `${oldVer};${newVer}`
6265
}
@@ -69,7 +72,7 @@
6972

7073

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

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

0 commit comments

Comments
 (0)