Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
46eeabca
Commit
46eeabca
authored
7 years ago
by
Dan Abramov
Committed by
GitHub
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Tweak colors for better contrast on Windows (#2180)
parent
134d2297
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/react-dev-utils/eslintFormatter.js
+2
-2
packages/react-dev-utils/eslintFormatter.js
packages/react-scripts/scripts/start.js
+21
-12
packages/react-scripts/scripts/start.js
packages/react-scripts/scripts/utils/createWebpackCompiler.js
+3
-3
...ages/react-scripts/scripts/utils/createWebpackCompiler.js
with
26 additions
and
17 deletions
+26
-17
packages/react-dev-utils/eslintFormatter.js
+
2
-
2
View file @
46eeabca
...
...
@@ -45,9 +45,9 @@ function formatter(results) {
messages
=
messages
.
filter
(
m
=>
m
[
2
]
===
'
error
'
);
}
// add color to
messageType
s
// add color to
rule keyword
s
messages
.
forEach
(
m
=>
{
m
[
3
]
=
m
[
2
]
===
'
error
'
?
chalk
.
red
(
m
[
3
])
:
chalk
.
yellow
(
m
[
3
]);
m
[
4
]
=
m
[
2
]
===
'
error
'
?
chalk
.
red
(
m
[
4
])
:
chalk
.
yellow
(
m
[
4
]);
m
.
splice
(
2
,
1
);
});
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/scripts/start.js
+
21
-
12
View file @
46eeabca
...
...
@@ -55,22 +55,35 @@ const HOST = process.env.HOST || '0.0.0.0';
function
run
(
port
)
{
const
protocol
=
process
.
env
.
HTTPS
===
'
true
'
?
'
https
'
:
'
http
'
;
const
formatUrl
=
hostname
=>
url
.
format
({
protocol
,
hostname
,
port
,
pathname
:
'
/
'
});
const
formatUrl
=
hostname
=>
url
.
format
({
protocol
,
hostname
,
port
,
pathname
:
'
/
'
,
});
const
prettyPrintUrl
=
hostname
=>
url
.
format
({
protocol
,
hostname
,
port
:
chalk
.
bold
(
port
),
pathname
:
'
/
'
,
});
const
isUnspecifiedAddress
=
HOST
===
'
0.0.0.0
'
||
HOST
===
'
::
'
;
let
prettyHost
,
lanAddress
;
let
prettyHost
,
lanAddress
,
prettyLanUrl
;
if
(
isUnspecifiedAddress
)
{
prettyHost
=
'
localhost
'
;
try
{
lanAddress
=
address
.
ip
();
if
(
lanAddress
)
{
prettyLanUrl
=
prettyPrintUrl
(
lanAddress
);
}
}
catch
(
_e
)
{
// ignored
}
}
else
{
prettyHost
=
HOST
;
}
const
prettyUrl
=
forma
tUrl
(
prettyHost
);
const
pretty
Local
Url
=
prettyPrin
tUrl
(
prettyHost
);
// Create a webpack compiler that is configured with custom messages.
const
compiler
=
createWebpackCompiler
(
...
...
@@ -85,15 +98,11 @@ function run(port) {
);
console
.
log
();
if
(
isUnspecifiedAddress
&&
lanAddress
)
{
console
.
log
(
`
${
chalk
.
bold
(
'
Local:
'
)}
${
chalk
.
cyan
(
prettyUrl
)}
`
);
console
.
log
(
`
${
chalk
.
bold
(
'
On Your Network:
'
)}
${
chalk
.
cyan
(
formatUrl
(
lanAddress
))}
`
);
if
(
prettyLanUrl
)
{
console
.
log
(
`
${
chalk
.
bold
(
'
Local:
'
)}
${
prettyLocalUrl
}
`
);
console
.
log
(
`
${
chalk
.
bold
(
'
On Your Network:
'
)}
${
prettyLanUrl
}
`
);
}
else
{
console
.
log
(
`
${
chalk
.
cyan
(
prettyUrl
)
}
`
);
console
.
log
(
`
${
pretty
Local
Url
}
`
);
}
console
.
log
();
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/scripts/utils/createWebpackCompiler.js
+
3
-
3
View file @
46eeabca
...
...
@@ -104,13 +104,13 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) {
// Teach some ESLint tricks.
console
.
log
(
'
Search for the
'
+
chalk
.
underline
(
'
rule keywords
'
)
+
chalk
.
underline
(
chalk
.
yellow
(
'
rule keywords
'
)
)
+
'
to learn more about each warning.
'
);
console
.
log
(
'
To ignore, add
'
+
chalk
.
yellow
(
'
// eslint-disable-next-line
'
)
+
'
to the
previous lin
e.
'
chalk
.
cyan
(
'
// eslint-disable-next-line
'
)
+
'
to the
line befor
e.
'
);
console
.
log
();
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment