angular / angular/angular-cli

Allow failing build if there are missing runtime assets

Aberta
#19,952 3 comentários 0 reações 0 responsáveis Ver no GitHub
area: @angular-devkit/build-angular feature feature: insufficient votes
Linguagem predominante
TypeScript
Estrelas
27k
Forks
11.8k
Merge médio
14h 23min
PRs com merge (30d)
162

Descrição

# 🚀 feature request

### Relevant Package
This feature request is for @angular/cli

### Description
If you have in the assets configuration in `angular.json`:
```
"assets": [
...
{
"glob": "jquery.min.js",
"input": "./node_modules/jquery/dist",
"output": "/assets/jquery"
},
...
]
```

And the glob doesn't match anything, no error is generated. This means the build can be broken because the `assets` folder doesn't contain all required runtime assets, but we won't realize until runtime.

### Describe the solution you'd like
The feature request is to add an array field `files` that can be used instead of `glob` to tell exactly which files to copy: `"files":
```
"assets": [
...
{
"files": ["jquery.min.js", "jquery.min.map"],
"input": "./node_modules/jquery/dist",
"output": "/assets/jquery"
},
...
]
```

### Describe alternatives you've considered

I considered listing the `jquery.min.js` file in the `scripts` section of `angular.json`, but this solution doesn't work perfectly for cases when it's not a "js" file I want in the assets folder. For example, mapbox comes with a folder with images, that I need copied to the assets folder.

An alternatively feature implementation I considered recommending was you could add an option `failIfNoMatch` to make the build fail if the glob doesn't match anything: `"failIfNoMatch": true`. But this solution is not as useful as the `files` one though, as the glob `jquery.min.{js,map}` would succeed even if it finds only one of the required files.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece pela configuração de assets em angular.json e rastreie como o build de @angular/cli processa entradas de assets baseadas em glob. Compare o comportamento do array files solicitado com a opção alternativa failIfNoMatch; o trabalho estará concluído quando assets de runtime obrigatórios ausentes fizerem o build falhar, enquanto o uso existente de glob continuar sendo compatível.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
angular, typescript
Domínio
build-system
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.