Skip to content

Commit

Permalink
Fix package build
Browse files Browse the repository at this point in the history
  • Loading branch information
gauthier-th committed Oct 12, 2023
1 parent 0715daa commit aa101d8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@ Version 2 de l'API Divia.

Puisque [l'ancienne API de Keolis](http://timeo3.keolis.com/relais/217.php) n'est plus disponible, celle-ci utilise l'API du [site de Divia](https://www.divia.fr/bus-tram) qui renvoie un extrait de page HTML dans lequel se trouve les horaires des prochains passages.


## Importation de l'API :

- Avec ESM :
```js
import DiviaAPI from 'divia-api';
```
- Avec CommonJS :
```js
const DiviaAPI = require('divia-api');
```
- Via un CDN :
```html
<script src="https://cdn.jsdelivr.net/npm/divia-api/dist/divia-api.min.js"></script>
```

## Utilisation

Exemple :
```js
const DiviaAPI = require('divia-api');
const api = new DiviaAPI();
(async () => {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "divia-api",
"version": "2.2.4",
"version": "2.2.5",
"description": "Dvia API v2",
"main": "dist/divia-api.min.js",
"module": "dist/divia-api.min.js",
Expand Down
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ const path = require("path");

const config = {
entry: "./src/index.js",
target: "node",
devtool: "source-map",
node: { global: true },
output: {
path: path.resolve(__dirname, "dist"),
filename: "divia-api.js",
library: {
name: "divia-api",
name: "DiviaAPI",
type: "umd",
},
globalObject: `typeof self !== 'undefined' ? self : this`,
},
optimization: {
minimize: false,
Expand Down

0 comments on commit aa101d8

Please sign in to comment.