Skip to content

Commit

Permalink
Completed basic functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
lseelenbinder committed Jun 27, 2023
1 parent b34bbc1 commit 8d0c01c
Show file tree
Hide file tree
Showing 15 changed files with 5,814 additions and 4,762 deletions.
50 changes: 3 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,8 @@
# vite-vanilla-ts-lib-starter
# Stadia Maps MapLibre Search Box

The starter is built on top of Vite 4.x and prepared for writing libraries in TypeScript. It generates a hybrid package - both support for CommonJS and ESM modules.
TODO

## Features

- Hybrid support - CommonJS and ESM modules
- IIFE bundle for direct browser support without bundler
- Typings bundle
- ESLint - scripts linter
- Stylelint - styles linter
- Prettier - formatter
- Vitest - test framework
- Husky + lint-staged - pre-commit git hook set up for formatting

## GitHub Template

This is a template repo. Click the green [Use this template](https://github.com/kbysiec/vite-vanilla-ts-lib-starter/generate) button to get started.

## Clone to local

If you prefer to do it manually with the cleaner git history

```bash
git clone https://github.com/kbysiec/vite-vanilla-ts-lib-starter.git
cd vite-vanilla-ts-lib-starter
npm i
```

## Checklist

When you use this template, update the following:

- Remove `.git` directory and run `git init` to clean up the history
- Change the name in `package.json` - it will be the name of the IIFE bundle global variable and bundle files name (`.cjs`, `.mjs`, `.iife.js`, `d.ts`)
- Change the author name in `LICENSE`
- Clean up the `README` and `CHANGELOG` files

And, enjoy :)

## Usage

The starter contains the following scripts:
## Development

- `dev` - starts dev server
- `build` - generates the following bundles: CommonJS (`.cjs`) ESM (`.mjs`) and IIFE (`.iife.js`). The name of bundle is automatically taken from `package.json` name property
Expand All @@ -53,9 +15,3 @@ The starter contains the following scripts:
- `format` - format all with prettier and stylelint
- `prepare` - script for setting up husky pre-commit hook
- `uninstall-husky` - script for removing husky from repository

## Acknowledgment

If you found it useful somehow, I would be grateful if you could leave a star in the project's GitHub repository.

Thank you.
18 changes: 0 additions & 18 deletions dts-bundle-generator.config.ts

This file was deleted.

15 changes: 0 additions & 15 deletions favicon.svg

This file was deleted.

31 changes: 26 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,33 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<title>Search Test</title>
<script src="https://unpkg.com/maplibre-gl@3.0.1/dist/maplibre-gl.js"></script>
<link
href="https://unpkg.com/maplibre-gl@3.0.1/dist/maplibre-gl.css"
rel="stylesheet"
/>
<script src="./src/index.ts" type="module"></script>
<link href="./src/index.scss" rel="stylesheet" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/index.ts"></script>
<body style="margin: 0; padding: 0">
<div id="map" style="height: 100vh; width: 100vw"></div>
<script type="module">
import { MapLibreSearchControl } from "./src";

var control = new MapLibreSearchControl({
useMapFocusPoint: true,
});
var navControl = new maplibregl.NavigationControl();
var map = new maplibregl.Map({
container: "map",
style: "https://tiles.stadiamaps.com/styles/alidade_smooth.json", // stylesheet location
center: [-74.5, 40], // starting position [lng, lat]
zoom: 2, // starting zoom
});
map.addControl(navControl, "top-left");
map.addControl(control, "top-left");
</script>
</body>
</html>
Loading

0 comments on commit 8d0c01c

Please sign in to comment.