angular / angular/angular-cli

Allow schematics to create file with permissions

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

Descrição

### Bug Report or Feature Request (mark with an `x`)
```
- [ ] bug report -> please search issues before submitting
- [x] feature request
```

### Versions

any

### Desired functionality

I'm writing schematics to help colleagues scaffold applications and libraries following our internal guidelines. One part of our set-up is the use of a file called `Taskfile` to contain scripts instead of cramming complicated one-liners in yarn run-scripts. This file should be executable, but a schematic cannot create executable files. The result is a broken package because `./Taskfile: Permission denied`.

I've got a simple workaround:

The schematic in question is based on `@schematics/angular:library`. It runs the `NodePackageInstallTask` at the end. This allows me to create a selfdestructing `preinstall` script in the newly scaffolded `package.json`:

```json
{
"//": "...",
"scripts": {
"preinstall": "chmod +x Taskfile && ex +g/preinstall/d -cwq package.json",
"prepublish": "./Taskfile build",
"test": "./Taskfile test"
}
}
```

This works, but it feels like a hack to me. It would be cleaner if either

- file permissions were respected, as the source file for the scaffold has correct permissions; or
- the schematic could modify permissions

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece pelo ponto de entrada @schematics/angular:library e acompanhe como ele cria arquivos antes da execução de NodePackageInstallTask. Use o Taskfile executável e o workaround gerado para package.json como caso de reprodução. O trabalho estará concluído quando um schematic puder criar ou modificar um arquivo com permissões de execução sem depender do script de preinstall autodestrutivo.

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

Avaliação

Stack de tecnologia
angular, typescript
Domínio
cli
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.