Allow schematics to create file with permissions
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 14 小時 23 分鐘
- 30 天內合併 PR
- 162
描述
### 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
貢獻指南
研究方向
從 @schematics/angular:library 進入點開始,追蹤它在 NodePackageInstallTask 執行前如何建立檔案。使用可執行的 Taskfile 和產生的 package.json workaround 作為重現案例。完成的標準是 schematic 可以建立或修改具有可執行權限的檔案,而不依賴會自我銷毀的 preinstall 指令碼。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, typescript
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100