-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(nx-plugin): add createNodes generator #32931
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
View your CI Pipeline Execution ↗ for commit e80b18f
☁️ Nx Cloud last updated this comment at |
5bed0c0
to
9478989
Compare
de72b3c
to
4e91f12
Compare
packages/plugin/src/generators/create-nodes/create-nodes.spec.ts
Outdated
Show resolved
Hide resolved
6d638e2
to
62bd430
Compare
62bd430
to
ac553c0
Compare
ac553c0
to
a5f0f2d
Compare
a5f0f2d
to
c3bbe4a
Compare
c3bbe4a
to
53572ba
Compare
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.
Nx Cloud is proposing a fix for your failed CI:
Fixed a TypeScript error in the generated createNodes plugin template where the callback parameter options
was shadowing the normalized outer scope variable. The callback now uses the pre-normalized normalizedOptions
to ensure createNodesInternal
always receives a defined options object.
We verified this fix by re-running e2e-plugin:e2e-ci--src/nx-plugin-ts-solution.test.ts
.
Suggested Fix changes
diff --git a/packages/angular-rspack-compiler/package.json b/packages/angular-rspack-compiler/package.json
index 164423cb75..ae02aad3a1 100644
--- a/packages/angular-rspack-compiler/package.json
+++ b/packages/angular-rspack-compiler/package.json
@@ -1,7 +1,7 @@
{
"name": "@nx/angular-rspack-compiler",
"private": false,
- "version": "0.0.1",
+ "version": "22.0.0",
"publishConfig": {
"access": "public"
},
diff --git a/packages/angular-rspack/package.json b/packages/angular-rspack/package.json
index bd24ec75b0..fc933a089e 100644
--- a/packages/angular-rspack/package.json
+++ b/packages/angular-rspack/package.json
@@ -1,6 +1,6 @@
{
"name": "@nx/angular-rspack",
- "version": "0.0.1",
+ "version": "22.0.0",
"private": false,
"publishConfig": {
"access": "public"
@@ -49,8 +49,8 @@
"@ampproject/remapping": "2.3.0",
"@babel/core": "7.28.3",
"@discoveryjs/json-ext": "0.6.3",
- "@nx/angular-rspack-compiler": "workspace:*",
- "@nx/devkit": "workspace:*",
+ "@nx/angular-rspack-compiler": "22.0.0",
+ "@nx/devkit": "22.0.0",
"ansi-colors": "4.1.3",
"autoprefixer": "10.4.21",
"deepmerge": "^4.3.1",
diff --git a/packages/plugin/src/generators/create-nodes/files/plugin/__fileName__.ts.template b/packages/plugin/src/generators/create-nodes/files/plugin/__fileName__.ts.template
index cef5648355..c80145c087 100644
--- a/packages/plugin/src/generators/create-nodes/files/plugin/__fileName__.ts.template
+++ b/packages/plugin/src/generators/create-nodes/files/plugin/__fileName__.ts.template
@@ -70,8 +70,8 @@ const configGlob = '<%= configFile %>';
export const createNodesV2: CreateNodesV2<<%= className %>PluginOptions> = [
configGlob,
async (configFilePaths, options, context) => {
- options ??= {} as <%= className %>PluginOptions;
- const optionsHash = hashObject(options);
+ const normalizedOptions = options ?? ({} as <%= className %>PluginOptions);
+ const optionsHash = hashObject(normalizedOptions);
const cachePath = join(
workspaceDataDirectory,
`<%= fileName %>-${optionsHash}.hash`
@@ -80,10 +80,10 @@ export const createNodesV2: CreateNodesV2<<%= className %>PluginOptions> = [
try {
return await createNodesFromFiles(
- (configFile, options, context) =>
- createNodesInternal(configFile, options, context, targetsCache),
+ (configFile, _, context) =>
+ createNodesInternal(configFile, normalizedOptions, context, targetsCache),
configFilePaths,
- options,
+ normalizedOptions,
context
);
} finally {
⚙️ An Nx Cloud workspace admin can disable these reviews in workspace settings.
53572ba
to
e80b18f
Compare
Current Behavior
There is not currently a generator for creating an Inference Plugin in the
@nx/plugin
package.Expected Behavior
Add a generator for creating an Inference Plugin.
It can be invoked with
nx g @nx/plugin:create-nodes
.The
@nx/plugin:plugin
generator will also create an Inference Plugin by default.