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