Closed simondotm closed 3 months ago
Well, i don't exactly understand how it worked before and what the expected result, but right now with Nx 16.10.0 it's not possible to override "app" in the path in any way.
λ nx g @simondotm/nx-firebase:function my-function --app eruptrplatform --dry-run --directory="/my-function"
> NX Generating @simondotm/nx-firebase:function
UPDATE package.json
CREATE apps/my-function/my-function/src/assets/.gitkeep
CREATE apps/my-function/my-function/src/main.ts
CREATE apps/my-function/my-function/tsconfig.app.json
CREATE apps/my-function/my-function/tsconfig.json
CREATE apps/my-function/my-function/project.json
CREATE apps/my-function/my-function/.eslintrc.json
CREATE apps/my-function/my-function/jest.config.ts
CREATE apps/my-function/my-function/tsconfig.spec.json
CREATE apps/my-function/my-function/package.json
CREATE apps/my-function/my-function/readme.md
UPDATE projects/eruptrplatform/project.json
UPDATE firebase.eruptrplatform.json
NOTE: The "dryRun" flag means no changes were made.
Where expected result would be:
CREATE /my-function/src/assets/.gitkeep
The same is true for generating firebase app as well
Update: it seems NX trying to be smart and do some heuristic over the monorepo. So if you have "app" folder it will create new applications in here. So my previous report valid only if you already have apps / libs folder created.
Ok I'm going to close this. My plugin compatibility tests seem ok with Nx versions >=16.8.1 The next plugin release will require a minimum 16.8.1 Nx version, so can be addressed if anyone reports a related issue.
Re-opening this. Just trying to update plugin to Nx 16.8.1 and having problems with my e2e tests. I don't think the plugin functions & app generators are respecting the new options for generators:
--projectNameAndRootFormat
should be parsed & used if provided--directory
should consider if the nx.json
file specifies as-provided
or derived
and derive the destination based on name/directory accordinglyIt doesnt help that the e2e project setup is somewhat opaque about what defaults it sets in the nx.json
config.
Previous versions of Nx, plugins could just infer the target folder from workspace layout apps
/ libs
, but now it is much more flexible.
Hopefully theres some tooling for this in @nx/devkit
to make my life easier.
Update: it seems NX trying to be smart and do some heuristic over the monorepo. So if you have "app" folder it will create new applications in here. So my previous report valid only if you already have apps / libs folder created.
@thekip I believe there's some fangled new configs in nx.json
that might be influencing this:
"workspaceLayout": {
"projectNameAndRootFormat": "derived",
"appsDir": "apps",
"libsDir": "libs"
},
🤔 Nx 16.8 blog post here
The default nx.json
created by the e2e test framework is just:
"workspaceLayout": {
"projectNameAndRootFormat": "as-provided"
},
I'll probably need to add some e2e tests to make sure we've got functional coverage for all the different workspace variants.
This is now implemented in #205
See https://nx.dev/deprecated/as-provided-vs-derived
For Nx 17, there are migration options for derived names, but they say from Nx 18 it will be as-provided only.
Apparently we have to provide
--directory
for workspace structure ourselves now.Anyone finding this a problem with their projects?
I'm testing the plugin at the moment, and e2e tests are failing but I think the plugin should work ok with this new Nx change, just need to see if the documentation for the plugin may need updating to reflect this.