mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-28 17:35:42 +08:00
Reformat source code with Prettier 1.5.2
This commit is contained in:
52
packages/react-scripts/scripts/eject.js
vendored
52
packages/react-scripts/scripts/eject.js
vendored
@@ -85,19 +85,16 @@ inquirer
|
||||
const folders = ['config', 'config/jest', 'scripts'];
|
||||
|
||||
// Make shallow array of files paths
|
||||
const files = folders.reduce(
|
||||
(files, folder) => {
|
||||
return files.concat(
|
||||
fs
|
||||
.readdirSync(path.join(ownPath, folder))
|
||||
// set full path
|
||||
.map(file => path.join(ownPath, folder, file))
|
||||
// omit dirs from file list
|
||||
.filter(file => fs.lstatSync(file).isFile())
|
||||
);
|
||||
},
|
||||
[]
|
||||
);
|
||||
const files = folders.reduce((files, folder) => {
|
||||
return files.concat(
|
||||
fs
|
||||
.readdirSync(path.join(ownPath, folder))
|
||||
// set full path
|
||||
.map(file => path.join(ownPath, folder, file))
|
||||
// omit dirs from file list
|
||||
.filter(file => fs.lstatSync(file).isFile())
|
||||
);
|
||||
}, []);
|
||||
|
||||
// Ensure that the app folder is clean and we won't override any files
|
||||
folders.forEach(verifyAbsent);
|
||||
@@ -124,18 +121,19 @@ inquirer
|
||||
if (content.match(/\/\/ @remove-file-on-eject/)) {
|
||||
return;
|
||||
}
|
||||
content = content
|
||||
// Remove dead code from .js files on eject
|
||||
.replace(
|
||||
/\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/mg,
|
||||
''
|
||||
)
|
||||
// Remove dead code from .applescript files on eject
|
||||
.replace(
|
||||
/-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/mg,
|
||||
''
|
||||
)
|
||||
.trim() + '\n';
|
||||
content =
|
||||
content
|
||||
// Remove dead code from .js files on eject
|
||||
.replace(
|
||||
/\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/gm,
|
||||
''
|
||||
)
|
||||
// Remove dead code from .applescript files on eject
|
||||
.replace(
|
||||
/-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/gm,
|
||||
''
|
||||
)
|
||||
.trim() + '\n';
|
||||
console.log(` Adding ${cyan(file.replace(ownPath, ''))} to the project`);
|
||||
fs.writeFileSync(file.replace(ownPath, appPath), content);
|
||||
});
|
||||
@@ -187,7 +185,9 @@ inquirer
|
||||
'node scripts/$1.js'
|
||||
);
|
||||
console.log(
|
||||
` Replacing ${cyan(`"${binKey} ${key}"`)} with ${cyan(`"node scripts/${key}.js"`)}`
|
||||
` Replacing ${cyan(`"${binKey} ${key}"`)} with ${cyan(
|
||||
`"node scripts/${key}.js"`
|
||||
)}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user