-
Notifications
You must be signed in to change notification settings - Fork 205
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
Change lookup of '.runtimeconfig.json' as relative to cwd #542
Conversation
e8db93b
to
7ac0653
Compare
As written this is definitely behavior-changing, and there are instances where I think the behavior probably ought to be to make your lookup additive, if |
You're right @mbleigh, and good approach. I've implemented it in the recent push. It is now supporting the existing behaviour, then if those locations don't exist it will then traverse up from the |
Hey @loklaan this issue is...well, really old now. But if you're interested in updating the PR to resolve merge conflicts and keep the "don't break existing behavior", I'm open to merging. Sorry for letting this one slip through the cracks! |
8e4baa2
to
6cc350b
Compare
@mbleigh Oh brilliant I forgot about this - thanks for coming back to it! Since I opened this PR, it looks like the behaviour has changed from:
To:
This is great, although even after this long I still think that there should be a 3rd lookup attempt on parent directories above the working directory. So, I've updated the PR to support the current behaviours, and fallback to parent lookup using |
Ah looks like the node ^8 test fails.. For everyone? Let's ignore that I suppose. Pinging you @mbleigh so, fingers crossed, this won't get buried again haha |
Thanks for the update. I hate to be a pain when you already were willing to overlook a year-plus gap, but we are trying to maintain or reduce the number of dependencies in the Firebase CLI. Do you think you could implement the same logic without |
Haha all good, I get it @mbleigh . Ahh I'm sure we could inline it, plucking the code from find-up itself? I want to point out that
|
It's less about the size of the implementation and more about exposing us to code that changes without us knowing it (there are scary enough examples of that in NPM's history). FWIW here's some similar code we wrote for the Firebase CLI to find |
6cc350b
to
0453d61
Compare
@mbleigh I've removed the find-up dep, replacing it with a similar function. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh goodness, I had this review queued up months ago and forgot to hit submit 😦
* Like fs.existsSync, but fails softly. | ||
* @param path A path to check exists. | ||
*/ | ||
export function existsSync(path): boolean | void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this to something like safeExistsSync
to indicate the behavioral difference from standard existsSync
.
* @param options The options change findUp behaviour. | ||
*/ | ||
export function findUpSync( | ||
fileName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: filename
is the initialism I'm familiar with.
Hi! Thanks for getting around to it. Last couple (er, many) months have been rough for many all round. I'll be dropping this PR though 😞 as I don't have the involvement in Firebase projects anymore, and am spending time elsewhere. I encourage anyone that has subscribed to pick it up, if you want! Thanks @mbleigh for the reviews, and sorry if this feels at all like I've wasted your time. I've definitely appreciated your thoughtfulness here, as well as your long term commitment to the Firebase team. All the best! |
👋 Love having folks in the community contribute, sorry this got lost in the shuffle. Have a good one! |
👋 Elllooooo, this is my first time contributing to firebase stuff.
Description
The lookup for
.runtimeconfig.json
has an unexpected behaviour, which makes it only ever work if the.runtimeconfig.json
file is at the root of your repo/project (next tonode_modules
).This breaks local-emulation and deployed projects that are setup with monorepos, yarn's pnp, or bundled fn's.
Directly addresses: #476, #264, #438, #328, #172
Relates to: firebase/firebase-tools#653
Notes
I'm inclined to say no, and it is just a minor change. But one could argue that folks now rely on this static
../../../.runtimeconfig.json
lookup. Counter-counter argument would be to say that these kinds of consumers are liking relying onCLOUD_RUNTIME_CONFIG
anyway. 🤷♂️