Skip to content

Commit

Permalink
Added log.hadLineBreak tracking to log methods to support automatic…
Browse files Browse the repository at this point in the history
… insertion
  • Loading branch information
adamlui committed Dec 17, 2024
1 parent 6c13835 commit 0509215
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
12 changes: 7 additions & 5 deletions chatgpt-auto-continue/utils/bump/js-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@

// Define FUNCTIONS

const log = {
info(msg) { console.log(bw + msg + nc) },
working(msg) { console.log(by + msg + nc) },
success(msg) { console.log(bg + msg + nc) }
}
const log = {};
['info', 'working', 'success'].forEach(lvl => {
log[lvl] = function(msg) {
const logColor = lvl == 'info' ? bw : lvl == 'working' ? by : lvl == 'success' ? bg : ''
console.log(logColor + msg + nc) ; log.hadLineBreak = msg.toString().endsWith('\n')
}
})

function fetchData(url) {
if (typeof fetch == 'undefined') // polyfill for Node.js < v21
Expand Down
12 changes: 7 additions & 5 deletions chatgpt-infinity/utils/bump/js-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@

// Define FUNCTIONS

const log = {
info(msg) { console.log(bw + msg + nc) },
working(msg) { console.log(by + msg + nc) },
success(msg) { console.log(bg + msg + nc) }
}
const log = {};
['info', 'working', 'success'].forEach(lvl => {
log[lvl] = function(msg) {
const logColor = lvl == 'info' ? bw : lvl == 'working' ? by : lvl == 'success' ? bg : ''
console.log(logColor + msg + nc) ; log.hadLineBreak = msg.toString().endsWith('\n')
}
})

function fetchData(url) {
if (typeof fetch == 'undefined') // polyfill for Node.js < v21
Expand Down
12 changes: 7 additions & 5 deletions chatgpt-widescreen/utils/bump/js-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@

// Define FUNCTIONS

const log = {
info(msg) { console.log(bw + msg + nc) },
working(msg) { console.log(by + msg + nc) },
success(msg) { console.log(bg + msg + nc) }
}
const log = {};
['info', 'working', 'success'].forEach(lvl => {
log[lvl] = function(msg) {
const logColor = lvl == 'info' ? bw : lvl == 'working' ? by : lvl == 'success' ? bg : ''
console.log(logColor + msg + nc) ; log.hadLineBreak = msg.toString().endsWith('\n')
}
})

function fetchData(url) {
if (typeof fetch == 'undefined') // polyfill for Node.js < v21
Expand Down
13 changes: 7 additions & 6 deletions utils/bump/js-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@

// Define FUNCTIONS

const log = {
dev(msg) { if (devMode) console.log(msg) },
info(msg) { console.log(bw + msg + nc) },
working(msg) { console.log(by + msg + nc) },
success(msg) { console.log(bg + msg + nc) }
}
const log = {};
['dev', 'info', 'working', 'success'].forEach(lvl => {
log[lvl] = function(msg) {
const logColor = lvl == 'info' ? bw : lvl == 'working' ? by : lvl == 'success' ? bg : ''
console.log(logColor + msg + nc) ; log.hadLineBreak = msg.toString().endsWith('\n')
}
})

async function findUserJS(dir = './') {
const userJSfiles = []
Expand Down

0 comments on commit 0509215

Please sign in to comment.