Skip to content
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

Web Frameworks refactor & new features #4868

Merged
merged 51 commits into from Sep 27, 2022

Conversation

jamesdaniels
Copy link
Member

@jamesdaniels jamesdaniels commented Aug 12, 2022

Utilizes firebase-framework-tools#24 alongside firebase-js-sdk#6526.

There are a number of improvements here but most importantly this serves as the PoC for go/firebase-api-client-autoinit, firebase hosting init for Web Frameworks, and is moving the majority of the logic from firebase-framework-tools to this repo. firebase-framework-tools will still be used as the runtime harness for SSR in Cloud Functions.

  • Frameworks now needs the emulator address environment variables in the current env, so that they can be consume during SSG
  • For emulators, I had to rearrange the start order with frameworks, functions, and finally hosting last. That way SSG could connect to Auth, RTDB, Firestore, and Storage if they are spun up
  • Default cleanUrls to true for frameworks, use ??=, so that developers can opt-out
  • Fetch the default service account and set that and gcloud project env variables for SSG
  • Rearrange init hosting a bit to allow Angular, Next, and Nuxt project creation
  • Starting to move more of the business logic from firebase-frameworks into firebase-tools
  • The NODE_ENV stuff is because Next.js (a dev dep) is adding to NodeJS.ProcessEnv
  • The new dev deps are also messing with our typescript version, added skipLibCheck for now

src/frameworks/index.ts Outdated Show resolved Hide resolved
src/frameworks/index.ts Outdated Show resolved Hide resolved
jamesdaniels added a commit to FirebaseExtended/firebase-framework-tools that referenced this pull request Aug 16, 2022
* Addressed Angular not working, `defaultProject` is gone in new projects now
* Added more error logging to the Angular codepath
* `npm run dev` wasn't patching the globally installed CLI
* Bumped version
* Migrating to ESM
* Adding nuxt & nuxt3 to Github Actions
* Bumping deps
* Fix dynamic import paths in Windows with pathToFileURL
* Adding Windows tests to Actions
* Marked as compatible with Node 16, 18.
* Dropped Node 14 from Actions
* Pack filesystem NPM overrides
* Console log NPM install
* Integrate with [firebase-js-sdk#6526](firebase/firebase-js-sdk#6526) and [firebase-tools##4868](firebase/firebase-tools#4868)
* Next broke, `next export` no longer fails for fallbacks and api routes, detect these to determine if a Cloud Function should be spun up
* Fixed relative directory handling
* Silenced next export failures by spawning
* Rearranged framework detection order so custom servers are first
* Error if it could not determine the framework
* Next minimal mode
};

// TODO memoize, dry up
const getContext = async (dir:string) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dry up

@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2022

Codecov Report

Base: 57.16% // Head: 55.91% // Decreases project coverage by -1.24% ⚠️

Coverage data is based on head (4c3b7ba) compared to base (1c1bd04).
Patch coverage: 17.89% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4868      +/-   ##
==========================================
- Coverage   57.16%   55.91%   -1.25%     
==========================================
  Files         295      305      +10     
  Lines       19633    20305     +672     
  Branches     3919     4090     +171     
==========================================
+ Hits        11223    11354     +131     
- Misses       7459     7996     +537     
- Partials      951      955       +4     
Impacted Files Coverage Δ
src/deploy/functions/runtimes/golang/index.ts 26.31% <ø> (ø)
src/deploy/functions/runtimes/node/index.ts 25.35% <0.00%> (ø)
src/emulator/controller.ts 13.67% <0.00%> (-0.16%) ⬇️
src/emulator/downloadableEmulators.ts 23.30% <0.00%> (ø)
src/emulator/ui.ts 33.33% <0.00%> (ø)
src/hosting/normalizedHostingConfigs.ts 98.43% <ø> (ø)
src/serve/hosting.ts 34.92% <0.00%> (-0.57%) ⬇️
src/frameworks/angular/index.ts 8.69% <8.69%> (ø)
src/frameworks/index.ts 15.24% <14.07%> (-1.15%) ⬇️
src/frameworks/next/index.ts 15.15% <15.15%> (ø)
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bkendall bkendall merged commit 971c7d6 into master Sep 27, 2022
@bkendall bkendall deleted the jamesdaniels_frameworks-emulators branch September 27, 2022 18:10
christhompsongoogle pushed a commit that referenced this pull request Sep 30, 2022
* First

* Cleanup

* Frameworks@canary

* Add GCLOUD_PROJECT for SSG

* Framework init

* Bump

* NPM install on Nuxt, prompt for Angular Universal

* Fix next static export add minimal mode

* npx latest, detect framework in ., bump version

* Minor fixes for deploy

* Path fixes for spawn, addressed relative path issue with injectConfig, and reduce noise on npm i

* Bump version

* Add Vite init

* Refactoring

* Get Angular working completely again

* Flushing out refactored Next.js

* Getting Vite and Express running again

* Fix abs vs. relative dirs, bundle next.config.js

* Only delete the hosting dir, if it exists

* Rearrange things

* Getting Nuxt working

* Was touching a devDep

* Breaking out the vite templates

* Fixed lit discovery

* Autoinit

* Fix for the function name and pathing for execSync

* Drop sveltekit

* Lint and cleanup

* Fix dynamic import on windows

* Target firebase-frameworks 0.6.0

* Cleanup and addressing feedback

* Fix for existing functions config being an object

* Go for a simpler dep resolution

* Dont use eval for dynamic import

* fix for skipLibChecks

* destructure vs. passing NODE_ENV manually

* Cleanup

* Double join

* Lint

* Cleanup superstatic after.files

* Eslint comment

* Cleanup with promptOnce

* Refactor express

* Proxy cleanup

* next.js => next

* revert the ordering change for emulator starting

* make build command work on windows

Co-authored-by: David East <deast@google.com>
Co-authored-by: David East <davideast@users.noreply.github.com>
Co-authored-by: Bryan Kendall <bkend@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants