-
Notifications
You must be signed in to change notification settings - Fork 21
feat: detect installed version of framework #822
Conversation
✅ Deploy Preview for framework-info ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
||
t.deepEqual(frameworksBuildFirst[0].dev.commands, ['npm run dev', 'npm run start', 'npm run build']) | ||
t.deepEqual(frameworksBuildFirst, frameworksDevFirst) | ||
}) |
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.
This test didn't make the most sense to me so I removed it
…:netlify/framework-info into ep-detect-installed-version-of-framework
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.
Looks good to me! Seriously appreciate you walking me through this PR yesterday and the logic you had! I did a bit more digging to understand some elements but now it feels fairly clear to me. This is going to be great! 🎉
@@ -1,29 +1,29 @@ | |||
import { cwd, version } from 'process' | |||
import { cwd, version as nodejsVersion } from 'process' |
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.
Love the change!
* This cannot currently be used in the browser at this time, which is why it's defined | ||
* here rather than in `core.js` as part of the `getFrameworkInfo` method |
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.
Love this note here for the rationale!
@@ -157,6 +158,10 @@ const getFrameworkInfo = function ( | |||
return { | |||
id, | |||
name, | |||
package: { | |||
name: detect.npmDependencies[0], | |||
version: 'unknown', |
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.
What the reason version
is set to 'unknown'
?
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.
I thought that undefined
was not a great thing to output to the build logs in the event that there was an issue detecting the version, so I decided on this instead.
@@ -19,16 +24,62 @@ import { listFrameworks as list, hasFramework as has, getFramework as get } from | |||
* @property {string} directory - Relative path to the directory where files are built | |||
*/ | |||
|
|||
/** |
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.
This syntax works, but just FYI, that you can write them in a *.d.ts file as well. See https://github.com/netlify/plugins/blob/main/types/plugins.d.ts and where it gets referenced here https://github.com/netlify/plugins/blob/main/bin/sync_plugins_to_cms.js#L13
Summary
Fixes this issue
Currently one of the most common follow up questions we ask our customers is 'what version of the framework do you use?' when trying to debug an issue.
This change exposes that information as part of the
listFrameworks
method which is used by thebuild-info
project as part of the build process.For us to review and ship your PR efficiently, please perform the following steps:
ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a
typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)