Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add consola 3.0.x #83

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"command-line-args": "^5.1.1",
"command-line-usage": "^6.1.0",
"concat-stream": "^2.0.0",
"consola": "^2.15.0",
"consola": "^3.0.0",
"form-data": "^3.0.0",
"glob": "^7.1.6",
"read-pkg-up": "^7.0.1"
Expand Down
6 changes: 3 additions & 3 deletions src/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import consolaGlobalInstance, { LogLevel } from 'consola'
import consolaGlobalInstance, { LogLevels, LogLevel } from 'consola'

export default consolaGlobalInstance
consolaGlobalInstance.level = LogLevel.Debug
consolaGlobalInstance.level = LogLevels.debug;

export type Logger = {
trace: (...args: unknown[]) => void,
Expand All @@ -23,4 +23,4 @@ export const noopLogger: Logger = {
error: () => {},
fatal: () => {},
level: -1
}
}
8 changes: 4 additions & 4 deletions src/bin/__test__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import logger from '../../Logger'
import * as browser from '../../uploaders/BrowserUploader'
import * as node from '../../uploaders/NodeUploader'
import * as reactNative from '../../uploaders/ReactNativeUploader'
import { LogLevel } from 'consola'
import { LogLevels } from 'consola'

jest.mock('../../uploaders/BrowserUploader')
jest.mock('../../uploaders/NodeUploader')
Expand Down Expand Up @@ -106,7 +106,7 @@ test('cli: upload-node incompatible opts', async () => {
test('cli: upload-node --quiet', async () => {
await run(['upload-node', '--api-key', '123', '--bundle', 'bundle.js', '--source-map', 'bundle.js.map', '--quiet'])
expect(node.uploadOne).toHaveBeenCalledTimes(1)
expect(logger.level).toBe(LogLevel.Success)
expect(logger.level).toBe(LogLevels.success)
})

test('cli: upload-node --app-version and --detect-app-version', async () => {
Expand Down Expand Up @@ -194,7 +194,7 @@ test('cli: upload-browser incompatible opts', async () => {
test('cli: upload-browser --quiet', async () => {
await run(['upload-browser', '--api-key', '123', '--bundle-url', 'http:https://my.url/dist/bundle.js', '--source-map', 'bundle.js.map', '--quiet'])
expect(browser.uploadOne).toHaveBeenCalledTimes(1)
expect(logger.level).toBe(LogLevel.Success)
expect(logger.level).toBe(LogLevels.success)
})

test('cli: upload-browser --app-version and --detect-app-version', async () => {
Expand Down Expand Up @@ -473,7 +473,7 @@ test('cli: upload-react-native --quiet', async () => {
appVersion: '1.0.2'
}))

expect(logger.level).toBe(LogLevel.Success)
expect(logger.level).toBe(LogLevels.success)
expect(process.exitCode).toBe(0)
})

Expand Down
4 changes: 2 additions & 2 deletions src/commands/UploadBrowserCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import commandLineArgs, { OptionDefinition } from 'command-line-args'
import commandLineUsage from 'command-line-usage'
import * as browser from '../uploaders/BrowserUploader'
import logger from '../Logger'
import { LogLevel } from 'consola'
import { LogLevels } from 'consola'
import { commonCommandDefs } from './CommandDefinitions'

export default async function uploadBrowser (argv: string[], opts: Record<string, unknown>): Promise<void> {
Expand All @@ -16,7 +16,7 @@ export default async function uploadBrowser (argv: string[], opts: Record<string
try {
browserOpts = commandLineArgs(defs, { argv, camelCase: true })
if (opts.help) return browserUsage()
if (browserOpts.quiet) logger.level = LogLevel.Success
if (browserOpts.quiet) logger.level = LogLevels.success
validateBrowserOpts(browserOpts)
} catch (e) {
process.exitCode = 1
Expand Down
4 changes: 2 additions & 2 deletions src/commands/UploadNodeCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import commandLineArgs, { OptionDefinition } from 'command-line-args'
import commandLineUsage from 'command-line-usage'
import * as node from '../uploaders/NodeUploader'
import logger from '../Logger'
import { LogLevel } from 'consola'
import { LogLevels } from 'consola'
import { commonCommandDefs } from './CommandDefinitions'

export default async function uploadNode (argv: string[], opts: Record<string, unknown>): Promise<void> {
Expand All @@ -16,7 +16,7 @@ export default async function uploadNode (argv: string[], opts: Record<string, u
try {
nodeOpts = commandLineArgs(defs, { argv, camelCase: true })
if (opts.help) return nodeUsage()
if (nodeOpts.quiet) logger.level = LogLevel.Success
if (nodeOpts.quiet) logger.level = LogLevels.success
validatenodeOpts(nodeOpts)
} catch (e) {
process.exitCode = 1
Expand Down
4 changes: 2 additions & 2 deletions src/commands/UploadReactNativeCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import commandLineArgs, { OptionDefinition } from 'command-line-args'
import commandLineUsage from 'command-line-usage'
import logger from '../Logger'
import { LogLevel } from 'consola'
import { LogLevels } from 'consola'
import { commonCommandDefs } from './CommandDefinitions'
import { uploadOne, fetchAndUploadOne } from '../uploaders/ReactNativeUploader'

Expand All @@ -23,7 +23,7 @@ export default async function uploadReactNative (argv: string[], opts: Record<st
reactNativeOpts = commandLineArgs(defs, { argv, camelCase: true })

if (reactNativeOpts.quiet) {
logger.level = LogLevel.Success
logger.level = LogLevels.success
}

validateReactNativeOpts(reactNativeOpts)
Expand Down