-
Notifications
You must be signed in to change notification settings - Fork 13
chore: Update migration and refactoring scripts #1566
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6c0fb07
Update migration and refactoring scripts
willum070 fa5b6cc
Merge branch 'main' into update-scripts
willum070 178eaa0
Merge branch 'main' into update-scripts
willum070 ac250bd
Extract shared configuration generation into generate-shared-boilerpl…
willum070 9ac30fd
Merge branch 'main' into update-scripts
willum070 d826aa8
Merge remote-tracking branch 'origin/update-scripts' into update-scripts
willum070 6059b41
Merge branch 'main' into update-scripts
willum070 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| #!/bin/bash | ||
|
|
||
| # A helper script to generate common boilerplate files (package.json, tsconfig.json, README.md) | ||
| # for Google Maps JavaScript samples. | ||
| # Usage: ./generate-shared-boilerplate.sh <NAME> <TITLE> <OUTPUT_DIR> | ||
|
|
||
| NAME="$1" | ||
| TITLE="$2" | ||
| OUTPUT_DIR="${3:-.}" | ||
|
|
||
| if [ -z "$NAME" ] || [ -z "$TITLE" ]; then | ||
| echo "Usage: $0 <NAME> <TITLE> [OUTPUT_DIR]" | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p "${OUTPUT_DIR}/${NAME}" | ||
|
|
||
| # Generate package.json | ||
| cat > "${OUTPUT_DIR}/${NAME}/package.json" << EOF | ||
| { | ||
| "name": "@js-api-samples/${NAME}", | ||
| "version": "1.0.0", | ||
| "scripts": { | ||
| "build": "bash ../build-single.sh", | ||
| "test": "tsc && npm run build:vite --workspace=.", | ||
| "start": "tsc && vite build --config ../../vite.config.js --base './' && vite --config ../../vite.config.js", | ||
| "build:vite": "vite build --config ../../vite.config.js --base './'", | ||
| "preview": "vite preview --config ../../vite.config.js" | ||
| }, | ||
| "author": "Google LLC" | ||
| } | ||
| EOF | ||
|
|
||
| # Generate tsconfig.json | ||
| cat > "${OUTPUT_DIR}/${NAME}/tsconfig.json" << 'EOF' | ||
| { | ||
| "extends": "../../tsconfig.base.json", | ||
| "compilerOptions": { | ||
| "rootDir": "." | ||
| }, | ||
| "include": ["./*.ts"] | ||
| } | ||
| EOF | ||
|
|
||
| # Generate README.md | ||
| cat > "${OUTPUT_DIR}/${NAME}/README.md" << EOF | ||
| # Google Maps JavaScript Sample | ||
|
|
||
| ## ${NAME} | ||
|
|
||
| ${TITLE} | ||
|
|
||
| ## Setup | ||
|
|
||
| ### Before starting run: | ||
|
|
||
| \`npm i\` | ||
|
|
||
| ### Run an example on a local web server | ||
|
|
||
| \`cd samples/${NAME}\` | ||
| \`npm start\` | ||
|
|
||
| ### Build an individual example | ||
|
|
||
| \`cd samples/${NAME}\` | ||
| \`npm run build\` | ||
|
|
||
| From 'samples': | ||
|
|
||
| \`npm run build --workspace=${NAME}/\` | ||
|
|
||
| ### Build all of the examples. | ||
|
|
||
| From 'samples': | ||
|
|
||
| \`npm run build-all\` | ||
|
|
||
| ### Run lint to check for problems | ||
|
|
||
| \`cd samples/${NAME}\` | ||
| \`npx eslint index.ts\` | ||
|
|
||
| ## Feedback | ||
|
|
||
| For feedback related to this sample, please open a new issue on | ||
| [GitHub](https://github.com/googlemaps-samples/js-api-samples/issues). | ||
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.