ember-cli / ember-cli/ember-cli-update
Pick up npm config for alternative npm registries, custom ca, etc.
- Ngôn ngữ chính
- JavaScript
- Star
- 279
- Fork
- 44
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Unfortunately `embrer-cli-update` won't work in environments that rely on customising the npm registry.
I feel Ember is a good option for enterprises, which are often in this situation of using an internal mirror registry. It would be great to smooth the Ember upgrade experience by being able to use this tool.
Two issues here:
* using wrong registry
* not picking up custom CA certs
```
❯ ember-cli-update --to 4.12
FetchError: request to https://registry.npmjs.org/ember-cli failed, reason: self-signed certificate in certificate chain
at ClientRequest. (//node_modules/ember-cli-update/node_modules/minipass-fetch/lib/index.js:130:14)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'SELF_SIGNED_CERT_IN_CHAIN',
errno: 'SELF_SIGNED_CERT_IN_CHAIN',
type: 'system'
}
```
I assume the best way for this tool to work is that it is aware of npm config, however that is passed to npm. (env, flags, npmrc)
## Hacky solution
I have cobbled together a solution that uses [npm-conf](https://github.com/kevva/npm-conf) to grab the npm configuration and pass it into the various [pacote](https://github.com/npm/pacote?tab=readme-ov-file#options) methods' opts param.
In `boilerplate-update` I also modified these functions to take an `opts` arg to pass to pacote:
`downloadAndCheckForUpdates` `getApplicableCodemods` `getCodemods` `getVersions`.
It sort of works, but doesn't feel like the most elegant design.
## Considering something more ideal
It would be nice if `pacote` could be configured to pick up npm config out of the box.
Maybe, as an interim, `pacote` could be wrapped/proxied within `boilerplate-update` to pick up npm config when necessary. Expose that same proxy for `ember-cli-update` to make use of. This should require less changes to the various method signatures within `ember-cli-update` and `boilerplate-update`
Then there's [npm-conf](https://github.com/kevva/npm-conf) not npm official, and not well maintained, but has significant use.
To me, this still feels hacky, and really there should be some module `npm` relies on that we can also rely on for picking up npm config.
What do you reckon @kellyselden? Is there a better approach you're aware of?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách lần theo cách ember-cli-update và boilerplate-update gọi pacote, tập trung vào downloadAndCheckForUpdates, getApplicableCodemods, getCodemods và getVersions. So sánh cách tiếp cận npm-conf được đề xuất với các tùy chọn của pacote, sau đó xác định một đường dẫn cấu hình nhất quán; hoàn tất khi các registry thay thế và chứng chỉ CA tùy chỉnh được tôn trọng mà không yêu cầu các thay đổi opts rải rác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- cli, tooling
- 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
- 38/100