Skip to content

Commit

Permalink
Add leaflet key and update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
likimmy committed Feb 8, 2024
1 parent 9938708 commit 7031d63
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/acceptance_headless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
name: Chrome Acceptance Tests (Headless)
runs-on: ubuntu-latest
env:
MAPBOX_KEY: ${{ secrets.MAPBOX_KEY }}
GOOGLE_KEY: ${{ secrets.GOOGLE_KEY }}
MAPBOX_KEY: ${{ secrets.MAPBOX_API_KEY }}
GOOGLE_KEY: ${{ secrets.GOOGLE_API_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ jobs:
test_script: npx jest tests/static/ --coverage
comparison_branch: master
secrets:
caller_github_token: ${{ secrets.GITHUB_TOKEN }}

caller_github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ jobs:
call_run_tests:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
build_script: ''
secrets:
MAPBOX_KEY: ${{ secrets.MAPBOX_KEY }}
build_script: ''
4 changes: 2 additions & 2 deletions static/js/default-map-api-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export function getDefaultMapApiKey(mapProvider) {
}
switch (mapProvider.toLowerCase()) {
case 'google':
return process.env.GOOGLE_KEY;
return process.env.GOOGLE_API_KEY;
case 'mapbox':
return process.env.MAPBOX_KEY;
return process.env.MAPBOX_API_KEY;
default:
throw new Error(
`Given mapProvider: '${mapProvider}' is invalid. Expects either 'google' or 'mapbox'.`
Expand Down
2 changes: 1 addition & 1 deletion static/js/theme-map/Maps/Providers/Baidu.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class BaiduPin extends ProviderPin {

// Load Function

const yextAPIKey = process.env.BAIDU_KEY;
const yextAPIKey = process.env.BAIDU_API_KEY;
const baseUrl = 'https://api.map.baidu.com/getscript';

/**
Expand Down
2 changes: 1 addition & 1 deletion static/js/theme-map/Maps/Providers/Leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class LeafletPin extends ProviderPin {

// Load Function

const yextAPIKey = process.env.MAPBOX_KEY;
const yextAPIKey = process.env.LEAFLET_API_KEY;
const baseUrl = 'https://unpkg.com/leaflet@1.6.0/dist/leaflet';

/**
Expand Down
2 changes: 1 addition & 1 deletion static/js/theme-map/Maps/Providers/Mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class MapboxPin extends ProviderPin {

// Load Function

const yextAPIKey = process.env.MAPBOX_KEY;
const yextAPIKey = process.env.MAPBOX_API_KEY;

/**
* This function is called when calling {@link MapProvider#load} on {@link module:Maps/Providers/Mapbox.MapboxMaps}.
Expand Down
6 changes: 4 additions & 2 deletions static/sample.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
MAPBOX_KEY=[[REPLACE_ME]]
BAIDU_KEY=[[REPLACE_ME]]
MAPBOX_API_KEY=[[REPLACE_ME]]
BAIDU_API_KEY=[[REPLACE_ME]]
GOOGLE_API_KEY=[[REPLACE_ME]]
LEAFLET_API_KEY=[[REPLACE_ME]]
7 changes: 4 additions & 3 deletions static/webpack-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ module.exports = function () {
...htmlPlugins,
new webpack.DefinePlugin({
'process.env.JAMBO_INJECTED_DATA': JSON.stringify(jamboInjectedData),
'process.env.MAPBOX_KEY': JSON.stringify(process.env.MAPBOX_KEY) || 'REPLACE_ME',
'process.env.BAIDU_KEY': JSON.stringify(process.env.BAIDU_KEY) || 'REPLACE_ME',
'process.env.GOOGLE_KEY': JSON.stringify(process.env.GOOGLE_KEY) || 'REPLACE_ME',
'process.env.MAPBOX_API_KEY': JSON.stringify(process.env.MAPBOX_API_KEY) || 'REPLACE_ME',
'process.env.BAIDU_API_KEY': JSON.stringify(process.env.BAIDU_API_KEY) || 'REPLACE_ME',
'process.env.GOOGLE_API_KEY': JSON.stringify(process.env.GOOGLE_API_KEY) || 'REPLACE_ME',
'process.env.LEAFLET_API_KEY': JSON.stringify(process.env.LEAFLET_API_KEY) || 'REPLACE_ME',
}),
new RemovePlugin({
after: {
Expand Down
6 changes: 4 additions & 2 deletions test-site/sample.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
MAPBOX_KEY=[[REPLACE_ME]]
BAIDU_KEY=[[REPLACE_ME]]
MAPBOX_API_KEY=[[REPLACE_ME]]
BAIDU_API_KEY=[[REPLACE_ME]]
GOOGLE_API_KEY=[[REPLACE_ME]]
LEAFLET_API_KEY=[[REPLACE_ME]]
4 changes: 1 addition & 3 deletions test-site/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ set_working_dir_to_test_site () {

set_working_dir_to_test_site

npx jambo build
chmod u+x ./public/static/node_modules/esbuild/bin/esbuild
npx grunt webpack
npx jambo build && npx grunt webpack

0 comments on commit 7031d63

Please sign in to comment.