Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
chore(expo-cli): remove log.raw (#2111)
Browse files Browse the repository at this point in the history
  • Loading branch information
fson authored May 15, 2020
1 parent c699448 commit f6dc4cf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 41 deletions.
3 changes: 1 addition & 2 deletions packages/expo-cli/src/commands/build/BaseBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ Please see the docs (${chalk.underline(
numberOfRemainingPriorityBuilds: number;
hasUnlimitedPriorityBuilds?: boolean;
}) {
log.raw();
log('=================');
log(' Builds Statuses ');
log('=================\n');
Expand Down Expand Up @@ -318,7 +317,7 @@ ${job.id}
}
const job = fp.compose(
fp.head,
fp.filter(job => buildId && (job as any).id === buildId),
fp.filter((job) => buildId && (job as any).id === buildId),
fp.getOr([], 'jobs')
)(res);

Expand Down
1 change: 0 additions & 1 deletion packages/expo-cli/src/commands/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ async function action(projectDir: string, options: { sendTo?: string } & URLOpti
let url = await UrlUtils.constructManifestUrlAsync(projectDir);

log('Your project manifest URL is\n\n' + chalk.underline(url) + '\n');
log.raw(url);

let shouldQuit = false;
if (await urlOpts.handleMobileOptsAsync(projectDir, options)) {
Expand Down
1 change: 0 additions & 1 deletion packages/expo-cli/src/commands/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ async function action(projectDir: string, options: ProjectUrlOptions & URLOption
urlOpts.printQRCode(url);

log('Your URL is\n\n' + chalk.underline(url) + '\n');
log.raw(url);

if (!options.web) {
await printRunInstructionsAsync();
Expand Down
7 changes: 2 additions & 5 deletions packages/expo-cli/src/exp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ Command.prototype.asyncAction = function (asyncFn: Action, skipUpdateCheck: bool

try {
let options = last(args);
if (options.output === 'raw') {
log.config.raw = true;
}
if (options.offline) {
Config.offline = true;
}
Expand Down Expand Up @@ -364,7 +361,7 @@ function runAsync(programName: string) {
process.exit(0);
});

program.on('command:*', subCommand => {
program.on('command:*', (subCommand) => {
let msg = `"${subCommand}" is not an expo command. See "expo --help" for the full list of commands.`;
const availableCommands = program.commands.map((cmd: Command) => cmd._name);
// finding the best match whose edit distance is less than 40% of their length.
Expand Down Expand Up @@ -562,7 +559,7 @@ export function run(programName: string) {
} else {
await Promise.all([writePathAsync(), runAsync(programName)]);
}
})().catch(e => {
})().catch((e) => {
console.error('Uncaught Error', e);
process.exit(1);
});
Expand Down
34 changes: 2 additions & 32 deletions packages/expo-cli/src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ function getPrefix(chalkColor: Color) {

function withPrefixAndTextColor(args: any[], chalkColor: Color = chalk.gray) {
if (program.nonInteractive) {
return [getPrefix(chalkColor), ...args.map(arg => chalkColor(arg))];
return [getPrefix(chalkColor), ...args.map((arg) => chalkColor(arg))];
} else {
return args.map(arg => chalkColor(arg));
return args.map((arg) => chalkColor(arg));
}
}

Expand All @@ -88,10 +88,6 @@ function withPrefix(args: any[], chalkColor = chalk.gray) {
}

function log(...args: any[]) {
if (log.config.raw) {
return;
}

respectProgressBars(() => {
consoleLog(...withPrefix(args));
});
Expand Down Expand Up @@ -128,10 +124,6 @@ log.setSpinner = function setSpinner(oraSpinner: any) {
};

log.error = function error(...args: any[]) {
if (log.config.raw) {
return;
}

respectProgressBars(() => {
consoleError(...withPrefixAndTextColor(args, chalk.red));
});
Expand All @@ -144,10 +136,6 @@ log.nestedError = function (message: string) {
};

log.warn = function warn(...args: any[]) {
if (log.config.raw) {
return;
}

respectProgressBars(() => {
consoleWarn(...withPrefixAndTextColor(args, chalk.yellow));
});
Expand All @@ -160,29 +148,11 @@ log.nestedWarn = function (message: string) {
};

log.gray = function (...args: any[]) {
if (log.config.raw) {
return;
}

respectProgressBars(() => {
consoleLog(...withPrefixAndTextColor(args));
});
};

log.raw = function (...args: any[]) {
if (!log.config.raw) {
return;
}

respectProgressBars(() => {
consoleLog(...args);
});
};

log.chalk = chalk;

log.config = {
raw: false,
};

export default log;

0 comments on commit f6dc4cf

Please sign in to comment.