Skip to content

Commit

Permalink
feat(create-docusaurus): ask user for preferred language when no lang…
Browse files Browse the repository at this point in the history
…uage CLI option provided (#9442)

Co-authored-by: sebastien <[email protected]>
  • Loading branch information
Rafael-Martins and slorber authored Feb 15, 2024
1 parent 6fd8408 commit 628752d
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 151 deletions.
3 changes: 2 additions & 1 deletion admin/scripts/generateExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ async function generateTemplateExample(template) {
// Run the docusaurus script to create the template in the examples folder
const command = template.endsWith('-typescript')
? template.replace('-typescript', ' -- --typescript')
: template;
: `${template} -- --javascript`;

shell.exec(
// We use the published init script on purpose, because the local init is
// too new and could generate upcoming/unavailable config options.
Expand Down
2 changes: 1 addition & 1 deletion admin/scripts/test-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
cd ..

# Build skeleton website with new version
npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-docusaurus@"$NEW_VERSION" test-website classic $EXTRA_OPTS
npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS

# Stop Docker container
if [[ -z "${KEEP_CONTAINER:-true}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
Expand Down
4 changes: 2 additions & 2 deletions packages/create-docusaurus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For Docusaurus maintainers, templates can be tested with:
```bash
cd `git rev-parse --show-toplevel` # Back to repo root
rm -rf test-website
yarn create-docusaurus test-website classic
yarn create-docusaurus test-website classic --javascript
cd test-website
yarn start
```
Expand All @@ -37,7 +37,7 @@ Use the following to test the templates against local packages:
```bash
cd `git rev-parse --show-toplevel` # Back to repo root
rm -rf test-website-in-workspace
yarn create-docusaurus test-website-in-workspace classic
yarn create-docusaurus test-website-in-workspace classic --javascript
cd test-website-in-workspace
yarn build
yarn start
Expand Down
1 change: 1 addition & 0 deletions packages/create-docusaurus/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ program
'Do not run package manager immediately after scaffolding',
)
.option('-t, --typescript', 'Use the TypeScript template variant')
.option('-j, --javascript', 'Use the JavaScript template variant')
.option(
'-g, --git-strategy <strategy>',
`Only used if the template is a git repository.
Expand Down
Loading

0 comments on commit 628752d

Please sign in to comment.