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

Add option to not show progress animations in logs #942

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,19 @@ prog
.example(
'build --extractErrors=https://reactjs.org/docs/error-decoder.html?invariant='
)
.option('--noProgress', "Don't show progress animations")
.example('build --noProgress')
.action(async (dirtyOpts: BuildOpts) => {
const opts = await normalizeOpts(dirtyOpts);
const buildConfigs = await createBuildConfigs(opts);
await cleanDistFolder();
const logger = await createProgressEstimator();
const progress =
process.stdout.isTTY && !process.env.CI && !opts.noProgress;
const logger = progress
? await createProgressEstimator()
: (_promise: unknown, message: string) => {
console.log(message);
};
if (opts.format.includes('cjs')) {
const promise = writeCjsEntryFile(opts.name).catch(logError);
logger(promise, 'Creating entry file');
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ interface SharedOpts {
tsconfig?: string;
// Is error extraction running?
extractErrors?: boolean;
// Should omit progress animations?
noProgress?: boolean;
}

export type ModuleFormat = 'cjs' | 'umd' | 'esm' | 'system';
Expand Down