From aa101d82e6c9bdf6990917dca031a18f1e069c78 Mon Sep 17 00:00:00 2001 From: gauthier-th Date: Thu, 12 Oct 2023 16:03:56 +0200 Subject: [PATCH] Fix package build --- README.md | 17 ++++++++++++++++- package-lock.json | 4 ++-- package.json | 2 +- webpack.config.js | 5 ++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 516aad4..106474c 100644 --- a/README.md +++ b/README.md @@ -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 + + ``` + ## Utilisation Exemple : ```js -const DiviaAPI = require('divia-api'); const api = new DiviaAPI(); (async () => { diff --git a/package-lock.json b/package-lock.json index 0afb5a3..b7e561b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "divia-api", - "version": "2.2.4", + "version": "2.2.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "divia-api", - "version": "2.2.4", + "version": "2.2.5", "license": "MIT", "dependencies": { "isomorphic-unfetch": "^3.1.0", diff --git a/package.json b/package.json index 8c921f9..52efff8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/webpack.config.js b/webpack.config.js index b8a7a1d..4ae7324 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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,