Skip to content

Commit 8078df0

Browse files
committed
Generalized repoName init
1 parent e9d3e43 commit 8078df0

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

amazongpt/utils/bump/resources.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
ssri = require('ssri') // to generate SHA-256 hashes
1111

1212
// Init REPO context
13-
const repoName = 'amazongpt',
14-
userJSfilePath = `./greasemonkey/${repoName}.user.js`
13+
const repoName = (() => {
14+
const path = require('path') ; let dir = __dirname
15+
while (!fs.existsSync(path.join(dir, 'package.json'))) dir = path.dirname(dir)
16+
return path.basename(dir)
17+
})()
18+
const userJSfilePath = `./greasemonkey/${repoName}.user.js`
1519

1620
// Init UI COLORS
1721
const nc = '\x1b[0m', // no color

bravegpt/utils/bump/resources.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
ssri = require('ssri') // to generate SHA-256 hashes
1111

1212
// Init REPO context
13-
const repoName = 'bravegpt',
14-
userJSfilePath = `./greasemonkey/${repoName}.user.js`
13+
const repoName = (() => {
14+
const path = require('path') ; let dir = __dirname
15+
while (!fs.existsSync(path.join(dir, 'package.json'))) dir = path.dirname(dir)
16+
return path.basename(dir)
17+
})()
18+
const userJSfilePath = `./greasemonkey/${repoName}.user.js`
1519

1620
// Init UI COLORS
1721
const nc = '\x1b[0m', // no color

duckduckgpt/utils/bump/resources.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
ssri = require('ssri') // to generate SHA-256 hashes
1111

1212
// Init REPO context
13-
const repoName = 'duckduckgpt',
14-
userJSfilePath = `./greasemonkey/${repoName}.user.js`
13+
const repoName = (() => {
14+
const path = require('path') ; let dir = __dirname
15+
while (!fs.existsSync(path.join(dir, 'package.json'))) dir = path.dirname(dir)
16+
return path.basename(dir)
17+
})()
18+
const userJSfilePath = `./greasemonkey/${repoName}.user.js`
1519

1620
// Init UI COLORS
1721
const nc = '\x1b[0m', // no color

googlegpt/utils/bump/resources.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
ssri = require('ssri') // to generate SHA-256 hashes
1111

1212
// Init REPO context
13-
const repoName = 'googlegpt',
14-
userJSfilePath = `./greasemonkey/${repoName}.user.js`
13+
const repoName = (() => {
14+
const path = require('path') ; let dir = __dirname
15+
while (!fs.existsSync(path.join(dir, 'package.json'))) dir = path.dirname(dir)
16+
return path.basename(dir)
17+
})()
18+
const userJSfilePath = `./greasemonkey/${repoName}.user.js`
1519

1620
// Init UI COLORS
1721
const nc = '\x1b[0m', // no color

0 commit comments

Comments
 (0)