Skip to content
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

fix(core): handle case where package.json is not available at CWD #7187

Merged
merged 4 commits into from
Apr 21, 2022

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Apr 17, 2022

Motivation

Fix #7161. Moreover, this PR adds a DOCUSAURUS_VERSION env so that different modules can read this version without re-importing the package.json file.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Delete website/package.json, and add "dev": "cd website && docusaurus start", to the root package.json. The site starts gracefully:

image

@Josh-Cena Josh-Cena added the pr: bug fix This PR fixes a bug in a past release. label Apr 17, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 17, 2022
@netlify
Copy link

netlify bot commented Apr 17, 2022

[V2]

Name Link
🔨 Latest commit 896f76c
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/625ba3fcff15ad0009421374
😎 Deploy Preview https://deploy-preview-7187--docusaurus-2.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
Copy link

github-actions bot commented Apr 17, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 69
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-7187--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Apr 17, 2022

Size Change: +117 B (0%)

Total Size: 799 kB

Filename Size Change
website/build/assets/css/styles.********.css 107 kB +232 B (0%)
website/build/assets/js/main.********.js 604 kB -115 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 50 kB
website/build/index.html 38.8 kB

compressed-size-action

@netlify
Copy link

netlify bot commented Apr 17, 2022

[V2]

Name Link
🔨 Latest commit ec720ab
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62612e62db013300081702d1
😎 Deploy Preview https://deploy-preview-7187--docusaurus-2.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.

@Josh-Cena
Copy link
Collaborator Author

Josh-Cena commented Apr 17, 2022

We could have used pkg-up or similar utilities, but I'm not sure if that would lead to unexpected results, like finding a package.json that's below the desired one... If we are to make docusaurus upgrade (#4082), the package.json file has to be unambiguous, so it's better if we can set a standard practice from the beginning.

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

🤷‍♂️ not really fan, particularly the DOCUSAURUS_VERSION env var

packages/docusaurus/bin/beforeCli.mjs Show resolved Hide resolved
packages/docusaurus/bin/beforeCli.mjs Outdated Show resolved Hide resolved
@slorber slorber merged commit 3b32a41 into main Apr 21, 2022
@slorber slorber deleted the jc/site-version branch April 21, 2022 14:07
Josh-Cena added a commit that referenced this pull request May 5, 2022
* Revert "fix(core): handle case where package.json is not available at CWD (#7187)"

This reverts commit 3b32a41.

* properly fix

Co-authored-by: Joshua Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should not assume package.json is available at CWD
3 participants