mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
refactor(@angular/cli): Updates .gitignore to keep out VSCode and Intellij configurations.
This also changes the local build script to allow negated .gitignore expressions to support these changes.
This commit is contained in:
parent
29a0ae3b1d
commit
76b13e2dea
20
.gitignore
vendored
20
.gitignore
vendored
@ -5,9 +5,27 @@ dist/
|
||||
dist-schema/
|
||||
|
||||
# IDEs
|
||||
.idea/
|
||||
jsconfig.json
|
||||
|
||||
# Intellij IDEA/WebStorm
|
||||
# https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Also ignore code styles because .editorconfig is used instead.
|
||||
.idea/codeStyles/
|
||||
|
||||
# VSCode
|
||||
# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
|
||||
.vscode/
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
**/*.code-workspace
|
||||
|
||||
# Typings file.
|
||||
typings/
|
||||
|
@ -17,15 +17,23 @@ import buildSchema from './build-schema';
|
||||
const minimatch = require('minimatch');
|
||||
const tar = require('tar');
|
||||
|
||||
const gitIgnore = fs.readFileSync(path.join(__dirname, '../.gitignore'), 'utf-8')
|
||||
.split('\n')
|
||||
const gitIgnoreFiles = fs.readFileSync(path.join(__dirname, '../.gitignore'), 'utf-8')
|
||||
.split('\n');
|
||||
const gitIgnore = gitIgnoreFiles
|
||||
.map(line => line.replace(/#.*/, ''))
|
||||
.filter((line) => !line.startsWith('!'))
|
||||
.filter(line => !line.match(/^\s*$/));
|
||||
const gitIgnoreExcept = gitIgnoreFiles
|
||||
.filter((line) => line.startsWith('!'))
|
||||
.map((line) => line.substr(1));
|
||||
|
||||
|
||||
function _gitIgnoreMatch(p: string) {
|
||||
function _gitIgnoreMatch(p: string): boolean {
|
||||
p = path.relative(path.dirname(__dirname), p);
|
||||
|
||||
if (gitIgnoreExcept.some((line) => minimatch(p, line))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return gitIgnore.some(line => minimatch(p, line));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user