Commit 3b9ec81a authored by S Anand's avatar S Anand
Browse files

REF: refactor functions into separate files

parent 4bf6bfeb
Pipeline #38232 passed with stage
in 1 minute and 18 seconds
export { version } from './src/package.js'
import { dispatch } from './src/jquery.dispatch.js'
if (typeof jQuery != 'undefined') {
jQuery.extend(jQuery.fn, {
dispatch: dispatch
})
}
export { version } from './src/package.js'
import { dispatch } from './src/jquery.dispatch.js'
import { template } from './src/jquery.template.js'
if (typeof jQuery != 'undefined') {
jQuery.extend(jQuery.fn, {
dispatch: dispatch,
template: template
})
}
export {version} from './src/package.js'
export {url} from './index-urlfilter.js'
import './index-jquery.js'
import './index-template.js'
import './index-event.js'
import './index-leaflet.js'
......@@ -11,13 +11,23 @@ export default [
output: { file: "dist/g1.min.js", format: "umd", name: "g1" }
},
{
input: "index-jquery",
input: "index-urlfilter",
plugins: [ uglify() ],
output: { file: "dist/jquery.min.js", format: "umd", name: "g1_jquery" }
output: { file: "dist/urlfilter.min.js", format: "umd", name: "g1" }
},
{
input: "index-template",
plugins: [uglify()],
output: { file: "dist/template.min.js", format: "umd", name: "g1._modules" }
},
{
input: "index-event",
plugins: [uglify()],
output: { file: "dist/event.min.js", format: "umd", name: "g1._modules" }
},
{
input: "index-leaflet",
plugins: [ uglify() ],
output: { file: "dist/leaflet.min.js", format: "umd", name: "g1_leaflet" }
output: { file: "dist/leaflet.min.js", format: "umd", name: "g1._modules" }
}
]
const path = require('path')
const express = require('express')
const paths = [
'test/jquery.urlfilter.html',
'test/jquery.dispatch.html',
'test/jquery.template.html',
'test/test-urlfilter.html',
'test/test-template.html',
'test/test-event.html',
'test/leaflet.topojson.html'
]
const port = process.argv.length <= 2 ? 1112 : 1111
......
......@@ -3,7 +3,7 @@
<head>
<title>dispatch tests</title>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../dist/g1.js"></script>
<script src="../dist/event.min.js"></script>
<script src="tape.js"></script>
</head>
<body>
......
<!DOCTYPE html>
<html>
<head>
<title>urlfilter tests</title>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../node_modules/leaflet/dist/leaflet.js"></script>
<script src="../dist/g1.min.js"></script>
<script src="tape.js"></script>
</head>
<body>
<script>
tape.onFinish(function () { window.renderComplete = true })
</script>
<script>
tape('g1 attributes exist', function(t) {
t.ok(typeof g1 == 'object', 'g1')
t.ok(typeof g1.version == 'string', 'g1.version')
t.ok(typeof g1.url == 'object', 'g1.url')
t.ok(typeof g1.url.parse == 'function', 'g1.url.parse')
t.ok(typeof g1.url.join == 'function', 'g1.url.join')
t.ok(typeof g1.url.update == 'function', 'g1.url.update')
t.ok(typeof $.fn.urlfilter == 'function', '$.fn.urlfilter')
t.ok(typeof $.fn.template == 'function', '$.fn.template')
t.ok(typeof $.fn.dispatch == 'function', '$.fn.dispatch')
t.ok(typeof L.TopoJSON == 'function', 'L.TopoJSON')
t.end()
})
</script>
</body>
</html>
......@@ -4,7 +4,7 @@
<title>template tests</title>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../node_modules/lodash/lodash.min.js"></script>
<script src="../dist/g1.js"></script>
<script src="../dist/template.min.js"></script>
<script src="tape.js"></script>
</head>
<body>
......
......@@ -3,7 +3,8 @@
<head>
<title>urlfilter tests</title>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../dist/g1.js"></script>
<script src="../dist/urlfilter.min.js"></script>
<script src="../dist/event.min.js"></script>
<script src="../node_modules/component-emitter/index.js"></script>
<script src="tape.js"></script>
<script class="test-utilities">
......
Markdown is supported
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