Skip to content

Commit 89499d9

Browse files
committed
feat: fine-tune spinners and dim
1 parent 463e245 commit 89499d9

File tree

8 files changed

+203
-19
lines changed

8 files changed

+203
-19
lines changed

β€Žexamples/plugin/src/app/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ body {
33
}
44

55
.site-title a {
6-
color: cyan !important;
7-
background-color: white !important;
6+
color: slategray !important;
7+
background-color: cornsilk !important;
88
}

β€Žpackages/scripts/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@types/log-symbols": "^2.0.0",
3131
"@types/node": "^10.11.3",
3232
"@types/ora": "^1.3.4",
33+
"@types/update-notifier": "^2.2.0",
3334
"@types/webpack": "^4.4.13",
3435
"@types/webpack-assets-manifest": "^3.0.0",
3536
"@types/webpack-dev-middleware": "^2.0.2",
@@ -60,6 +61,7 @@
6061
"slugify": "^1.3.1",
6162
"style-loader": "^0.23.0",
6263
"uglifyjs-webpack-plugin": "^2.0.1",
64+
"update-notifier": "^2.5.0",
6365
"webpack": "^4.20.2",
6466
"webpack-assets-manifest": "^3.1.0",
6567
"webpack-dev-middleware": "^3.4.0",

β€Žpackages/scripts/src/bin/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import logSymbols from 'log-symbols';
33
import ora from 'ora';
44
import path from 'path';
55
import PrettyError from 'pretty-error';
6+
import { getProjectAndServerConfig } from '../config/getProjectAndServerConfig';
67
import { Build } from '../scripts/Build';
7-
import { getProjectAndServerConfig } from './getProjectAndServerConfig';
88
import { ProgramOptions } from './index';
99
import {
1010
endBuildInfo,

β€Žpackages/scripts/src/bin/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import chalk from 'chalk';
33
import program from 'commander';
44
import path from 'path';
55
import clearConsole from 'react-dev-utils/clearConsole';
6+
import updateNotifier from 'update-notifier';
67
import { build } from './build';
78
import { serve } from './serve';
89
import { contextHelp, printIntro } from './utils';
@@ -16,9 +17,13 @@ export interface ProgramOptions {
1617
let isValidCommand = false;
1718

1819
/* tslint:disable:no-require-imports no-var-requires non-literal-require */
19-
const pkg = require(path.resolve(__dirname, '../../package.json')) as {
20-
version: string;
21-
};
20+
const pkg = require(path.resolve(
21+
__dirname,
22+
'../../package.json'
23+
)) as updateNotifier.Package;
24+
25+
// Notify for updates
26+
updateNotifier({ pkg }).notify();
2227

2328
// Declare version and stuff
2429
program

β€Žpackages/scripts/src/bin/serve.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import ora from 'ora';
44
import path from 'path';
55
import PrettyError from 'pretty-error';
66
import clearConsole from 'react-dev-utils/clearConsole';
7+
import { getProjectAndServerConfig } from '../config/getProjectAndServerConfig';
78
import { Server } from '../scripts/Server';
8-
import { getProjectAndServerConfig } from './getProjectAndServerConfig';
99
import { ProgramOptions } from './index';
1010
import {
1111
endServeInfo,
@@ -82,7 +82,7 @@ export function serve(options: ProgramOptions | undefined): void {
8282
spinner.start('compiling...');
8383
spinner.stopAndPersist({
8484
symbol: logSymbols.success,
85-
text: 'compiled successfully',
85+
text: chalk.dim('compiled successfully'),
8686
});
8787
console.log(
8888
`${watchSymbol} watching for changes${watchEllipsis}`
@@ -91,7 +91,9 @@ export function serve(options: ProgramOptions | undefined): void {
9191
onError: msg => {
9292
spinner.stop();
9393
clearConsole();
94-
console.error(`${logSymbols.error} Failed to compile.\n`);
94+
console.error(
95+
`${logSymbols.error} ${chalk.dim('failed to compile')}\n`
96+
);
9597
msg.errors.forEach(e => console.log(e));
9698
console.log(
9799
`${watchSymbol} watching for changes${watchEllipsis}`
@@ -100,7 +102,11 @@ export function serve(options: ProgramOptions | undefined): void {
100102
onWarn: msg => {
101103
spinner.stop();
102104
clearConsole();
103-
console.log(`${logSymbols.warning} Compiled with warnings..\n`);
105+
console.log(
106+
`${logSymbols.warning} ${chalk.dim(
107+
'compiled with warnings...'
108+
)}\n`
109+
);
104110
msg.warnings.forEach(e => console.log(e));
105111
console.log(
106112
`${watchSymbol} watching for changes${watchEllipsis}`
@@ -111,7 +117,7 @@ export function serve(options: ProgramOptions | undefined): void {
111117
clearConsole();
112118
serverInfo(server.getServerUrl());
113119
console.log(
114-
`${logSymbols.success} ${chalk.dim('server started')}`
120+
`${logSymbols.success} ${chalk.dim('server started!')}`
115121
);
116122
console.log(
117123
`${watchSymbol} watching for changes${watchEllipsis}`

β€Žpackages/scripts/src/bin/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const wpackLogo = gradient.instagram.multiline(
1616
})
1717
);
1818

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

2222
export const bulletSymbol = chalk.magenta(figures.pointer);

β€Žpackages/scripts/src/bin/getProjectAndServerConfig.ts renamed to β€Žpackages/scripts/src/config/getProjectAndServerConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
2-
import { ProjectConfig } from '../config/project.config.default';
3-
import { ServerConfig } from '../config/server.config.default';
2+
import { ProjectConfig } from './project.config.default';
3+
import { ServerConfig } from './server.config.default';
44
// tslint:disable: non-literal-require
55
export function getProjectAndServerConfig(
66
cwd: string,

0 commit comments

Comments
Β (0)