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

[code-infra] Ease playground creation #1322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dev": "next dev --port 3005",
"deploy": "git push -f material-ui-docs master:latest",
"serve": "serve ./export -l 3010",
"create-playground": "cpy --cwd=scripts playground.template.tsx \"../../src/app/(private)/playground\" --rename=index.tsx",
Copy link
Member

Choose a reason for hiding this comment

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

I feel like it would be easier to just move playground.template.tsx to ../(private)/playground and manually duplicate/copy it when you want to make a new playground
In the Material UI repo I've used the playground script once (maybe twice?) and after that I just made new ones by duplicating something already tehre

Copy link
Member

Choose a reason for hiding this comment

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

👍 I agree, I never used the script. The main problem I currently see with the playgrounds is how deeply nested they are in the directory tree.

Copy link
Member

Choose a reason for hiding this comment

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

how deeply nested they are in the directory tree

Now that you mention this, what I've been doing a lot (manually in the terminal) is copying some demo in /(public) to the playground dir, and replacing the style import with import styles from '../../(public)/(content)/react/components/slider/demos/hero/css-modules/index.module.css'; (repeatedly from my clipboard history 😅)

Maybe you all are doing something similar as well? If so maybe a script could help, e.g. take the path to a demo and copy that demo to the playground, optionally rewrite the path to styles or copy the css file as well: pnpm create-playground slider/demos/hero (or menu/demos/checkbox-items etc)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I see how this could be useful. If it also opened the created playground in vscode, it would be nearly perfect :)

"typescript": "tsc -b tsconfig.json",
"link-check": "tsx ./scripts/reportBrokenLinks.mts"
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"docs:size-why": "cross-env DOCS_STATS_ENABLED=true pnpm docs:build",
"docs:start": "pnpm --filter docs serve",
"docs:link-check": "pnpm --filter docs link-check",
"docs:create-playground": "pnpm --filter docs create-playground",
"extract-error-codes": "cross-env MUI_EXTRACT_ERROR_CODES=true lerna run --concurrency 8 build:modern",
"install:codesandbox": "pnpm install --no-frozen-lockfile",
"jsonlint": "node ./scripts/jsonlint.mjs",
Expand Down Expand Up @@ -98,6 +99,7 @@
"chalk": "^5.4.1",
"compression-webpack-plugin": "^11.1.0",
"concurrently": "^8.2.2",
"cpy-cli": "^5.0.0",
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
"docs": "workspace:^",
Expand Down
138 changes: 138 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading