From 4c252ae16bef1529830f22c4dae8fc9f00387d1c Mon Sep 17 00:00:00 2001 From: Eric Theise Date: Sun, 15 Mar 2020 20:10:59 -0600 Subject: [PATCH] refactor: other things crept in, hardly complete, enough to close #3 --- maps/static/maps/js/cards.js | 68 +++++++++++++ maps/static/maps/js/{app.js => index.js} | 111 ++++----------------- maps/templates/maps/index.html | 2 +- mdi/serializers.py | 19 +++- package-lock.json | 122 ++++++++++++++++------- package.json | 7 +- 6 files changed, 198 insertions(+), 131 deletions(-) create mode 100644 maps/static/maps/js/cards.js rename maps/static/maps/js/{app.js => index.js} (59%) diff --git a/maps/static/maps/js/cards.js b/maps/static/maps/js/cards.js new file mode 100644 index 0000000..b287248 --- /dev/null +++ b/maps/static/maps/js/cards.js @@ -0,0 +1,68 @@ +export const generateCards = (map, layers) => { + let visibleFeatures = map.queryRenderedFeatures({layers: layers}); + if (visibleFeatures) { + let htmlString = ''; + document.getElementById('visibles').innerHTML = htmlString; + + [...document.getElementsByTagName('article')].forEach(function (article) { + article.addEventListener('click', function () { + window.location = `/maps/organizations/${article.id}`; + }); + }); + } +}; + +export const generatePopupHtml = (f) => { + let + htmlString = ''; + if (f.properties.url) { + htmlString += `${f.properties.name}
`; + } else { + htmlString += `${f.properties.name}
`; + } + if (f.properties.address) { + htmlString += `${f.properties.address}
` + } + if (f.properties.city) { + htmlString += `${f.properties.city} ` + } + if (f.properties.state) { + htmlString += `${f.properties.state} ` + } + if (f.properties.postal_code) { + htmlString += `${f.properties.postal_code} ` + } + if (f.properties.country) { + htmlString += `${f.properties.country} ` + } + if (f.properties.type || f.properties.category || f.properties.sectors) { + htmlString += '
'; + } + if (f.properties.type) { + htmlString += `Type: ${f.properties.type}
` + } + if (f.properties.category) { + htmlString += `Category: ${f.properties.category}
` + } + if (f.properties.sectors) { + htmlString += `Sectors: ${f.properties.sectors.replace('[', '').replace(']', '').replace(/","/g, ', ').replace(/"/g, '')}`; + } + return htmlString; +}; diff --git a/maps/static/maps/js/app.js b/maps/static/maps/js/index.js similarity index 59% rename from maps/static/maps/js/app.js rename to maps/static/maps/js/index.js index a455704..4b97bed 100644 --- a/maps/static/maps/js/app.js +++ b/maps/static/maps/js/index.js @@ -1,8 +1,10 @@ +import { generateCards, generatePopupHtml } from './cards.js'; + mapboxgl.accessToken = 'pk.eyJ1IjoiZXJpY3RoZWlzZSIsImEiOiJjazVvNGNmM2wxaGhjM2pvMGc0ZmIyaXN3In0.Jrt9t5UrY5aCbndSpq5JWw'; var map = new mapboxgl.Map({ - container: 'map', // container id + container: 'map', style: 'mapbox://styles/mapbox/dark-v10', - center: [-74.5, 40], // starting position [lng, lat] + center: [-74.5, 40], zoom: 4, hash: true, scrollZoom: false @@ -110,8 +112,17 @@ map.on('load', function () { source: 'organizations', filter: ['!', ['has', 'point_count']], paint: { - 'circle-color': '#11b4da', - 'circle-radius': 4, + 'circle-color': [ + 'match', + ['get', 'category'], + 'platform co-op', colorScale('platformCoop'), + 'co-op-run platform', colorScale('coopRunPlatform'), + 'shared platform', colorScale('sharedPlatform'), + 'supporter', colorScale('supporter'), + 'other', colorScale('other'), + '#999' + ], + 'circle-radius': 8, 'circle-stroke-width': 1, 'circle-stroke-color': '#fff' } @@ -137,34 +148,13 @@ map.on('load', function () { map.on('click', 'unclustered-point', function (e) { map.getCanvas().style.cursor = 'pointer'; - let - htmlString = ''; - if (e.features[0].properties.url) { - htmlString += `${e.features[0].properties.name}
`; - } else { - htmlString += `${e.features[0].properties.name}
`; - } - if (e.features[0].properties.address) { htmlString += `${e.features[0].properties.address}
`} - if (e.features[0].properties.city) { htmlString += `${e.features[0].properties.city} `} - if (e.features[0].properties.state) { htmlString += `${e.features[0].properties.state} `} - if (e.features[0].properties.postal_code) { htmlString += `${e.features[0].properties.postal_code} `} - if (e.features[0].properties.country) { htmlString += `${e.features[0].properties.country} `} - if (e.features[0].properties.type || e.features[0].properties.category || e.features[0].properties.sectors) { - htmlString += '
'; - } - if (e.features[0].properties.type) { htmlString += `Type: ${e.features[0].properties.type}
`} - if (e.features[0].properties.category) { htmlString += `Category: ${e.features[0].properties.category}
`} - if (e.features[0].properties.sectors) { - htmlString += `Sectors: ${e.features[0].properties.sectors.replace('[', '').replace(']', '').replace(/","/g, ', ').replace(/"/g, '')}`; - } - let popup = new mapboxgl.Popup({ closeButton: true, closeOnClick: true }); popup.setLngLat(e.features[0].geometry.coordinates) - .setHTML(htmlString) + .setHTML(generatePopupHtml(e.features[0])) .addTo(map); }); @@ -175,43 +165,13 @@ map.on('load', function () { map.getCanvas().style.cursor = ''; }); - let makeCardList = () => { - let visibleFeatures = map.queryRenderedFeatures({layers: ['unclustered-point']}); - - if (visibleFeatures) { - htmlString = ''; - document.getElementById('visibles').innerHTML = htmlString; - - [...document.getElementsByTagName('article')].forEach(function (article) { - article.addEventListener('click', function () { - window.location = `/maps/organizations/${article.id}`; - }); - }); - } - }; + generateCards(map, ['unclustered-point']); map.on('render', function () { - makeCardList(); + generateCards(map, ['unclustered-point']); }); map.on('moveend', function () { - makeCardList(); + generateCards(map, ['unclustered-point']); }); // map.addLayer({ @@ -294,37 +254,4 @@ map.on('load', function () { // return point_counts; // }; -/* - map.on('mouseover', 'organizations', function (e) { - map.getCanvas().style.cursor = 'pointer'; - let - htmlString = ''; - if (e.features[0].properties.url) { - htmlString += '' + e.features[0].properties.name + '
' - } else { - htmlString += '' + e.features[0].properties.name + '
' - } - if (e.features[0].properties.address !== 'null') { htmlString += e.features[0].properties.address + '
' } - if (e.features[0].properties.city !== 'null') { htmlString += e.features[0].properties.city + ' '} - if (e.features[0].properties.state !== 'null') { htmlString += e.features[0].properties.state + ' ' } - if (e.features[0].properties.postal_code !== 'null') { htmlString += e.features[0].properties.postal_code + ' ' } - if (e.features[0].properties.country !== 'null') { htmlString += e.features[0].properties.country + ' ' } - if (e.features[0].properties.type !== 'null' || e.features[0].properties.type !== 'null') { htmlString += '
' } - if (e.features[0].properties.type !== 'null') { htmlString += 'Type: ' + e.features[0].properties.type + '
'} - if (e.features[0].properties.type !== 'null') { htmlString += 'Category: ' + e.features[0].properties.category + '
' } - if (e.features[0].properties.sectors !== 'null') { - htmlString += 'Sectors: ' + e.features[0].properties.sectors.replace('[', '').replace(']', '').replace(/","/g, ', ').replace(/"/g, ''); - } - - popup.setLngLat(e.features[0].geometry.coordinates) - .setHTML(htmlString) - .addTo(map); - }); - - map.on('mouseleave', 'organizations', function () { - map.getCanvas().style.cursor = ''; - popup.remove(); - }) -*/ - }); diff --git a/maps/templates/maps/index.html b/maps/templates/maps/index.html index a62a889..d5c1e52 100644 --- a/maps/templates/maps/index.html +++ b/maps/templates/maps/index.html @@ -9,6 +9,6 @@

Platform Co-op
Directory {% include 'maps/search.html' %}
- +
{% endblock %} diff --git a/mdi/serializers.py b/mdi/serializers.py index 5ef472f..d8e883b 100644 --- a/mdi/serializers.py +++ b/mdi/serializers.py @@ -1,15 +1,30 @@ from rest_framework import serializers from accounts.models import User from django.contrib.auth.models import Group -from mdi.models import Organization, Sector, Tool, License, Language +from mdi.models import Organization, SocialNetwork, Sector, Tool, License, Language from rest_framework_gis.serializers import GeoFeatureModelSerializer from django_countries.serializers import CountryFieldMixin +# class UserSerializer(CountryFieldMixin, GeoFeatureModelSerializer): class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User - fields = ('username', 'id', 'email', 'groups') + fields = ( + 'id', + 'email', + 'first_name', + 'middle_name', + 'last_name', + 'address', + 'city', + 'state', + 'postal_code', + 'country', + 'url', + 'bio', + 'notes' + ) class GroupSerializer(serializers.HyperlinkedModelSerializer): diff --git a/package-lock.json b/package-lock.json index 3702a66..67e7418 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1650,7 +1650,6 @@ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", "dev": true, - "optional": true, "requires": { "micromatch": "^3.1.4", "normalize-path": "^2.1.1" @@ -1661,7 +1660,6 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, - "optional": true, "requires": { "remove-trailing-separator": "^1.0.1" } @@ -1681,8 +1679,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true, - "optional": true + "dev": true }, "arr-flatten": { "version": "1.1.0", @@ -1712,8 +1709,7 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true, - "optional": true + "dev": true }, "arraybuffer.slice": { "version": "0.0.7", @@ -2099,7 +2095,6 @@ "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "dev": true, - "optional": true, "requires": { "arr-flatten": "^1.1.0", "array-unique": "^0.3.2", @@ -2118,7 +2113,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -3104,7 +3098,6 @@ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", "dev": true, - "optional": true, "requires": { "anymatch": "^2.0.0", "async-each": "^1.0.1", @@ -5152,12 +5145,31 @@ "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", "dev": true }, + "exorcist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/exorcist/-/exorcist-1.0.1.tgz", + "integrity": "sha1-eTFuPEiFhFSQ97tAXA5bXbEWfFI=", + "dev": true, + "requires": { + "is-stream": "~1.1.0", + "minimist": "0.0.5", + "mkdirp": "~0.5.1", + "mold-source-map": "~0.4.0" + }, + "dependencies": { + "minimist": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz", + "integrity": "sha1-16oye87PUY+RBqxrjwA/o7zqhWY=", + "dev": true + } + } + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", "dev": true, - "optional": true, "requires": { "debug": "^2.3.3", "define-property": "^0.2.5", @@ -5173,7 +5185,6 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, - "optional": true, "requires": { "is-descriptor": "^0.1.0" } @@ -5183,7 +5194,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -5234,7 +5244,6 @@ "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", "dev": true, - "optional": true, "requires": { "array-unique": "^0.3.2", "define-property": "^1.0.0", @@ -5251,7 +5260,6 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, - "optional": true, "requires": { "is-descriptor": "^1.0.0" } @@ -5261,7 +5269,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -5271,7 +5278,6 @@ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, - "optional": true, "requires": { "kind-of": "^6.0.0" } @@ -5281,7 +5287,6 @@ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, - "optional": true, "requires": { "kind-of": "^6.0.0" } @@ -5291,7 +5296,6 @@ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, - "optional": true, "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", @@ -5302,8 +5306,7 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "optional": true + "dev": true } } }, @@ -5368,7 +5371,6 @@ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true, - "optional": true, "requires": { "extend-shallow": "^2.0.1", "is-number": "^3.0.0", @@ -5381,7 +5383,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -6228,7 +6229,6 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, - "optional": true, "requires": { "is-glob": "^3.1.0", "path-dirname": "^1.0.0" @@ -6239,7 +6239,6 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, - "optional": true, "requires": { "is-extglob": "^2.1.0" } @@ -7217,8 +7216,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, - "optional": true + "dev": true }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -7231,7 +7229,6 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", "dev": true, - "optional": true, "requires": { "is-extglob": "^2.1.1" } @@ -7241,7 +7238,6 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2" } @@ -7305,6 +7301,12 @@ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, "is-svg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-3.0.0.tgz", @@ -7372,8 +7374,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "optional": true + "dev": true }, "isstream": { "version": "0.1.2", @@ -7980,7 +7981,6 @@ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, - "optional": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", @@ -8001,8 +8001,7 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "optional": true + "dev": true } } }, @@ -8150,6 +8149,24 @@ } } }, + "mold-source-map": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/mold-source-map/-/mold-source-map-0.4.0.tgz", + "integrity": "sha1-z2fgsxxHq5uttcnCVlGGISe7gxc=", + "dev": true, + "requires": { + "convert-source-map": "^1.1.0", + "through": "~2.2.7" + }, + "dependencies": { + "through": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/through/-/through-2.2.7.tgz", + "integrity": "sha1-bo4hIAGR1OtqmfbwEN9Gqhxusr0=", + "dev": true + } + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -8273,8 +8290,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "optional": true + "dev": true }, "normalize-url": { "version": "3.3.0", @@ -8678,6 +8694,15 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "outpipe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/outpipe/-/outpipe-1.1.1.tgz", + "integrity": "sha1-UM+GFjZeh+Ax4ppeyTOaPaRyX6I=", + "dev": true, + "requires": { + "shell-quote": "^1.4.2" + } + }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -12001,6 +12026,33 @@ "pbf": "^3.0.5" } }, + "watchify": { + "version": "3.11.1", + "resolved": "https://registry.npmjs.org/watchify/-/watchify-3.11.1.tgz", + "integrity": "sha512-WwnUClyFNRMB2NIiHgJU9RQPQNqVeFk7OmZaWf5dC5EnNa0Mgr7imBydbaJ7tGTuPM2hz1Cb4uiBvK9NVxMfog==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "browserify": "^16.1.0", + "chokidar": "^2.1.1", + "defined": "^1.0.0", + "outpipe": "^1.1.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + }, + "dependencies": { + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } + } + }, "wgs84": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/wgs84/-/wgs84-0.0.0.tgz", diff --git a/package.json b/package.json index 33cc972..b72835e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,10 @@ "optimize": "npm run optimize:js", "build:js": "browserify -t [ babelify ] -t envify maps/static/maps/js/app.js | uglifyjs -c warnings=false -o maps/static/maps/dist/js/site.js", "watch:lint": "onchange maps/static/maps/js/*.js -- npm run lint", + "watch:css": "onchange maps/static/maps/css/* -- npm run build:css", "lint": "eslint maps/static/maps/js/*.js", + "watch:js": "watchify -t [ babelify ] -t envify maps/static/maps/js/index.js -o 'exorcist maps/static/maps/dist/js/site.js.map > maps/static/maps/dist/js/site.js' -dv", + "watch": "npm run clean && npm run copy:fonts && npm run copy:images && npm run build:css && concurrently --raw \"npm run watch:lint\" \"npm run watch:babel\" \"npm run watch:js\" \"npm run watch:css\"", "build": "npm run clean && concurrently \"npm run build:babel\" \"npm run build:js\" \"npm run build:css\" \"npm run copy:fonts\" \"npm run copy:images\" && npm run optimize", "dev:browser-sync": "browser-sync start --no-open --proxy localhost:8000 --files \"static/dist/js/*.js, static/dist/css/*.css\"", "dev": "concurrently --raw \"./manage.py runserver\" \"npm run watch\" \"npm run dev:browser-sync\"", @@ -60,9 +63,11 @@ "cssnano": "^4.1.10", "envify": "^4.1.0", "eslint": "^7.0.0-alpha.2", + "exorcist": "^1.0.1", "husky": "^4.2.3", "less": "^3.11.1", "onchange": "^6.1.0", - "uglify": "^0.1.5" + "uglify": "^0.1.5", + "watchify": "^3.11.1" } }