@purplebugs/alpaca-map
v0.0.11
Published
Web component created using [lit](https://lit.dev/)
Downloads
446
Readme
Alpaca Map Web Component 🦙
Web component created using lit
Audience 🗺️
- For farmers, tourist or travel organisations who want to display the map on their website see the end users section
- For developers see the developer section
For end users 🪩
Copy and paste the lines below directly inside the
<head></head>
tag of website<meta name="viewport" content="width=device-width,initial-scale=1" />
Generate a google maps API key
Copy and paste the following code inside the
<body></body>
tag of website where the component should appear, replacingGOOGLE-API-KEY
with your key
<alpaca-map apiKey="GOOGLE-API-KEY"></alpaca-map>
- Optional. To center the map on a favourite farm, replace the latitude and longitude with its
centerLat
andcenterLng
coordinates
<alpaca-map apiKey="GOOGLE-API-KEY" centerLat="-33.8688" centerLng="151.2093"></alpaca-map>
- Optional. To override the data source, set the value of
dataSource
, eg
<alpaca-map apiKey="GOOGLE-API-KEY" dataSource="https://www.replace-me.com/api/cool-api"></alpaca-map>
- Optional. To override map markers linking to the farm page, set the value of
linkToFarmPage
true
- shows link on map marker to www.alpaca.life farm info pagefalse
- does not show link
eg
<alpaca-map apiKey="GOOGLE-API-KEY" linkToFarmPage=false></alpaca-map>
For developers 🤖
Install app 🪴
- Pre condition: Node version 22
npm install
API dependencies 🔗
Ensure APIs this app depends on are running
/api/companies
Develop app 👷♀️
- Pre condition: Build the file(s) indicated in build.js. Update as required
Build with hot refresh
npm run build:watch
Standard build
npm run build
Format the code
npm run prettier
🧪
Test app
Unit tests
npm run test
UI tests
- Precondition: Install browsers for UI tests
npx playwright install --with-deps
Run tests headless mode
npm run test-ui
Interactive mode
npm run test-ui -- --ui
Run app 🚀
npm run start
Navigate to address shown in log