Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

installing a package from a monorepo

Aperta
#159 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
nodejs, typescript
Ambito
build-system, cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?

Lingua principale
TypeScript
Stelle
6
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.