Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

installing a package from a monorepo

オープン
#159 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

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

調査の方向性

Reproduce the failure with apps/app1/package.json and the npx build-layer command using the npm runner. Start by tracing dependency installation and the checkForUnsafeStrings/isValidOutput path; done should include local monorepo packages being usable through the proposed npm pack flow and clearer output/dir help.

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

説明

Hello! Thank you for this amazing package!

It works great, but there is a tiny problem with packages inside a monorepo.

Let's say I have one big project - monorepo1, and there are packages/pkg1 and apps/app1, and my app1 has in its package.json these deps:

{
  "name": "@my-org/app1",
  ...
  "dependencies": {
    "@my-org/pkg1": "^0.0.1",
    "debug": "^4.4.0"
  },
  ...
}

The package pkg1 is private, it is a part of the monorepo, and it is not published to NPM (neither to any other custom registries), so when I run npx build-layer SharedLayer --files=apps/app1/package.json --debug --runner=npm --output=./ I see this error:

🕹 lambda-layer:installDeps:debug: Error: Command failed: npm install --prefix ././SharedLayer/nodejs debug@^4.4.0 @my-org/pkg1@^0.0.1 -S
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@my-org/pkg1 - Not found
npm ERR! 404 
npm ERR! 404  '@my-org/pkg1@^0.0.1' is not in this registry.

I know it should happen because npm in fact does not handle well this situation, the best thing npm can do here - is create a symlink (since we are in a monorepo).

The reason I'm writing all this: the description of build-lambda-layer says: "+ Monorepo support", but I still can use it out of the box for my monorepo.

After some investigation, I got this solution: npm pack and then - install the tgz of the package. The only non trivial thing: detect "local" monorepo's packages in the list of dependencies, pack then and replace the "name of package" with "name of tgz of the package" before running the package-manager.

What do you think about adding this functionality to build-lambda-layer? With your guidance, I could try to push a PR for this

PS: also, --output is a weird option. Without output it fails in checkForUnsafeStrings when it makes assertion for isValidOutput, but output-option (or variable out) works almost just like dir. So maybe i can clarify the "help", to explain why and how "output" and "dir" works?

主要言語
TypeScript
スター
6
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

TypeScript の issue をもっと見る

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

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