-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify Settings for Resolving Packages w/non-matching Folder Names #67
Comments
.tsconfig.json
Settings for Resolving Packages w/non-matching Folder Names
Actually folder name shouldn't match the package name.... it shouldn't be required. If it happens than it sounds to me like a bug. I will give it a shot to see if what you are seeing is correct or it happens due to some race condition... |
You are right! I just tested it out and it works like you say i think this is not correct and should be fixed! I am on it just now. Cheers ! |
🍻 just confirmed with This saved me colossal amounts of headache setting up a project today. Big fan of this simplistic approach until firebase finally supports npm workspaces / |
Based on your problem i have found a way to remove the whole I asked myself "Why do we need to copy This means that i would need to deploy some MAJOR release of the library without many of the unnecessery logic related to copying packages. I will think about these days and probably i will refactor everything since i am planning it from a long time. So please for now use the correct namespacing like you already found out and in couple of days there will be a major release. Thanks for the ticket it reminds me of some things that i needed to change! |
@zfalen is it possible to prepare some public repository with your changes to test it out realtime and not bother you to test it after i deploy the release ? |
Sure. Let me whip one up |
@Stradivario - try this https://github.com/zfalen/npm-ts-workspaces-firebase I havent actually deployed the I did not name the folder a different name than the package, although it is missing the |
Thank you very much for the repository. I have made like 90% of the refactoring and deployed version Can you please try to install it using this command: npm i -g @rxdi/[email protected] There is additional Removed the whole Also many of the issues related with rsync problems will be resolved since there is no more I have test it out against provided repository and it appears that it works flowless. Sample command to use to prepare the environment it will execute firelink --bootstrap --skip-runner After the bootstrap step i think even There is a oneliner which will bootstrap(do a npm install with the local packages mapped) and execute deploy firelink deploy --boostrap Will do a quick deployment in Cheers! |
Don't bother testing it since it will not work as expected :D I forgot how stupid is the deployment of firebase function. So in order for the monorepo packages to be deployed they should be in the folder where the lambda is else it will not be deployed and will lead to broken packages. So basically i will need to add additional copy logic again to accomplish the purpose of the library... unfortunate. |
:) yes it is frustrating. I am surprised they have not addressed this considering the adoption of monorepo structures. |
I can suggest you to do something which i am practicing a lot. I am building a lambda infrastructure using Kuberenetes and will release soon to production it is part of a bigger features inside https://graphql-server.com website. So what i am doing there is the following:
I am doing this using
import esbuild from 'esbuild';
esbuild
.build({
entryPoints: ['./src/index.ts'],
bundle: true,
treeShaking: true,
platform: 'node',
target: 'node16',
outfile: './lib/index.js',
})
.then((data) => console.log('SUCCESS', data))
.catch((e) => {
console.error(e);
process.exit(1);
}); My build command looks as follow: node build.mjs The esbuild will grab the file and tree shake everything and will bundle it to single executable This is how i deploy lambdas for less than 10 seconds without any downtime for bootstrapping. This is one lambda being deployed and the npm install takes 17 seconds more than the build and deploy combined :D Cheers and i hope you find this useful i will work more on the beta 1 firelink now :D Cheers ! EDIT: This approach has a lot of benefits since the bootstrap of the lambda is faster, the response is faster due to smaller code to execute and you don't need to deal with the stupid firebase deploy :) This approach is also applicable to |
@Stradivario I like that quite a bit. Most of what I do daily is actually Kubernetes. Mostly AWS. Playing with firebase for a side project to get the EZPZ user auth and such. Half the point is just checking back in on where firebase is as a product from a usability standpoint. Ironically enough for a different product at work, which is built from something like 18 microservices on K8s and deployed exclusively with |
I really don't beleive it but you actually write down what i currently adopted before 2 years :D And all of my lambdas are running on fission. Can we talk about such a technologies in private ? Do you have some email or facebook account ? https://www.facebook.com/ktachev/ This is me if you want to talk about some different stuff :))) |
@Stradivario love to. I don't have any social though because I am an internet hermit. I have a reddit? Discord? 🤣 |
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 annpm
workspace atpackages/some-totally-different-folder-name
.The root
package.json
looks like thisThe
packages/some-totally-different-folder-name/packages.json
looks likeThen, in
firebase-app/functions/package.json
we havefirelink deploy
grabs my module and dumps it intofirebase-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 underfireDependencies
, 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
inpackage.json
:)The text was updated successfully, but these errors were encountered: