Commit 59124a5b authored by Christopher S Barnett's avatar Christopher S Barnett Committed by Christopher S Barnett
Browse files

updated dependencies

updated gulpfile.js to use new gulp api, add browserify task
updated README to add install and build instructions, quick link documentation
added package-lock.json
parent 13a03410
...@@ -5,10 +5,44 @@ international arms trade and broader military sector. It forms part ...@@ -5,10 +5,44 @@ international arms trade and broader military sector. It forms part
of WPF’s ongoing program on the Global Arms Trade and Corruption. of WPF’s ongoing program on the Global Arms Trade and Corruption.
___ ___
## quick links to countries and cases
You can link directly to a country or a case with a URI fragment.
The query string for a country is the 3 letter ISO code.
```shell
/index.html#country=SWE
```
The query string for a case is the URL encoded case name.
```shell
/index.html#deal=The%20South%20African%20Arms%20Deal
```
## Install and build javascript
Build javascript by running gulpfile.js. Browserify is used to create Build javascript by running gulpfile.js. Browserify is used to create
a javascript bundle. a javascript bundle.
requires Node, npm and gulp cli. See the gulp.js quickstart for information.
https://gulpjs.com/docs/en/getting-started/quick-start
### To install:
Navigate to the project directory.
To install javascript dependencies:
```shell
npm install
```
To build the javascript file:
```shell
gulp
```
___ ___
The arms deal data for the map is found in `docroot/data/wpf_deals.json` The arms deal data for the map is found in `docroot/data/wpf_deals.json`
......
This diff is collapsed.
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<link rel="stylesheet" href="css/leaflet.css"/> <link rel="stylesheet" href="css/leaflet.css"/>
<link rel="stylesheet" href="css/map.css"/> <link rel="stylesheet" href="css/map.css"/>
<!-- Bootstrap Core JavaScript --> <!-- Application JavaScript -->
<script src="dist/js/app.js"></script> <script src="dist/js/app.js"></script>
</head> </head>
......
"use strict"; const gulp = require('gulp');
const uglify = require('gulp-uglify');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
var browserify = require("browserify");
var gulp = require("gulp");
var source = require("vinyl-source-stream");
var buffer = require("vinyl-buffer");
var uglify = require("gulp-uglify");
var gutil = require("gulp-util");
gulp.task("javascript", function () { gulp.task('browserify', function() {
// set up the browserify instance on a task basis return browserify('./js/map.js')
var b = browserify({ .bundle()
entries: "./js/map.js", //Pass desired output filename to vinyl-source-stream
debug: true .pipe(source('app.js'))
}); // Start piping stream to tasks!
.pipe(gulp.dest('./js/'));
});
return b.bundle() gulp.task('compress', function() {
.pipe(source("app.js")) return gulp.src('./js/app.js')
.pipe(buffer()) .pipe(uglify())
// Add transformation tasks to the pipeline here. .pipe(gulp.dest('./docroot/dist/js/'));
.pipe(uglify())
.on("error", gutil.log)
.pipe(gulp.dest("./docroot/dist/js/"));
}); });
gulp.task('default', gulp.series('browserify', 'compress'));
This diff is collapsed.
...@@ -3,18 +3,19 @@ ...@@ -3,18 +3,19 @@
"version": "0.0.1", "version": "0.0.1",
"dependencies": { "dependencies": {
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"browserify": "^14.1.0",
"chroma": "0.0.1", "chroma": "0.0.1",
"gulp": "^3.9.1", "jquery": "^3.6.0",
"gulp-uglify": "^2.1.2",
"gulp-util": "^3.0.8",
"jquery": "^2.2.x",
"leaflet": "^1.0.3", "leaflet": "^1.0.3",
"leaflet-easybutton": "^2.2.0", "leaflet-easybutton": "^2.2.0",
"leaflet-legend": "^1.0.2", "leaflet-legend": "^1.0.2",
"leaflet.pattern": "teastman/Leaflet.pattern", "leaflet.pattern": "teastman/Leaflet.pattern",
"underscore": "^1.8.3", "underscore": "^1.8.3"
"vinyl-buffer": "^1.0.0", },
"vinyl-source-stream": "^1.1.0" "devDependencies": {
"browserify": "^17.0.0",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-uglify": "^3.0.2",
"vinyl-source-stream": "^2.0.0"
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment