Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

feat: detect installed version of framework #822

Merged
merged 14 commits into from
Oct 27, 2022

Conversation

ericapisani
Copy link
Contributor

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 thelistFrameworks method which is used by the build-info project as part of the build process.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This
    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.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@netlify
Copy link

netlify bot commented Oct 18, 2022

Deploy Preview for framework-info ready!

Name Link
🔨 Latest commit 23a0733
🔍 Latest deploy log https://app.netlify.com/sites/framework-info/deploys/6356897912bcb600081db2e3
😎 Deploy Preview https://deploy-preview-822--framework-info.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Oct 18, 2022

t.deepEqual(frameworksBuildFirst[0].dev.commands, ['npm run dev', 'npm run start', 'npm run build'])
t.deepEqual(frameworksBuildFirst, frameworksDevFirst)
})
Copy link
Contributor Author

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

@ericapisani ericapisani marked this pull request as ready for review October 21, 2022 19:42
@ericapisani ericapisani self-assigned this Oct 21, 2022
Copy link

@maxcell maxcell left a 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'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the change!

Comment on lines +47 to +48
* 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
Copy link

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!

@kodiakhq kodiakhq bot merged commit 8f4c78a into main Oct 27, 2022
@kodiakhq kodiakhq bot deleted the ep-detect-installed-version-of-framework branch October 27, 2022 13:59
@@ -157,6 +158,10 @@ const getFrameworkInfo = function (
return {
id,
name,
package: {
name: detect.npmDependencies[0],
version: 'unknown',
Copy link
Contributor

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'?

Copy link
Contributor Author

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
*/

/**
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants