Skip to content

Commit fdae6aa

Browse files
committed
fix(cli): remove return promise
1 parent 12377e4 commit fdae6aa

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

packages/cli/create-antd-site.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const program = new commander.Command(packageJson.name)
2929
.version(packageJson.version)
3030
.arguments('[project-directory]')
3131
.usage(`${chalk.green('[project-directory]')}`)
32-
.action(name => {
32+
.action((name) => {
3333
projectName = name;
3434
})
3535
.option('--use-npm')
@@ -39,7 +39,7 @@ createApp(projectName, program.useNpm);
3939

4040
function printValidationResults(results) {
4141
if (typeof results !== 'undefined') {
42-
results.forEach(error => {
42+
results.forEach((error) => {
4343
console.error(chalk.red(` * ${error}`));
4444
});
4545
}
@@ -69,7 +69,7 @@ function checkAppName(appName) {
6969
`Due to the way npm works, the following names are not allowed:\n\n`
7070
) +
7171
chalk.hex('#29CDFF')(
72-
dependencies.map(depName => ` ${depName}`).join('\n')
72+
dependencies.map((depName) => ` ${depName}`).join('\n')
7373
) +
7474
chalk.red('\n\nPlease choose a different project name.')
7575
);
@@ -87,14 +87,14 @@ function shouldUseYarn() {
8787
}
8888

8989
function executeNodeScript({ cwd, initScriptPath }, data, source) {
90-
return new Promise(resolve => {
90+
return new Promise((resolve) => {
9191
const child = spawn(
9292
process.execPath,
9393
['-e', source, '--', JSON.stringify(data), initScriptPath],
9494
{ cwd, stdio: 'inherit' }
9595
);
9696

97-
child.on('close', code => {
97+
child.on('close', (code) => {
9898
if (code !== 0) {
9999
return;
100100
}
@@ -121,12 +121,13 @@ function isSafeToCreateProjectIn(root, name) {
121121

122122
const conflicts = fs
123123
.readdirSync(root)
124-
.filter(file => !validFiles.includes(file))
124+
.filter((file) => !validFiles.includes(file))
125125
// IntelliJ IDEA creates module files before CRA is launched
126-
.filter(file => !/\.iml$/.test(file))
126+
.filter((file) => !/\.iml$/.test(file))
127127
// Don't treat log files from previous installation as conflicts
128128
.filter(
129-
file => !errorLogFilePatterns.some(pattern => file.indexOf(pattern) === 0)
129+
(file) =>
130+
!errorLogFilePatterns.some((pattern) => file.indexOf(pattern) === 0)
130131
);
131132

132133
if (conflicts.length > 0) {
@@ -147,8 +148,8 @@ function isSafeToCreateProjectIn(root, name) {
147148

148149
// Remove any remnant files from a previous installation
149150
const currentFiles = fs.readdirSync(path.join(root));
150-
currentFiles.forEach(file => {
151-
errorLogFilePatterns.forEach(errorLogFilePattern => {
151+
currentFiles.forEach((file) => {
152+
errorLogFilePatterns.forEach((errorLogFilePattern) => {
152153
// This will catch `(npm-debug|yarn-error|yarn-debug).log*` files
153154
if (file.indexOf(errorLogFilePattern) === 0) {
154155
fs.removeSync(path.join(root, file));
@@ -253,7 +254,6 @@ function run(root, dependencies, useYarn, appName, originalDirectory) {
253254

254255
function install(root, useYarn, dependencies) {
255256
return new Promise((resolve, reject) => {
256-
return resolve();
257257
let command;
258258
let args;
259259
if (useYarn) {
@@ -281,7 +281,7 @@ function install(root, useYarn, dependencies) {
281281
}
282282

283283
const child = spawn(command, args, { stdio: 'inherit' });
284-
child.on('close', code => {
284+
child.on('close', (code) => {
285285
if (code !== 0) {
286286
reject({
287287
command: `${command} ${args.join(' ')}`

0 commit comments

Comments
 (0)