Skip to content

Commit

Permalink
feat: fine-tune spinners and dim
Browse files Browse the repository at this point in the history
  • Loading branch information
swashata committed Oct 9, 2018
1 parent 463e245 commit 89499d9
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 19 deletions.
4 changes: 2 additions & 2 deletions examples/plugin/src/app/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ body {
}

.site-title a {
color: cyan !important;
background-color: white !important;
color: slategray !important;
background-color: cornsilk !important;
}
2 changes: 2 additions & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@types/log-symbols": "^2.0.0",
"@types/node": "^10.11.3",
"@types/ora": "^1.3.4",
"@types/update-notifier": "^2.2.0",
"@types/webpack": "^4.4.13",
"@types/webpack-assets-manifest": "^3.0.0",
"@types/webpack-dev-middleware": "^2.0.2",
Expand Down Expand Up @@ -60,6 +61,7 @@
"slugify": "^1.3.1",
"style-loader": "^0.23.0",
"uglifyjs-webpack-plugin": "^2.0.1",
"update-notifier": "^2.5.0",
"webpack": "^4.20.2",
"webpack-assets-manifest": "^3.1.0",
"webpack-dev-middleware": "^3.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/src/bin/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import logSymbols from 'log-symbols';
import ora from 'ora';
import path from 'path';
import PrettyError from 'pretty-error';
import { getProjectAndServerConfig } from '../config/getProjectAndServerConfig';
import { Build } from '../scripts/Build';
import { getProjectAndServerConfig } from './getProjectAndServerConfig';
import { ProgramOptions } from './index';
import {
endBuildInfo,
Expand Down
11 changes: 8 additions & 3 deletions packages/scripts/src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import chalk from 'chalk';
import program from 'commander';
import path from 'path';
import clearConsole from 'react-dev-utils/clearConsole';
import updateNotifier from 'update-notifier';
import { build } from './build';
import { serve } from './serve';
import { contextHelp, printIntro } from './utils';
Expand All @@ -16,9 +17,13 @@ export interface ProgramOptions {
let isValidCommand = false;

/* tslint:disable:no-require-imports no-var-requires non-literal-require */
const pkg = require(path.resolve(__dirname, '../../package.json')) as {
version: string;
};
const pkg = require(path.resolve(
__dirname,
'../../package.json'
)) as updateNotifier.Package;

// Notify for updates
updateNotifier({ pkg }).notify();

// Declare version and stuff
program
Expand Down
16 changes: 11 additions & 5 deletions packages/scripts/src/bin/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import ora from 'ora';
import path from 'path';
import PrettyError from 'pretty-error';
import clearConsole from 'react-dev-utils/clearConsole';
import { getProjectAndServerConfig } from '../config/getProjectAndServerConfig';
import { Server } from '../scripts/Server';
import { getProjectAndServerConfig } from './getProjectAndServerConfig';
import { ProgramOptions } from './index';
import {
endServeInfo,
Expand Down Expand Up @@ -82,7 +82,7 @@ export function serve(options: ProgramOptions | undefined): void {
spinner.start('compiling...');
spinner.stopAndPersist({
symbol: logSymbols.success,
text: 'compiled successfully',
text: chalk.dim('compiled successfully'),
});
console.log(
`${watchSymbol} watching for changes${watchEllipsis}`
Expand All @@ -91,7 +91,9 @@ export function serve(options: ProgramOptions | undefined): void {
onError: msg => {
spinner.stop();
clearConsole();
console.error(`${logSymbols.error} Failed to compile.\n`);
console.error(
`${logSymbols.error} ${chalk.dim('failed to compile')}\n`
);
msg.errors.forEach(e => console.log(e));
console.log(
`${watchSymbol} watching for changes${watchEllipsis}`
Expand All @@ -100,7 +102,11 @@ export function serve(options: ProgramOptions | undefined): void {
onWarn: msg => {
spinner.stop();
clearConsole();
console.log(`${logSymbols.warning} Compiled with warnings..\n`);
console.log(
`${logSymbols.warning} ${chalk.dim(
'compiled with warnings...'
)}\n`
);
msg.warnings.forEach(e => console.log(e));
console.log(
`${watchSymbol} watching for changes${watchEllipsis}`
Expand All @@ -111,7 +117,7 @@ export function serve(options: ProgramOptions | undefined): void {
clearConsole();
serverInfo(server.getServerUrl());
console.log(
`${logSymbols.success} ${chalk.dim('server started')}`
`${logSymbols.success} ${chalk.dim('server started!')}`
);
console.log(
`${watchSymbol} watching for changes${watchEllipsis}`
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/src/bin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const wpackLogo = gradient.instagram.multiline(
})
);

export const watchSymbol = chalk.yellow(figures.circleDouble);
export const watchSymbol = 'πŸ‘€';
export const watchEllipsis = chalk.dim(figures.ellipsis);

export const bulletSymbol = chalk.magenta(figures.pointer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import { ProjectConfig } from '../config/project.config.default';
import { ServerConfig } from '../config/server.config.default';
import { ProjectConfig } from './project.config.default';
import { ServerConfig } from './server.config.default';
// tslint:disable: non-literal-require
export function getProjectAndServerConfig(
cwd: string,
Expand Down
Loading

0 comments on commit 89499d9

Please sign in to comment.