rxdi / firelink

Firebase. gcloud and monorepos are not combining very well until they met @rxdi/firelink
MIT License
68 stars 9 forks source link

Specify custom path for ./packages #20

Closed jekozyra closed 2 years ago

jekozyra commented 2 years ago

Right now, packages get linked in the directory where the firelink command is run. However, we're deploying our already built firebase functions to get around the fact that Cloud Functions don't seem to support yarn berry. Is it possible to specify the location where .packages should go in FireLinkConfig?

Stradivario commented 2 years ago

That is a great i didn't have need to make it specified but if there is even one use case that we need it i will make it.

Expect in a few hours new version to be deployed with this feature added.

Curious if the function is already build is it build in a single file or it is using the .packages folder and node_modules ?

Cheers!

@jekozyra

jekozyra commented 2 years ago

A simplified version of our current repo structure is:

- functions
  - package.json
  - tsconfig.json
- packages
  - common
    - package.json
    - tsconfig.json
  - other_packages
- firebase.json

In firebase.json, we have:

  "functions": {
    "source": "functions/build",
    "predeploy": [
      "yarn --cwd functions build && yarn --cwd functions postbuild"
    ]
  }

yarn build generates a build directory within functions, and then yarn postbuild copies over a slightly modified package.json. This was all done to avoid cloud functions attempting to install dependencies with yarn 1.22.14, which was throwing an error that yarn.lock was out of date.

When running locally, I can run firelink deploy from within the functions directory, and it generates .packages, and then I copy that over with the postbuild step, which is great. But in CI, we run firelink deploy from the repo root, and testing this locally, it doesn't look like .packages get generated at all in this scenario.

Stradivario commented 2 years ago

@jekozyra Thank you very much for writing this out!

Now i have more clue of what happens and how setting up the folder as a option can benefit the use case.

Since there are few changes that needs to be made i will need to make a little refactor of the code in order to pass the folder correctly.

I am currently working on this one and will let you know when it is done.

Cheers, Kristiyan Tachev

Stradivario commented 2 years ago

Pull Request is added to introduce this feature! https://github.com/rxdi/firelink/pull/21

I will make a few tests today and will publish it afterwards!

The new version that this feature will present will be with tag 0.7.55

Stradivario commented 2 years ago

@jekozyra new version is published 0.7.55 can you please take a look and test it out ?

If you have any issues please let me know!

I found out that the code itself was build not configurable as i want it to be so i will refactor most of the code in order to be more maintainable.

I didn't know that this library will become so usable so i will need to change the mindset and create it in some different ways.

Cheers!

jekozyra commented 2 years ago

Looks good so far! Thanks for the updates!

Stradivario commented 2 years ago

Closing this one please re-open if needed!

Cheers!

@jekozyra