diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2018-03-14 10:17:15 +0100 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-03-14 10:17:15 +0100 |
commit | 551dcb5cc09d2f400783183b42c32acd48bef5c7 (patch) | |
tree | 970db5561a0ab3a7830419728b6f43023bdd29dc /scripts/frontend/prettier.js | |
parent | 535f9b5be9bc05f517070f9e6800c906b61c9543 (diff) | |
download | gitlab-ce-tz-prettier-base.tar.gz |
Made speed optimisations to the scripttz-prettier-base
Documentation updates
Reverted config prettifiying
Diffstat (limited to 'scripts/frontend/prettier.js')
-rw-r--r-- | scripts/frontend/prettier.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js index c191dcc2a98..3df9d7c2bb5 100644 --- a/scripts/frontend/prettier.js +++ b/scripts/frontend/prettier.js @@ -11,17 +11,20 @@ const allFiles = mode === 'check-all' || mode === 'save-all'; const config = { patterns: ['**/*.js', '**/*.vue', '**/*.scss'], - ignore: ['**/node_modules/**', '**/vendor/**'], + ignore: ['**/node_modules/**', '**/vendor/**', '**/public/**'], parsers: { js: 'babylon', vue: 'vue', scss: 'css', }, }; +const availableExtensions = Object.keys(config.parsers); console.log(`Loading ${allFiles ? 'All' : 'Changed'} Files ...`); -const changedFiles = allFiles ? null : getChangedFiles(); +const changedFiles = allFiles + ? null + : getChangedFiles(availableExtensions.map(ext => `*.${ext}`)); if (changedFiles) { if (!changedFiles.length || (changedFiles.length === 1 && !changedFiles[0])) { @@ -44,7 +47,6 @@ if (allFiles) { .sync(globPattern, { ignore }) .filter(f => allFiles || changedFiles.includes(f)); } else { - const availableExtensions = Object.keys(config.parsers); files = changedFiles.filter(f => availableExtensions.includes(f.split('.').pop()), ); @@ -79,7 +81,7 @@ prettier } else if (!prettier.check(input, options)) { if (!didWarn) { console.log( - '\n===============================\nGitLab CE uses Prettier to format all JavaScript code.\nPlease format each file listed below or run "yarn prettier-changed-save"\n===============================\n', + '\n===============================\nGitLab uses Prettier to format all JavaScript code.\nPlease format each file listed below or run "yarn prettier-changed-save"\n===============================\n', ); didWarn = true; } |