Skip to content

Clarify Settings for Resolving Packages w/non-matching Folder Names #67

@zfalen

Description

@zfalen

Great package. But, ran into this while playing with firelink for the first time.

I have a mono-repo where @zfalen/some-package refers to an npm workspace at packages/some-totally-different-folder-name.

The root package.json looks like this

{
  "name": "@zfalen/my-repo-root-package",
  "author": "Zach Falen",
  "version": "1.0.0",
  "license": "ISC",
  "private": true,
  "devDependencies": { ...... },
  "workspaces": [
    "packages/*",
    "firebase-app/functions"
  ]
}

The packages/some-totally-different-folder-name/packages.json looks like

{
  "name": "@zfalen/some-package",
  "author": "Zach Falen",
  "version": "1.0.1",
   // .... rest of it 
}

Then, in firebase-app/functions/package.json we have

{
  "name": "functions",
  "dependencies": {
    "@zfalen/some-package": "^1.0.0",
    // .......
  },
  "fireDependencies": {
    "@zfalen/some-package": "../../packages/some-totally-different-folder-name"
  },
  // .... rest of it 
}

firelink deploy grabs my module and dumps it into firebase-app/functions/.packages/some-totally-different-folder-name - HOWEVER it patches the dependency to read "@zfalen/some-package": "file:./.packages/some-package".

While this weirdly worked out locally testing against the emulator, it resulted in a failure on deploying to Firebase. That error was predictably:
Detailed stack trace: Error: Cannot find module '@zfalen/some-package'

I updated the name of the folder to match the name of some-package, and updated the path under fireDependencies, which made it work.

TLDR; Readme should reflect the requirement that folder names match package names, or script should use the correct folder name when mapping the file:./.packages/whatever in package.json :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions