firebase / firebase/firebase-tools
firebase init functions to set package.json's engines.node version to the dev's machine
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
When running `firebase init functions`, package.json setup on the dev machine [hardcodes the `engine.node` attribute](https://github.com/firebase/firebase-tools/blob/master/templates/init/functions/typescript/package.lint.json#L13):
```
"engines": { "node": "14" }
```
`engine.node` attribute is used at `firebase deploy` time to figure out the runtime of the deployed cloud function instance.
In `npm`, it's okay for node version specified in the `engines.node` to differ w/ the node version on the developer's machine, but `yarn` will [throw an error if they differ](https://classic.yarnpkg.com/en/docs/cli/install/#toc-yarn-install-ignore-scripts).
It would be nice if the `firebase init functions` can dynamically set the engine. If dev is using a node version unsupported by Google Cloud Function, we can probably error.
Relates to https://github.com/firebase/firebase-functions/issues/782
Contributor guide
Research direction
Start with templates/init/functions/typescript/package.lint.json and trace the firebase init functions flow that generates package.json. Confirm how the developer's Node version is detected and how supported Cloud Functions runtimes are represented; done means generated engines.node matches the local version when supported and yarn no longer rejects the setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100