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

fix: logger #70

Merged
merged 1 commit into from
Jan 30, 2024
Merged
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
1 change: 1 addition & 0 deletions packages/cli/bin/rapid.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const argv = yargs
'If the problem continues, please provide feedback at:',
'https://github.com/cnpm/rapid/issues',
]);
process.exitCode = 1;
})
.help()
.parse();
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Alert {
message = this.formatMessage(message);
if (!isTTY) {
console.log(message);
process.exit(1);
return;
}
const boxedMessage = boxen(message, {
padding: 1,
Expand All @@ -95,7 +95,7 @@ class Alert {
titleAlignment: 'center',
});
console.log(boxedMessage);
process.exit(1);
return;
}

static success(title = 'Success', message = [ 'Congratulations', 'The operation was successful' ]) {
Expand All @@ -119,6 +119,7 @@ class Alert {
class Spin {
constructor({ title = 'processing', showDots = false }) {
const { createSpinner } = require('nanospinner');
this.start = Date.now();

if (!isTTY) {
console.log(`[rapid] ${title}`);
Expand All @@ -127,7 +128,6 @@ class Spin {

this.spinner = createSpinner(title).start();
this.dots = 0;
this.start = Date.now();

if (showDots) {
this.interval = setInterval(() => {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ exports.readPackageLock = async function readPackageLock(cwd) {
'We only support package-lock.json version 3.',
'Run `npm i --package-lock-only` to generate it.',
]);
throw e;
}
};

Expand Down
Loading