fix(core): use the module name as the name of the nx plugin (#16335)

This commit is contained in:
Jonathan Cammisuli 2023-04-17 10:18:42 -04:00 committed by GitHub
parent abf534c265
commit fa40367f2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,11 +80,12 @@ function getPluginPathAndName(
} }
} }
const packageJsonPath = path.join(pluginPath, 'package.json'); const packageJsonPath = path.join(pluginPath, 'package.json');
const { name } = const { name } =
!['.ts', '.js'].some((x) => x === path.extname(pluginPath)) && // Not trying to point to a ts or js file !['.ts', '.js'].some((x) => x === path.extname(pluginPath)) && // Not trying to point to a ts or js file
existsSync(packageJsonPath) // plugin has a package.json existsSync(packageJsonPath) // plugin has a package.json
? readJsonFile(packageJsonPath) // read name from package.json ? readJsonFile(packageJsonPath) // read name from package.json
: { name: path.basename(pluginPath) }; // use the name of the file we point to : { name: moduleName };
return { pluginPath, name }; return { pluginPath, name };
} }