angular / angular/angular-cli

Allow schematics to create file with permissions

オープン
#11,781 コメント 7 件 リアクション 6 件 担当者 0 名 GitHub で見る
area: @angular-devkit/schematics feature feature: insufficient votes
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
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 の回避策を再現ケースとして使用してください。Schematic が自己破壊する preinstall スクリプトに依存せずに、実行権限付きのファイルを作成または変更できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
cli
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。