-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[docs-infra] Ensure create-playground
script only runs if target file is absent
#19603
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
[docs-infra] Ensure create-playground
script only runs if target file is absent
#19603
Conversation
Deploy preview: https://deploy-preview-19603--material-ui-x.netlify.app/ Bundle size report
|
docs/package.json
Outdated
"icons": "rimraf public/static/icons/* && node ./scripts/buildIcons.js", | ||
"serve": "serve ./export -l 3010", | ||
"create-playground": "cpy --cwd=scripts playground.template.tsx ../../pages/playground --rename=index.tsx", | ||
"create-playground": "if [ ! -f ./pages/playground/index.tsx ]; then cpy --cwd=scripts playground.template.tsx ../../pages/playground --rename=index.tsx; fi", |
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.
"create-playground": "if [ ! -f ./pages/playground/index.tsx ]; then cpy --cwd=scripts playground.template.tsx ../../pages/playground --rename=index.tsx; fi", | |
"create-playground": "cpy --cwd=scripts playground.template.tsx ../../pages/playground --rename=index.tsx --no-overwrite", |
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.
if we are using a custom cli might as well use it's features 😆
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 know... but this will exit the command with code 1. that's why I wrapped it in the if
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.
|| true
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.
|| true
Will never catch other issues when actually trying to copy
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.
It just won't exit with code 1+, it will still print the error to the console.
Otherwise I would rather we have a node script that does this, instead of having a full if
block there 😆
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 know.... felt super overkill. Benefits of the if are that the command will actually properly fail and not silently ... I don't find the if that disturbing tbh. It should be preferred over the silent fail though
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.
yeah but that if wont work in windows if ppl are using it for some reason, which I believe is the reason to use the copy cli in the first place, instead of simply cp
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.
yea, i keep forgetting about those ... did a quick node script and could therefor remove the cpy
package as well, since this was the only place it got used anyways!
…`. Remove `cpy-cli` and related unused dependencies.
Some of us use a custom index file to ensure hydration, apply theming, etc is not causing any problems, so the overwrite of this, when restarting the playground was annoying.
Example index file (thanks @romgrk):
https://gist.github.com/michelengelen/4e3be09aab5d2be1a1e346eab07dc7cc