-
Nx badges for each release indicate the Nx version the plugin was built against, and the minimum required version of Nx to use the plugin. Each plugin release may be with earlier or future versions of Nx, but this is not always guaranteed.
-
Node badges for each release indicate the Node version the plugin was built against, and the default engine set for Firebase functions generated by the plugin, not the node version required to use the plugin.
- Updated plugin to be built against Nx 16.8.1
- Updated documentation to reflect latest changes
- App & Function generators now use the same templates as the Firebase tools SDK
- Firebase dependencies used by generators now derived from plugin workspace & dependabot help
firebase-functions
-> 4.8.2firebase-functions-test
-> 3.1.1firebase-admin
-> 11.11.1firebase
-> 10.10.0firebase-tools
-> 12.9.1
- Support --projectNameAndRootFormat for application and function generators
- Support
pnpm
Nx workspaces for function deployment by adding@google-cloud/functions-framework
to the function dependencies
- Fix package dependencies for
@nx/node
, plugin init generator now adds this if/when needed - This prevents scenarios where incorrect Nx plugin versions could be added to the user workspace
- It may also fix an issue with
@nx/esbuild
plugin version being out of sync and bundling external dependencies incorrectly
- Include
@nx/devkit
as a peer dependency for the package - Listing in the Nx plugin registry
- Fix issues in the v2.1.0 release
- Added support for environment variables
- Added support for secrets
- Added a custom
serve
executor that exits the Firebase Emulator suite properly - Fixes to
sync
generator to update firebase app and firebase function project targets when they are renamed - Added a custom
migrate
generator to ensure workspace configurations match the latest plugin version schemas - Updated plugin to be built against Nx 16.6.0
Read here for plugin v2.0.0 -> v2.1.0+ migration instructions
Official v2 release
- Updated default function template to match firebase CLI
- Fixed issue with dependencies
- Sort codebases
- Updated documents
Initial beta of plugin version 2.0.
Changes
- Plugin is completely rewritten
- Added
@simondotm/nx-firebase:function
generator - Firebase functions are now separate application nx projects
- Now uses
esbuild
to compile & bundle firebase functions - Firebase functions no longer require Nx libraries to be buildable
- Added
@simondotm/nx-firebase:sync
generator to manage Firebase workspaces - Minimum Nx version is now 16.1.1
- Watch mode build of function code & libraries is now fully supported when running Firebase emulator
This plugin was completely rewritten since V2.x to use esbuild for bundling cloud functions. For documentation of the legacy v1.x plugin version see here.
Users of earlier plugin versions must read here for plugin v1 -> v2 migration instructions
Please note that legacy v1 versions of the plugin are no longer supported from this point on, so only take this update if you are prepared to migrate your workspace and Firebase projects
No changes from beta.
Updated for Nx 16.1.1+
- You will need to migrate your workspace to Nx 16.1.1 before updating the plugin
First Major release. No change since 0.13.0-beta.1
.
Compatible with Nx 13.10.6+
Changes
main
removed from templatepackage.json
for firebase app generator - this is automatically set by the builder- Support
nx watch
in compatible Nx workspace hosts - Support
nx:run-commands
in compatible Nx workspace hosts - Various small fixes
Migration Guide
- Check the targets documentation if you already have a workspace that is using nx-firebase
- Remove
main
frompackage.json
files in any nx-firebase apps in your workspace
Due to the large number of API changes in Nx from version 12 to version 13.10, this plugin has been rewritten from scratch:
- Improved compatibility
- To support the latest Nx devkit API's for plugins
- Refactored build process
build
executor is now entirely based on the@nrwl/js:tsc
executor, which simplifies maintenance of the plugin- this also enables
--watch
to work - (note that changes to Nx library dependencies are still not yet detectable in
--watch
mode)
- Functions Node engine
- Plugin now defaults to Node 16 runtime engine for firebase functions
- Improved Firebase configurations
nx g @simondotm/nx-firebase:app
will now generate afirebase.json
configuration file for the first firebase application in the Nx workspace. Additional generated firebase applications will have a firebase configuration namedfirebase.project-name.json
- Project Alias Support
- If you already know the firebase project alias you are using for your application, you can now use the
--project
generator parameter to set this in the project targets eg.nx g @simondotm/nx-firebase:app appname --project=firebaseprojectalias
- If you already know the firebase project alias you are using for your application, you can now use the
- Additional dependencies
nx g @simondotm/nx-firebase:app
will add firebase andkill-port
dependencieskill-port
is used by theserve
andemulate
targets to ensure clean startup.
- Documentation has been updated
Recommended minimum version of Nx is now 13.10.6. See Nx Migration documentation for more information.
Interim release fixes for issues introduced in nx version 13.0.2+ where createProjectGraph
was deprecated.
As of Nx v13.10.x, copyAssets
was also broken in v0.3.4 of the plugin, but now fixed thanks to contributors.
Migration Recommendations
If you are running on older versions of Nx, the following information may be useful:
No more --with-deps
From Nx version 12.3+, Nx now automatically checks for & builds required dependencies when running build targets.
Therefore --with-deps
is deprecated, so this parameter can be removed from any firebase Nx application targets such as build
, serve
, deploy
, configuration
, and also in the functions predeploy
setting within any firebase.<project>.json
configuration files you may have.
No more --parallel
Same applies for --parallel
since this is now a default setting in nx.json
It may be necessary to pass --parallel=3
in CI scripts however.
Nx command syntax
It may also be worth updating commands within any firebase application targets of the format:
nx run project:build
to the newernx build project
syntax
Update executors
As of Nx 13.8.8, @nrwl/node:package
is replaced by @nrwl/js:tsc
.
Nx version migrations below may handle this transition for you, but if not, you may need to update your build
targets for imported libraries accordingly to build with @nrwl/js:tsc
.
See Nx Migration documentation for more information.
General changes
- Improved listing of firebase functions dependencies; now ordered by npm module libraries first, then local libraries, sorted alphabetically.
Enhanced Support for Firebase Emulators
nx g @simondotm/nx-firebase:app
generator now additionally:
-
Adds default
auth
andpubsub
settings to"emulators": {...}
config infirebase.<appname>.json
so that these services are also emulated by default. -
Adds a new
getconfig
target to firebase functions app, where:nx getconfig <firebaseappname>
will fetch the functions configuration variables from the server and store it locally as.runtimeconfig.json
-
Adds
.runtimeconfig.json
to asset list to be copied (if it exists) from app directory to outputdist
directory when built, so that the function emulators will now run if the functions being emulated access variables from the functions config. -
Adds
.runtimeconfig.json
to the Nx workspace root.gitignore
file (if not already added), since these files should not be version controlled -
Adds an
emulate
target to the Nx-firebase app, which is used byserve
but also allows Firebase emulators to be started independently of a watched build.
Plugin maintenance
- Executors use workspace logger routines instead of console
- Fixed minor issues in e2e tests
- Removed redundant/legacy firebase target
- Replaced plugin use of node
join
with workspacejoinPathFragments
Migration from v0.3.2
For users with existing nx-firebase applications in their workspace you may wish to add the new version schema updates manually to your workspace configuration files.
In your angular.json
or workspace.json
file, for each nx-firebase
app project:
- Add the
.runtimeconfig.json
to your build assets:
"targets": {
"build": {
...
"options": {
...
"assets": [
...
"apps/nxfirebase-root-app/.runtimeconfig.json"
]
}
},
- Add the new
emulate
target to your app:
"targets": {
...
"emulate": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "firebase emulators:start --config firebase.nxfirebase-root-app.json"
}
},
- Modify the
serve
target to:
"targets": {
...
"serve": {
...
"options": {
"commands": [
{
"command": "nx run <appname>:build --with-deps && nx run <appname>:build --watch"
},
{
"command": "nx run <appname>:emulate"
}
],
"parallel": true
}
},
- Add the new
getconfig
target:
"targets": {
...
"getconfig": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "firebase functions:config:get --config firebase.<appname>.json > apps/<path-to-app>/.runtimeconfig.json"
}
},
...
And in your firebase.<appname>.json
config settings for "emulators"
add "auth"
and "pubsub"
configs:
"emulators": {
...
"auth": {
"port": 9099
},
"pubsub": {
"port": 8085
}
}
- Plugin now detects incompatible Nx library dependencies and aborts compilation when found
Incompatible dependencies are as follows:
- Non
--buildable
libraries - Nested libraries that were not created with
--importPath
If either of these two types of libraries are imported by Firebase functions, the compilation will be halted, since a functional app cannot be created with these types of dependencies.
See the README for more information.
-
Removed undocumented/unusued
firebase
target in app generator. No longer needed. -
serve
target now builds--with-deps
before watching to ensure all dependent local libraries are built. Note thatserve
only detects incremental changes to the main application, and not dependent libraries as well at this time.
Project has been renamed from @simondotm/nxfirebase
to @simondotm/nx-firebase
to better match Nx plugin naming conventions. Took a deep breath and did it early before many installs occurred. Apologies to any users who this may have inconvenienced - I didn't realise I could deprecate packages until after I'd deleted & renamed the pnm project. Rest assured, I won't be making any further major modifications like this!
If you have already generated NxFirebase applications using @simondotm/nxfirebase
you will need to migrate as follows:
npm uninstall @simondotm/nxfirebase
npm install @simondotm/nx-firebase --save-dev
- Update the
builder
targets in any NxFirebase applications you already have in yourworkspace.json
orangular.json
config from@simondotm/nxfirebase:build
to@simondotm/nx-firebase:build
Built against Nx 12.3.4
Updates
-
build
executor now supports--watch
option for incremental builds -
Added
serve
target to applications which will build the application with--with-deps
and--watch
options, and also launch the Firebase emulator with the application's firebase configuration in parallel -
Added
deploy
target to applications. Supports Nx forwarded command line arguments so commands likenx deploy <appname> --only functions
work fine -
Default template function
index.ts
now has added import offirebase-admin
to ensure all necessary Firebase package dependencies for functions are included out of the box
Fixes
-
Default
firebase.appname.json
now has a valid default hosting configuration and apps ship with a templatepublic/index.html
(as generated by Firebase CLI) inside the application folder -
Nx-Firebase App generator sets
target
intsconfig.app.ts
toes2018
to ensure Node 10 compatibility for Firebase Functions (for scenarios where root workspacetsconfig.base.json
may be set to a later ES target) -
Fixed
predeploy
scripts infirebase.appname.json
to usenpx nx
so that they work correctly in CI environments -
Fixed default
firestore.rules
file to correct a typo -
Fixed default
storage.rules
file to use version 2 ruleset -
Plugin peer dependencies set so there's some indication of plugin compatibility
Migrating from apps generated with v0.2.2
v0.2.3 adds these targets to your workspace.json
or angular.json
, so for users of earlier versions of the plugin this will have to be done manually:
"serve": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "nx run <appname>:build --with-deps && nx run <appname>:build --watch"
},
{
"command": "firebase emulators:start --config firebase.<appname>.json"
}
],
"parallel": true
}
},
"deploy": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": "firebase deploy --config firebase.<appname>.json"
}
},
Built against Nx 12.1.1