Skip to content

Commit

Permalink
chore(deps): Update dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
darkobits committed Dec 2, 2024
1 parent 9e19301 commit 2fd216f
Show file tree
Hide file tree
Showing 10 changed files with 846 additions and 348 deletions.
1,080 changes: 785 additions & 295 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
"help": "nr --scripts"
},
"dependencies": {
"@darkobits/log": "^2.0.0-beta.15",
"@darkobits/saffron": "~0.32.17",
"@darkobits/log": "^2.0.0-beta.18",
"@darkobits/saffron": "~0.32.19",
"@types/yargs-unparser": "^2.0.3",
"boxen": "^8.0.1",
"callsites": "^4.2.0",
"deepmerge": "^4.3.1",
"execa": "^9.4.1",
"execa": "^9.5.1",
"kebabcase-keys": "^1.0.0",
"micromatch": "^4.0.8",
"npm-run-path": "^6.0.0",
"ow": "~1.1.1",
"ow": "^1.0.0",
"p-all": "^5.0.0",
"p-series": "^3.0.0",
"ramda": "^0.30.1",
Expand All @@ -50,7 +50,7 @@
"yargs-unparser": "^2.0.0"
},
"devDependencies": {
"@darkobits/ts": "~0.23.3",
"@darkobits/ts": "~0.23.4",
"@types/is-ci": "^3.0.4",
"@types/kebabcase-keys": "^1.0.5",
"@types/micromatch": "^4.0.9",
Expand All @@ -59,6 +59,12 @@
"is-ci": "^3.0.1"
},
"overrides": {
"eslint": "^9.8.0"
"eslint": "^9.8.0",
"@darkobits/nr": {
"@darkobits/log": "2.0.0-beta.15"
},
"@darkobits/saffron": {
"@darkobits/log": "2.0.0-beta.18"
}
}
}
10 changes: 5 additions & 5 deletions src/lib/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function commandBuilder(builderOptions: CommandBuilderOptions): CommandThunk {

const commandThunk = async () => {
try {
const runTime = log.createTimer()
const runTime = log.chronograph()
const childProcess = executor(commandExecutorOptions)

// If the user provided a custom prefix function, generate it now.
Expand All @@ -292,12 +292,12 @@ function commandBuilder(builderOptions: CommandBuilderOptions): CommandThunk {
if (code === 0 || reject === false) {
// If the command exited successfully or if we are ignoring failed
// commands, log completion time.
log.verbose(log.prefix(prefixedName), '•', chalk.gray(runTime))
log.verbose(log.chalk.dim.cyan(prefixedName), '•', chalk.gray(runTime))
}
})

// log.verbose(
// log.prefix(prefixedName),
// log.chalk.dim.cyan(prefixedName),
// '•',
// chalk.gray(getEscapedCommand(executable, childProcess.spawnargs))
// );
Expand Down Expand Up @@ -345,7 +345,7 @@ const executeCommand: CommandExecutor = (options: CommandExecutorOptions) => {

// Print the exact command we are about to run.
log.verbose(
log.prefix(prefixedName),
log.chalk.dim.cyan(prefixedName),
'•',
chalk.gray(getEscapedCommand(executable, unParsedArguments))
)
Expand All @@ -371,7 +371,7 @@ const executeNodeCommand: CommandExecutor = (options: CommandExecutorOptions) =>

// Print the exact command we are about to run.
log.verbose(
log.prefix(prefixedName),
log.chalk.dim.cyan(prefixedName),
'•',
chalk.gray('node'),
chalk.gray(getEscapedCommand(executable, unParsedArguments))
Expand Down
6 changes: 3 additions & 3 deletions src/lib/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export function fn(fn: Fn, options: FnOptions = {}) {

const FnThunk = async () => {
try {
const runTime = log.createTimer()
log.verbose(log.prefix(prefixedName), '•', chalk.cyan('start'))
const runTime = log.chronograph()
log.verbose(log.chalk.dim.cyan(prefixedName), '•', chalk.cyan('start'))
await fn()
log.verbose(log.prefix(prefixedName), '•', chalk.cyan(runTime))
log.verbose(log.chalk.dim.cyan(prefixedName), '•', chalk.cyan(runTime))
} catch (err: any) {
throw new Error(`${prefixedName} failed • ${err.message}`, { cause: err })
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import LogFactory from '@darkobits/log'
import { createLogger } from '@darkobits/log'

export { default as LogPipe } from '@darkobits/log/dist/lib/log-pipe.js'
export { LogPipe } from '@darkobits/log/dist/lib/log-pipe.js'

export default LogFactory({ heading: 'nr' })
export default createLogger({ heading: 'nr' })
10 changes: 5 additions & 5 deletions src/lib/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export function matchScript(value?: string) {
const descriptor = scripts.get(scriptName ?? '')
if (!descriptor) throw new Error(`[matchScript] "${value}" did not match any scripts.`)

log.verbose(log.prefix('matchScript'), `Query ${chalk.green(value)} matched script ${chalk.green(scriptName)}.`)
log.verbose(log.chalk.dim.cyan('matchScript'), `Query ${chalk.green(value)} matched script ${chalk.green(scriptName)}.`)

return descriptor
}
Expand Down Expand Up @@ -362,7 +362,7 @@ export function script(name: string, instructions: InstructionSet, options: Scri
// ----- [2] Create Script Thunk -------------------------------------------

const scriptThunk = async () => {
const runTime = log.createTimer()
const runTime = log.chronograph()

// Map each entry in the instruction sequence to its corresponding
// command, function, or script. For nested arrays, map the array to a
Expand All @@ -383,7 +383,7 @@ export function script(name: string, instructions: InstructionSet, options: Scri
// it is possible that a script has zero instructions under certain
// conditions. When this is the case, issue a warning and bail.
if (resolvedInstructions.length === 0) {
log.warn(log.prefix(logPrefix), chalk.yellow.bold(`Script "${scriptDisplayName}" contains no instructions.`))
log.warn(log.chalk.dim.cyan(logPrefix), chalk.yellow.bold(`Script "${scriptDisplayName}" contains no instructions.`))
return
}

Expand All @@ -397,7 +397,7 @@ export function script(name: string, instructions: InstructionSet, options: Scri
if (timing) {
heroLog(chalk.gray.dim(`○ ${scriptDisplayName}`))
} else {
log.verbose(log.prefix(logPrefix), '•', chalk.green('start'))
log.verbose(log.chalk.dim.cyan(logPrefix), '•', chalk.green('start'))
}

await pSeries<any>(resolvedInstructions)
Expand All @@ -409,7 +409,7 @@ export function script(name: string, instructions: InstructionSet, options: Scri
log.chalk.greenBright(runTime)
].join(' '))
} else {
log.verbose(log.prefix(logPrefix), '•', chalk.green(runTime))
log.verbose(log.chalk.green(logPrefix), '•', chalk.green(runTime))
}
} catch (err: any) {
throw new Error(`${logPrefix} failed • ${err.message}`, { cause: err })
Expand Down
22 changes: 11 additions & 11 deletions tests/fixtures/cjs/dynamic-import.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const LogFactory = require('@darkobits/log')

const log = LogFactory({ heading: 'smokeTest' })

// Note: This is how nr must be imported from a CJS context when it is compiled
// as ESM.
async function main() {
const { defineConfig } = await import('../../../dist/index.js')
if (typeof defineConfig !== 'function') throw new Error('Dynamic import of this package failed.')
const { createLogger } = await import('@darkobits/log')
const log = createLogger({ heading: 'smokeTest' })

try {
const { defineConfig } = await import('../../../dist/index.js')
if (typeof defineConfig !== 'function') throw new Error('Dynamic import of this package failed.')
log.verbose(log.chalk.dim.cyan('cjs:dynamic-import'), log.chalk.green('success'))
} catch (err) {
log.error(log.chalk.dim.cyan('cjs:dynamic-import'), err)
}
}

void main().then(() => {
log.verbose(log.prefix('cjs:dynamic-import'), log.chalk.green('success'))
}).catch(err => {
log.error(log.prefix('cjs:dynamic-import'), err)
process.exit(1)
})
void main()
33 changes: 18 additions & 15 deletions tests/fixtures/cjs/require.test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
const LogFactory = require('@darkobits/log')

const log = LogFactory({ heading: 'smokeTest' })

// Note: We should not be able to require() this package because it is compiled
// as ESM. If we get an ERR_REQUIRE_ESM, the test will still pass. Any other
// error will result in a failure.
try {
const { defineConfig } = require('../../../dist')
if (typeof defineConfig !== 'function') throw new Error('[fixtures:cjs] "require" failed.')
log.verbose(log.prefix('cjs:require'), log.chalk.green('success'))
} catch (err) {
if (err.message.includes('require() of ES Module')) {
log.verbose(log.prefix('cjs:require'), log.chalk.yellow.dim('require() of this package failed'))
} else {
log.error(log.prefix('cjs:require'), err)
process.exit(1)
async function main() {
const { createLogger } = await import('@darkobits/log')
const log = createLogger({ heading: 'smokeTest' })

try {
const { defineConfig } = require('../../../dist')
if (typeof defineConfig !== 'function') throw new Error('[fixtures:cjs] "require" failed.')
log.verbose(log.chalk.dim.cyan('cjs:require'), log.chalk.green('success'))
} catch (err) {
if (err.message.includes('require() of ES Module')) {
log.verbose(log.chalk.dim.cyan('cjs:require'), log.chalk.yellow.dim('require() of this package failed'))
} else {
log.error(log.chalk.dim.cyan('cjs:require'), err)
process.exit(1)
}
}
}
}

void main()
8 changes: 4 additions & 4 deletions tests/fixtures/esm/import.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import LogFactory from '@darkobits/log'
import { createLogger } from '@darkobits/log'

const log = LogFactory({ heading: 'smokeTest' })
const log = createLogger({ heading: 'smokeTest' })

import { defineConfig } from '../../../dist/index.js'

if (typeof defineConfig !== 'function') {
log.error(log.prefix('esm:import'), `Expected type of default export to be "function", got "${typeof defaultExport}".`)
log.error(log.chalk.dim.cyan('esm:import'), `Expected type of default export to be "function", got "${typeof defaultExport}".`)
process.exit(1)
} else {
log.verbose(log.prefix('esm:import'), log.chalk.green('success'))
log.verbose(log.chalk.dim.cyan('esm:import'), log.chalk.green('success'))
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "@darkobits/ts/tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"baseUrl": "src",
"outDir": "dist"
}
Expand Down

0 comments on commit 2fd216f

Please sign in to comment.