-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
feat(v2): official CodeSandbox support #3717
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 3868e8f |
Your codesandbox seems to work, but for merging this I'll need:
Please explain with all the details how did you create that codesandbox template. I must be able to test your whole workflow, considering I know nothing about codesandbox. Please document the whole workflow I need to follow to validate that your work is fine and ready to be merged. Don't assume I know Codesandbox at all, because you probably know more than me |
Ok cool would work on a script that generates it without npm. |
Would detail everything once I make a script |
Thanks, It looks like indeed importing an url like https://github.com/sammychinedu2ky/docusaurus/tree/master/examples/facebook seems to work better :) |
Yes that's is because the entry point has less than 500 modules |
Not sure it's the best way, but it seems the following work: You could add scripts in root package.json that just do that + cleaning folder + copy the required json file |
Ok thanks would do that🙌🙌
…On Thu, Nov 12, 2020, 6:07 PM Sébastien Lorber ***@***.***> wrote:
Not sure it's the best way, but it seems the following work: node
./packages/docusaurus-init/bin/index.js init examples/classic classic
You could add scripts in root package.json that just do that + cleaning
folder + copy the required json file
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3717 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIUKTHHFVWIN5FCIXKIMOWLSPQI6PANCNFSM4TQRLGKQ>
.
|
I've added a script for that in the package.json file (examples:generate) |
examples/classic/package.json
Outdated
"last 1 safari version" | ||
] | ||
} | ||
"name": "examples-classic", |
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.
why use 1 space indentation?
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.
Sorry about that would change it to 2
sandbox.config.json
Outdated
"hardReloadOnChange": true, | ||
"view": "browser", | ||
"template": "node" | ||
} |
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.
can you generate it in the script instead?
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.
Yh sure let me do that
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.
Thanks, that looks great but can't run yarn examples:generate
twice without error (need to cleanup)
OK let me work on that |
I've worked on the fix. Everything is working now. |
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.
Thanks for your work, going to merge it.
I did some changes on your code because:
- you reverted some important package.json changes
- your cleanup of example folder did not work reliably
- some ESLint rules didn't pass
- all files should have the FB copyright header
- the node init script should rather forward its logs to parent process, so that users knows something is happening
Otherwise it works fine.
I'd recommend checking your Github workflow, because it's really bad if you end up reverting some changes others have done in your PR, like it happened here
package.json
Outdated
@@ -40,7 +41,7 @@ | |||
"test": "jest", | |||
"test:build:v2": "./admin/scripts/test-release.sh", | |||
"watch": "yarn lerna run --parallel --no-private watch", | |||
"clear": "yarn workspace docusaurus-2-website clear && yarn lerna exec --ignore docusaurus yarn rimraf lib", | |||
"clear": "yarn workspace docusaurus-2-website clear && yarn lerna exec 'yarn rimraf lib' --ignore docusaurus", |
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 should not be in your PR
package.json
Outdated
"@babel/core": "^7.9.0", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", | ||
"@babel/plugin-proposal-optional-chaining": "^7.9.0", | ||
"@babel/preset-typescript": "^7.9.0", |
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 should not be in your PR
thanks a lot, Sir, I'm grateful for the corrections but I tried pulling from the master branch before creating a new branch locally to work on. I think I made a mistake in that. |
Thanks for merging this pull request too 😁 |
NP I don't know exactly what happened 😅 just know that some diff was bad and had to manually revert it. Can you try to document this new Codesandbox support? In Readme and docs etc? (just wait until I merge #3760) |
Ok sure would do that. Thanks again 😁 |
Awesome addition 👏 |
* feat:added support for codesandbox * added sandbox config file * feat:added script to generate template for codesandbox * added examples:generate script to package.json file * added failing path to eslintignore * added script to eslintignore * added cleaning feature to script * deleted sandbox script in root * changed comment in codesandboxscript file * update codesandboxscript.js + revert bad package.json changes * eslint should check codesandboxscript Co-authored-by: slorber <lorber.sebastien@gmail.com>
Motivation
I saw an issue on adding Codesandbox config for Docusaurus which would enable the creation of Codesandbox templates for Docusaurus.
So I decided to work on that.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
I added a dev script to the package.json file and a sandbox.config.json file for each template under the examples folder
I made use of the classic template to create a docusaurus template on codesandbox. You can check it out using this link https://codesandbox.io/s/docusaurusclassics-xekwd
I generated the examples folder using this script
mkdir -p examples && cd examples && rm -rf * && npx @docusaurus/init@next init classic classic && npx @docusaurus/init@next init facebook facebook && npx @docusaurus/init@next init bootstrap bootstrap
Then added the dev script and sandbox.config.json file manually
Related PRs
#3702