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

remove 运行包的chalk #20

Merged
merged 1 commit into from Jan 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/award-scripts/src/tools/server/server.ts
Expand Up @@ -6,6 +6,7 @@ import * as https from 'https';
import { List } from 'immutable';
import * as fs from 'fs-extra';
import * as path from 'path';
import * as chalk from 'chalk';
import { renderToString } from 'react-dom/server';
import { Helmet as Head } from 'react-helmet';
import { getBundles } from 'react-loadable/webpack';
Expand Down Expand Up @@ -270,4 +271,20 @@ export default class DevServer extends Server {
public createRouter() {
super.createRouter(remove);
}

/**
* hook log
*/
public log(cb: Function) {
if (this.dev) {
console.warn(
chalk.red(
`${chalk.yellow('[development]')} 为了表意准确请使用${chalk.green(
'app.catch'
)}替换app.log,使用方式一致,未来我们会废除app.log`
)
);
}
super.log(cb);
}
}
10 changes: 0 additions & 10 deletions packages/award-server/src/server/base.ts
Expand Up @@ -2,7 +2,6 @@
* Server对象的基础类
*/
import * as Koa from 'koa';
import * as chalk from 'chalk';
import { Seq, List, fromJS } from 'immutable';
import * as fs from 'fs-extra';
import * as Path from 'path';
Expand Down Expand Up @@ -259,15 +258,6 @@ export default class Base {
}

public log(cb: Function) {
if (this.dev) {
console.warn(
chalk.red(
`${chalk.yellow('[development]')} 为了表意准确请使用${chalk.green(
'app.catch'
)}替换app.log,使用方式一致,未来我们会废除app.log`
)
);
}
this.handleError(cb);
}

Expand Down