angular / angular/angular-cli

Allow schematics to create file with permissions

Abierto
#11,781 7 comentarios 6 reacciones 0 asignados Ver en GitHub
area: @angular-devkit/schematics feature feature: insufficient votes
Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
14 h 23 min
PR fusionados (30 d)
162

Descripción

### 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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en el punto de entrada @schematics/angular:library y sigue cómo crea archivos antes de que se ejecute NodePackageInstallTask. Usa el Taskfile ejecutable y la solución alternativa generada para package.json como caso de reproducción. La tarea estará terminada cuando un schematic pueda crear o modificar un archivo con permisos de ejecución sin depender del script de preinstall autodestructivo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
cli
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.