diff --git a/samples/build-single.sh b/samples/build-single.sh index 083c86998..289ae3b00 100644 --- a/samples/build-single.sh +++ b/samples/build-single.sh @@ -168,6 +168,8 @@ npx eslint # clean comments for empty lines, and then clean up, to preserve newlines sed -i.sed-back 's#^$#// TMP EMPTY LINE#g' *.ts && rm *.sed-back set +e +rm -rf dist +set +e npx tsc status=$? set -e @@ -207,6 +209,10 @@ set -e bash ../jsfiddle.sh "$NAME" bash ../app.sh "$NAME" -bash ../docs.sh "$NAME" +if [ -f "src/app.tsx" ] || [ -f "src/app.jsx" ] || [ -f "src/app.js" ]; then + bash ../react-docs.sh "$NAME" +else + bash ../docs.sh "$NAME" +fi npm run build:vite --workspace=. bash ../dist.sh "$NAME" \ No newline at end of file diff --git a/samples/dist.sh b/samples/dist.sh index ddd70f991..b0fdba67e 100755 --- a/samples/dist.sh +++ b/samples/dist.sh @@ -20,4 +20,5 @@ SAMPLE_DIR="${PROJECT_ROOT}/dist/samples/${NAME}" echo "PROJECT_ROOT: ${PROJECT_ROOT}" # Copy Vite output files to /dist/samples/${NAME}/dist +rm -rf "${SAMPLE_DIR}/dist" cp -r "${SCRIPT_DIR}/${NAME}/dist" "${SAMPLE_DIR}" diff --git a/samples/react-docs.sh b/samples/react-docs.sh index cb73da297..b00f7931c 100755 --- a/samples/react-docs.sh +++ b/samples/react-docs.sh @@ -16,16 +16,29 @@ echo "PROJECT_ROOT: ${PROJECT_ROOT}" DOCS_DIR="${PROJECT_ROOT}/dist/samples/${NAME}/docs" -# Create two new folders. -mkdir -p ${DOCS_DIR}/src +# Create new folders. +mkdir -p "${DOCS_DIR}/src" # Copy files -cp "${SCRIPT_DIR}/${NAME}/src/app.js" "${DOCS_DIR}/src/app.js" -cp "${SCRIPT_DIR}/${NAME}/src/app.tsx" "${DOCS_DIR}/src/app.tsx" -cp "${SCRIPT_DIR}/${NAME}/src/styles.css" "${DOCS_DIR}/src/styles.css" -cp "${SCRIPT_DIR}/${NAME}/index.html" "${DOCS_DIR}/index.html" - -# Copy the data folder if one is found. -if [ -d "public" ] && [ "$(ls -A public)" ]; then - cp -r public/* "${DOCS_DIR}/" -fi \ No newline at end of file +if [ -f "${SCRIPT_DIR}/${NAME}/dist/app.js" ]; then + cp "${SCRIPT_DIR}/${NAME}/dist/app.js" "${DOCS_DIR}/app.js" +fi + +if [ -f "${SCRIPT_DIR}/${NAME}/src/app.tsx" ]; then + cp "${SCRIPT_DIR}/${NAME}/src/app.tsx" "${DOCS_DIR}/src/app.tsx" +fi + +if [ -f "${SCRIPT_DIR}/${NAME}/style.css" ]; then + cp "${SCRIPT_DIR}/${NAME}/style.css" "${DOCS_DIR}/style.css" +elif [ -f "${SCRIPT_DIR}/${NAME}/src/styles.css" ]; then + cp "${SCRIPT_DIR}/${NAME}/src/styles.css" "${DOCS_DIR}/style.css" +fi + +if [ -f "${SCRIPT_DIR}/${NAME}/index.html" ]; then + cp "${SCRIPT_DIR}/${NAME}/index.html" "${DOCS_DIR}/index.html" +fi + +# Copy the public folder if one is found (graphics, other static files). +if [ -d "${SCRIPT_DIR}/${NAME}/public" ] && [ "$(ls -A ${SCRIPT_DIR}/${NAME}/public)" ]; then + cp -r "${SCRIPT_DIR}/${NAME}/public/"* "${DOCS_DIR}/" +fi diff --git a/samples/react-ui-kit-place-details-compact/package.json b/samples/react-ui-kit-place-details-compact/package.json index d91ebb720..30cf11789 100644 --- a/samples/react-ui-kit-place-details-compact/package.json +++ b/samples/react-ui-kit-place-details-compact/package.json @@ -9,5 +9,6 @@ "build:vite": "vite build --config ../../vite.config.js --base './'", "preview": "vite preview --config ../../vite.config.js" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 } diff --git a/samples/react-ui-kit-place-details-latlng-compact/package.json b/samples/react-ui-kit-place-details-latlng-compact/package.json index 6cf6a7ec2..c3ccf07e8 100644 --- a/samples/react-ui-kit-place-details-latlng-compact/package.json +++ b/samples/react-ui-kit-place-details-latlng-compact/package.json @@ -9,5 +9,6 @@ "build:vite": "vite build --config ../../vite.config.js --base './'", "preview": "vite preview --config ../../vite.config.js" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 } diff --git a/samples/react-ui-kit-place-details-latlng/package.json b/samples/react-ui-kit-place-details-latlng/package.json index 46ddede28..c1901db82 100644 --- a/samples/react-ui-kit-place-details-latlng/package.json +++ b/samples/react-ui-kit-place-details-latlng/package.json @@ -12,5 +12,6 @@ "devDependencies": { "@vitejs/plugin-react": "^6.0.2" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 } diff --git a/samples/react-ui-kit-place-details/package.json b/samples/react-ui-kit-place-details/package.json index 0c0a73391..879f4b067 100644 --- a/samples/react-ui-kit-place-details/package.json +++ b/samples/react-ui-kit-place-details/package.json @@ -9,5 +9,6 @@ "build:vite": "vite build --config ../../vite.config.js --base './'", "preview": "vite preview --config ../../vite.config.js" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 } diff --git a/samples/react-ui-kit-search-nearby/package.json b/samples/react-ui-kit-search-nearby/package.json index 48d42cd06..172b81888 100644 --- a/samples/react-ui-kit-search-nearby/package.json +++ b/samples/react-ui-kit-search-nearby/package.json @@ -12,5 +12,6 @@ "devDependencies": { "@vitejs/plugin-react": "^6.0.2" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 } diff --git a/samples/react-ui-kit-search-text/package.json b/samples/react-ui-kit-search-text/package.json index 447954045..cd9405d57 100644 --- a/samples/react-ui-kit-search-text/package.json +++ b/samples/react-ui-kit-search-text/package.json @@ -12,5 +12,6 @@ "devDependencies": { "@vitejs/plugin-react": "^6.0.2" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 } diff --git a/samples/rgm-autocomplete/package.json b/samples/rgm-autocomplete/package.json index e79e02971..ed59059d2 100644 --- a/samples/rgm-autocomplete/package.json +++ b/samples/rgm-autocomplete/package.json @@ -9,5 +9,6 @@ "build:vite": "vite build --config ../../vite.config.js --base './'", "preview": "vite preview --config ../../vite.config.js" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 } diff --git a/samples/rgm-basic-map/package.json b/samples/rgm-basic-map/package.json index dfcbcca4a..7005b579c 100644 --- a/samples/rgm-basic-map/package.json +++ b/samples/rgm-basic-map/package.json @@ -9,5 +9,6 @@ "build:vite": "vite build --config ../../vite.config.js --base './'", "preview": "vite preview --config ../../vite.config.js" }, - "author": "Google LLC" + "author": "Google LLC", + "buildRevision": 1 }