Skip to content

Commit d61189d

Browse files
author
Víctor González
committed
Initial commit
0 parents  commit d61189d

File tree

11 files changed

+5206
-0
lines changed

11 files changed

+5206
-0
lines changed

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "eslint-config-airbnb-es5",
3+
"rules" : {
4+
"func-names": 0
5+
},
6+
"env" : {
7+
"browser" : true,
8+
"mocha" : true,
9+
"es6": true
10+
}
11+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
yarn-error.log
2+
node_modules
3+
coverage
4+
dist
5+

package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "js-app-boilerplate",
3+
"version": "1.0.0-SNAPSHOT",
4+
"dependencies": {
5+
"@csgis/bricjs-loader": "^0.0.1",
6+
"leaflet": "^1.2.0"
7+
},
8+
"devDependencies": {
9+
"babel-cli": "^6.26.0",
10+
"babel-core": "^6.26.0",
11+
"babel-eslint": "^7.2.1",
12+
"babel-loader": "^7.1.2",
13+
"babel-preset-env": "^1.6.0",
14+
"codecov": "^2.3.0",
15+
"copy-webpack-plugin": "^4.1.1",
16+
"css-loader": "^0.28.7",
17+
"eslint": "^3.18.0",
18+
"eslint-config-airbnb-es5": "^1.1.0",
19+
"eslint-plugin-react": "^6.10.3",
20+
"file-loader": "^1.1.5",
21+
"style-loader": "^0.19.0",
22+
"url-loader": "^0.6.2",
23+
"webpack": "^3.6.0",
24+
"webpack-archive-plugin": "^3.0.0",
25+
"webpack-dev-server": "^2.9.1"
26+
},
27+
"scripts": {
28+
"lint": "eslint src test",
29+
"build": "webpack",
30+
"start": "webpack-dev-server"
31+
}
32+
}

src/app.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"modules": {
3+
"layers": "./layers",
4+
"map": "./map"
5+
}
6+
}

src/config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default {
2+
'map': {
3+
'vendorOptions': {
4+
'center': [51.505, -0.09],
5+
'zoom': 13
6+
}
7+
},
8+
'layers': [{
9+
'id': 'mapbox.streets',
10+
'url': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
11+
'attribution': 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
12+
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
13+
}]
14+
};

src/index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<html lang="en">
3+
4+
<head>
5+
<title>BricJS Sample App</title>
6+
<style>
7+
#mymap {
8+
position: fixed;
9+
right: 0;
10+
left: 0;
11+
top: 0;
12+
bottom: 0;
13+
}
14+
</style>
15+
</head>
16+
17+
<body>
18+
<div id="mymap" data-bricjs-component="map"></div>
19+
<script src="bundle.js"></script>
20+
<script>
21+
App.run();
22+
</script>
23+
</body>
24+
25+
</html>

src/layers.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var L = require('leaflet');
2+
3+
function bricjs(opts, map) {
4+
opts.forEach(function (l) {
5+
L.tileLayer(l.url, {
6+
id: l.id,
7+
attribution: l.attribution
8+
}).addTo(map);
9+
});
10+
}
11+
12+
module.exports = bricjs;

src/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import 'leaflet/dist/leaflet.css';
2+
3+
import bricjs from '@csgis/bricjs-loader';
4+
import config from './config.js';
5+
import app from './app.json';
6+
7+
export { config };
8+
export let run = () => bricjs(config, app.modules, app.deps);

src/map.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var L = require('leaflet');
2+
3+
function bricjs(opts) {
4+
return L.map(opts.parent, opts.vendorOptions);
5+
}
6+
7+
module.exports = bricjs;

webpack.config.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
let path = require('path');
2+
let CopyWebpackPlugin = require('copy-webpack-plugin');
3+
4+
module.exports = {
5+
entry: './src/main.js',
6+
output: {
7+
path: path.join(__dirname, 'dist'),
8+
filename: './bundle.js',
9+
libraryTarget: 'var',
10+
library: 'App'
11+
},
12+
devtool: 'inline-source-map',
13+
module: {
14+
rules: [{
15+
test: /\.css$/,
16+
use: ['style-loader', {
17+
loader: 'css-loader',
18+
options: {
19+
minimize: true
20+
}
21+
}]
22+
}, {
23+
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
24+
loader: 'url-loader',
25+
options: {
26+
limit: 10000
27+
}
28+
}, {
29+
test: /app\.json/,
30+
use: ['@csgis/json-modules-loader', {
31+
loader: '@csgis/json-module-args-loader',
32+
options: {
33+
args: 'deps',
34+
skip: 1
35+
}
36+
}]
37+
}],
38+
loaders: [{
39+
test: /\.js$/,
40+
exclude: /node_modules/,
41+
loader: 'babel-loader',
42+
query: {
43+
compact: false
44+
}
45+
}]
46+
},
47+
plugins: [new CopyWebpackPlugin([
48+
{ from: 'src/index.html' }
49+
])]
50+
};

0 commit comments

Comments
 (0)