@@ -67,12 +67,14 @@ const getContext = (context) => {
6767 */
6868export const listFrameworks = async function ( context ) {
6969 const { pathExists, packageJson, packageJsonPath, nodeVersion } = getContext ( context )
70- const { npmDependencies, scripts, runScriptCommand } = await getProjectInfo ( {
70+ const { npmDependencies, npmDependenciesVersions , scripts, runScriptCommand } = await getProjectInfo ( {
7171 pathExists,
7272 packageJson,
7373 packageJsonPath,
7474 } )
75- const frameworks = await pFilter ( FRAMEWORKS , ( framework ) => usesFramework ( framework , { pathExists, npmDependencies } ) )
75+ const frameworks = await pFilter ( FRAMEWORKS , ( framework ) =>
76+ usesFramework ( framework , { pathExists, npmDependencies, npmDependenciesVersions } ) ,
77+ )
7678 const frameworkInfos = frameworks . map ( ( framework ) =>
7779 getFrameworkInfo ( framework , { scripts, runScriptCommand, nodeVersion } ) ,
7880 )
@@ -90,8 +92,12 @@ export const listFrameworks = async function (context) {
9092export const hasFramework = async function ( frameworkId , context ) {
9193 const framework = getFrameworkById ( frameworkId )
9294 const { pathExists, packageJson, packageJsonPath } = getContext ( context )
93- const { npmDependencies } = await getProjectInfo ( { pathExists, packageJson, packageJsonPath } )
94- const result = await usesFramework ( framework , { pathExists, npmDependencies } )
95+ const { npmDependencies, npmDependenciesVersions } = await getProjectInfo ( {
96+ pathExists,
97+ packageJson,
98+ packageJsonPath,
99+ } )
100+ const result = await usesFramework ( framework , { pathExists, npmDependencies, npmDependenciesVersions } )
95101 return result
96102}
97103
@@ -131,11 +137,12 @@ const getFrameworkId = function ({ id }) {
131137}
132138
133139const getProjectInfo = async function ( { pathExists, packageJson, packageJsonPath } ) {
134- const { npmDependencies, scripts } = await getPackageJsonContent ( {
140+ const { npmDependencies, npmDependenciesVersions , scripts } = getPackageJsonContent ( {
135141 packageJson,
136142 } )
137143 const runScriptCommand = await getRunScriptCommand ( { pathExists, packageJsonPath } )
138- return { npmDependencies, scripts, runScriptCommand }
144+
145+ return { npmDependencies, npmDependenciesVersions, scripts, runScriptCommand }
139146}
140147
141148const getFrameworkInfo = function (
@@ -155,11 +162,12 @@ const getFrameworkInfo = function (
155162) {
156163 const devCommands = getDevCommands ( { frameworkDevCommand, scripts, runScriptCommand } )
157164 const recommendedPlugins = getPlugins ( plugins , { nodeVersion } )
165+
158166 return {
159167 id,
160168 name,
161169 package : {
162- name : detect . npmDependencies [ 0 ] ,
170+ name : typeof detect . npmDependencies [ 0 ] === 'string' ? detect . npmDependencies [ 0 ] : detect . npmDependencies [ 0 ] ?. name ,
163171 version : 'unknown' ,
164172 } ,
165173 category,
0 commit comments