Allow schematics to create file with permissions
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 14 giờ 23 phút
- Pull request đã merge (30 ngày)
- 162
Mô tả
### 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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu tại điểm vào @schematics/angular:library và theo dõi cách nó tạo các tệp trước khi NodePackageInstallTask chạy. Sử dụng Taskfile có thể thực thi và workaround package.json được tạo làm trường hợp tái hiện. Hoàn thành có nghĩa là schematic có thể tạo hoặc sửa đổi một tệp với quyền thực thi mà không phụ thuộc vào script preinstall tự hủy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- cli
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100