Skip to content

Commit b5f156e

Browse files
committed
Print friendly message on first time use
1 parent fa53530 commit b5f156e

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ const compilerOptions = {
3838
};
3939

4040
function verifyTypeScriptSetup() {
41+
let firstTimeSetup = false;
42+
4143
if (!fs.existsSync(paths.appTsConfig)) {
4244
if (!paths.appIndexJs.match(/\.ts?$/)) {
4345
return;
4446
}
4547
writeJson(paths.appTsConfig, {});
48+
firstTimeSetup = true;
4649
}
4750

4851
const isYarn = fs.existsSync(paths.yarnLockFile);
@@ -98,6 +101,7 @@ function verifyTypeScriptSetup() {
98101

99102
if (tsconfig.compilerOptions == null) {
100103
tsconfig.compilerOptions = {};
104+
firstTimeSetup = true;
101105
}
102106

103107
for (const option of Object.keys(compilerOptions)) {
@@ -134,17 +138,28 @@ function verifyTypeScriptSetup() {
134138
}
135139

136140
if (messages.length > 0) {
137-
console.warn(
138-
chalk.bold(
139-
'The following changes are being made to your',
140-
chalk.cyan('tsconfig.json'),
141-
'file:'
142-
)
143-
);
144-
messages.forEach(message => {
145-
console.warn(' - ' + message);
146-
});
147-
console.warn();
141+
if (firstTimeSetup) {
142+
console.log(
143+
chalk.bold(
144+
'Your',
145+
chalk.cyan('tsconfig.json'),
146+
'has been populated with default values.'
147+
)
148+
);
149+
console.log();
150+
} else {
151+
console.warn(
152+
chalk.bold(
153+
'The following changes are being made to your',
154+
chalk.cyan('tsconfig.json'),
155+
'file:'
156+
)
157+
);
158+
messages.forEach(message => {
159+
console.warn(' - ' + message);
160+
});
161+
console.warn();
162+
}
148163
writeJson(paths.appTsConfig, tsconfig);
149164
}
150165

0 commit comments

Comments
 (0)