Skip to content

Commit 9ebc2bf

Browse files
committed
feat: Adds /dist so it can be there for DevSite macros to work.
1 parent 02ff6b1 commit 9ebc2bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2448
-2
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
samples/.env
55

66
# Ignore dist files generated by build.
7-
dist/*.js
87
samples/*/dist/
8+
dist/*.js
99

1010
# Ignore playwright outputs
1111
/test-results/
@@ -14,4 +14,5 @@ samples/*/dist/
1414
/playwright/.cache/
1515

1616
# Ignore Firebase cache
17-
.firebase
17+
.firebase
18+
firebase-debug.log

dist/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Maps JSAPI Samples</title>
5+
</head>
6+
<body>
7+
<!-- Default top-level index for Firebase Hosting -->
8+
<h1>Maps JSAPI Samples</h1>
9+
<ul>
10+
<li><a href='/samples/add-map/dist'>add-map</a></li>
11+
<li><a href='/samples/map-simple/dist'>map-simple</a></li>
12+
<li><a href='/samples/place-autocomplete-map/dist'>place-autocomplete-map</a></li>
13+
<li><a href='/samples/place-autocomplete-element/dist'>place-autocomplete-element</a></li>
14+
<li><a href='/samples/place-text-search/dist'>place-text-search</a></li>
15+
</ul>
16+
</body>
17+
</html>

dist/samples/add-map/app/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GOOGLE_MAPS_API_KEY="AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": [
3+
"plugin:@typescript-eslint/recommended"
4+
],
5+
"parser": "@typescript-eslint/parser",
6+
"rules": {
7+
"@typescript-eslint/ban-ts-comment": 0,
8+
"@typescript-eslint/no-this-alias": 1,
9+
"@typescript-eslint/no-empty-function": 1,
10+
"@typescript-eslint/explicit-module-boundary-types": 1,
11+
"@typescript-eslint/no-unused-vars": 1
12+
}
13+
}

dist/samples/add-map/app/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
TODO: Update this file with relevant instructions for building the sample
2+
in the new regime.
3+
4+
5+
# Google Maps JavaScript Sample
6+
7+
This sample is generated from @googlemaps/js-samples located at
8+
https://github.com/googlemaps-samples/js-api-samples.
9+
10+
## Setup
11+
12+
### Before starting run:
13+
14+
`$npm i`
15+
16+
### Run an example on a local web server
17+
18+
First `cd` to the folder for the sample to run, then:
19+
20+
`$npm start`
21+
22+
### Build an individual example
23+
24+
From `samples/`:
25+
26+
`$npm run build --workspace=sample-name/`
27+
28+
### Build all of the examples.
29+
30+
From `samples/`:
31+
`$npm run build-all`
32+
33+
## Feedback
34+
35+
For feedback related to this sample, please open a new issue on
36+
[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues).
37+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!doctype html>
2+
<!--
3+
Copyright 2025 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<!--[START maps_add_map]-->
18+
<html>
19+
<head>
20+
<title>Add a Map</title>
21+
22+
<link rel="stylesheet" type="text/css" href="./style.css" />
23+
<script type="module" src="./index.js"></script>
24+
</head>
25+
<body>
26+
<!--[START maps_add_map_heading]-->
27+
<h3>My Google Maps Demo</h3>
28+
<!--[END maps_add_map_heading]-->
29+
<!--[START maps_add_map_body]-->
30+
<div id="map"></div>
31+
<!--[END maps_add_map_body]-->
32+
<!-- prettier-ignore -->
33+
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
34+
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
35+
</body>
36+
</html>
37+
<!--[END maps_add_map]-->

dist/samples/add-map/app/index.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START maps_add_map]
18+
// Initialize and add the map
19+
let map;
20+
async function initMap(): Promise<void> {
21+
// [START maps_add_map_instantiate_map]
22+
// The location of Uluru.
23+
const position = {lat: -25.344, lng: 131.031};
24+
25+
// Request needed libraries.
26+
const {Map} =
27+
await google.maps.importLibrary('maps') as google.maps.MapsLibrary;
28+
const {AdvancedMarkerElement} =
29+
await google.maps.importLibrary('marker') as google.maps.MarkerLibrary;
30+
31+
// The map, centered at Uluru
32+
map = new Map(document.getElementById('map') as HTMLElement, {
33+
zoom: 4,
34+
center: position,
35+
mapId: 'DEMO_MAP_ID',
36+
});
37+
// [END maps_add_map_instantiate_map]
38+
39+
// [START maps_add_map_instantiate_marker]
40+
// The marker, positioned at Uluru
41+
const marker = new AdvancedMarkerElement({map, position, title: 'Uluru'});
42+
// [END maps_add_map_instantiate_marker]
43+
}
44+
initMap();
45+
// [END maps_add_map]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@js-api-samples/add-map",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"build": "tsc && bash ../jsfiddle.sh add-map && bash ../app.sh add-map && bash ../docs.sh add-map && npm run build:vite --workspace=.",
6+
"test": "tsc && npm run build:vite --workspace=.",
7+
"start": "tsc && vite build --base './' && vite",
8+
"build:vite": "vite build --base './'",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
13+
}
14+
}

dist/samples/add-map/app/style.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
/* [START maps_add_map] */
17+
/*
18+
* Always set the map height explicitly to define the size of the div element
19+
* that contains the map.
20+
*/
21+
#map {
22+
height: 100%;
23+
}
24+
25+
/*
26+
* Optional: Makes the sample page fill the window.
27+
*/
28+
html,
29+
body {
30+
height: 100%;
31+
margin: 0;
32+
padding: 0;
33+
}
34+
/* [END maps_add_map] */
35+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"module": "esnext",
4+
"target": "esnext",
5+
"strict": true,
6+
"noImplicitAny": false,
7+
"lib": [
8+
"es2015",
9+
"esnext",
10+
"es6",
11+
"dom",
12+
"dom.iterable"
13+
],
14+
"moduleResolution": "Node",
15+
"jsx": "preserve"
16+
}
17+
}

0 commit comments

Comments
 (0)