Skip to content

Commit 28d08fe

Browse files
authored
Better dependencies / installation instructions (neveldo#329)
* Update bower.json (add ignore file list) * Update package.json (set peerdependencies and file list) * Allow multiple jquery/raphael dependencies * Update README file for installation * Use minified version for CDNJs
1 parent 6bce2ab commit 28d08fe

File tree

3 files changed

+140
-57
lines changed

3 files changed

+140
-57
lines changed

README.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,88 @@ Mapael supports all modern browsers and Internet Explorer 9+. For older versions
3333
* **Resizable** Maps are easily resizable.
3434
* **Zoom** Zoom and panning abilities (also on mobile devices).
3535

36+
## Installation
37+
38+
### Directly in your page
39+
40+
**Note on dependencies**: [jQuery](http://jquery.com/) and [Raphael](http://raphaeljs.com)
41+
(and [Mousewheel](https://github.com/jquery/jquery-mousewheel), if needed)
42+
must be loaded **before** Mapael in order to work properly.
43+
44+
**Note on maps**: map files must be loaded **after** Mapael in order to work properly.
45+
46+
#### Using CDN
47+
48+
Include in your project page one of these tags:
49+
```html
50+
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-mapael/2.1.0/js/jquery.mapael.min.js"></script>
51+
<script src="//cdn.jsdelivr.net/npm/jquery-mapael@2.1.0/js/jquery.mapael.min.js"></script>
52+
```
53+
54+
#### Using self-hosted
55+
56+
Download the [latest version](https://github.com/neveldo/jQuery-Mapael/releases/tag/2.1.0)
57+
and extract `jquery.mapael.min.js` in your project.
58+
59+
Then, add the script to your page (update the path as needed):
60+
```html
61+
<script src="path/to/jquery.mapael.min.js"></script>
62+
```
63+
64+
### Using a package manager
65+
66+
#### NPM / Yarn
67+
68+
In your project root, run either commandline:
69+
```text
70+
npm i --save jquery-mapael
71+
yarn add jquery-mapael
72+
```
73+
74+
However, if you don't need the optional Mousewheel feature (for Zoom feature),
75+
then you can use the `--no-optional` flag to skip optional dependencies.
76+
77+
Use either:
78+
```text
79+
npm i --no-optional jquery-mapael
80+
yarn add --no-optional jquery-mapael
81+
```
82+
83+
Then in your application:
84+
```js
85+
require('jquery-mapael');
86+
```
87+
Or, in ES6:
88+
```js
89+
import 'jquery-mapael';
90+
```
91+
92+
#### Bower
93+
94+
In your project root, run:
95+
```text
96+
bower install jquery-mapael --save
97+
```
98+
3699
## Basic code example
37100

38101
Here is the simplest example that shows how to display an empty map of the world :
39102

40103
**HTML :**
41-
104+
```html
42105
<div class="container">
43106
<div class="map">Alternative content</div>
44107
</div>
108+
```
45109

46110
**JS :**
47-
111+
```js
48112
$(".container").mapael({
49113
map : {
50114
name : "world_countries"
51115
}
52116
});
117+
```
53118

54119
## Examples
55120

bower.json

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
{
2-
"name": "jquery-mapael",
3-
"version": "2.1.0",
4-
"main": "./js/jquery.mapael.js",
5-
"description": "jQuery Mapael is a jQuery plugin based on raphael.js that allows you to display dynamic vector maps.",
6-
"license": "MIT",
7-
"ignore": [],
8-
"dependencies": {
9-
"raphael": "^2.2",
10-
"jquery": "^3.0",
11-
"jquery-mousewheel": "^3.1"
12-
},
13-
"devDependencies": {
14-
"grunt": "^1.0",
15-
"grunt-contrib-jshint": "^1.0",
16-
"grunt-contrib-qunit": "^1.2",
17-
"grunt-contrib-uglify": "^2.0"
18-
}
2+
"name": "jquery-mapael",
3+
"version": "2.1.0",
4+
"main": "./js/jquery.mapael.js",
5+
"description": "jQuery Mapael is a jQuery plugin based on raphael.js that allows you to display dynamic vector maps.",
6+
"license": "MIT",
7+
"ignore": [
8+
".*",
9+
"*.json",
10+
"*.md",
11+
"*.txt",
12+
"Gruntfile.js",
13+
"test",
14+
"examples",
15+
"!LICENSE",
16+
"!CHANGELOG.md"
17+
],
18+
"dependencies": {
19+
"raphael": "^2.2",
20+
"jquery": "^3.0",
21+
"jquery-mousewheel": "^3.1"
22+
},
23+
"devDependencies": {
24+
"grunt": "^1.0",
25+
"grunt-contrib-jshint": "^1.0",
26+
"grunt-contrib-qunit": "^1.2",
27+
"grunt-contrib-uglify": "^2.0"
28+
}
1929
}

package.json

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,48 @@
11
{
2-
"name": "jquery-mapael",
3-
"version": "2.1.0",
4-
"description": "jQuery Mapael is a jQuery plugin based on raphael.js that allows you to display dynamic vector maps.",
5-
"homepage": "https://www.vincentbroute.fr/mapael/",
6-
"main": "./js/jquery.mapael.js",
7-
"repository": {
8-
"type": "git",
9-
"url": "https://github.com/neveldo/jQuery-Mapael.git"
10-
},
11-
"author": "Vincent Brouté <contact@vincentbroute.fr> (https://www.vincentbroute.fr/)",
12-
"license": "MIT",
13-
"bugs": {
14-
"url": "https://github.com/neveldo/jQuery-Mapael/issues"
15-
},
16-
"keywords": [
17-
"jquery",
18-
"map",
19-
"vector",
20-
"svg",
21-
"dataviz",
22-
"dynamic",
23-
"jquery-plugin",
24-
"browser"
25-
],
26-
"dependencies": {
27-
"jquery": "^3.0",
28-
"raphael": "^2.2",
29-
"jquery-mousewheel": "^3.1"
30-
},
31-
"devDependencies": {
32-
"grunt": "^1.0",
33-
"grunt-contrib-jshint": "^1.1",
34-
"grunt-contrib-qunit": "^1.2",
35-
"grunt-contrib-uglify": "^2.0"
36-
},
37-
"scripts": {
38-
"test": "grunt test"
39-
}
2+
"name": "jquery-mapael",
3+
"version": "2.1.0",
4+
"description": "jQuery Mapael is a jQuery plugin based on raphael.js that allows you to display dynamic vector maps.",
5+
"homepage": "https://www.vincentbroute.fr/mapael/",
6+
"main": "./js/jquery.mapael.js",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/neveldo/jQuery-Mapael.git"
10+
},
11+
"author": "Vincent Brouté <contact@vincentbroute.fr> (https://www.vincentbroute.fr/)",
12+
"license": "MIT",
13+
"bugs": {
14+
"url": "https://github.com/neveldo/jQuery-Mapael/issues"
15+
},
16+
"keywords": [
17+
"jquery",
18+
"map",
19+
"vector",
20+
"svg",
21+
"dataviz",
22+
"dynamic",
23+
"jquery-plugin",
24+
"browser"
25+
],
26+
"dependencies": {
27+
"jquery": "^3.0 || ^2.0 || ^1.0",
28+
"raphael": "^2.2.0 || ^2.1.0"
29+
},
30+
"peerDependencies": {
31+
"jquery": "^3.0 || ^2.0 || ^1.0"
32+
},
33+
"optionalDependencies": {
34+
"jquery-mousewheel": "^3.1"
35+
},
36+
"devDependencies": {
37+
"grunt": "^1.0",
38+
"grunt-contrib-jshint": "^1.1",
39+
"grunt-contrib-qunit": "^1.2",
40+
"grunt-contrib-uglify": "^2.0"
41+
},
42+
"files": [
43+
"js/"
44+
],
45+
"scripts": {
46+
"test": "grunt test"
47+
}
4048
}

0 commit comments

Comments
 (0)