Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Pick up npm config for alternative npm registries, custom ca, etc.

未关闭
#1,260 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
cli, tooling

调研方向

首先跟踪 ember-cli-update 和 boilerplate-update 如何调用 pacote,重点关注 downloadAndCheckForUpdates、getApplicableCodemods、getCodemods 和 getVersions。将提议的 npm-conf 方案与 pacote 的选项进行比较,然后定义一致的配置路径;完成标准是能够遵循备用 registry 和自定义 CA 证书,而无需分散地修改 opts。

由索引模型根据 Issue 内容生成。

描述

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.<anonymous> (/<redacted global path>/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 to grab the npm configuration and pass it into the various pacote 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 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?

主要语言
JavaScript
星标
279
派生
44
PR 合并指标
30 天内没有已合并 PR

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ember-cli/ember-cli-update 的其他 Issue

查看 ember-cli/ember-cli-update 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。