Skip to content

Commit

Permalink
Merge pull request #179 from mmayeda/84-remove-mainjs-bundle
Browse files Browse the repository at this point in the history
84 remove mainjs bundle
  • Loading branch information
dadiorchen authored May 23, 2024
2 parents acb6bff + 9166571 commit 506a5db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 49 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,15 @@ _check `dist/index.html` for a demo_

# how to debug the core on the client side

The senerio: sometime we need to find a easy way to debug the core in the client side, for example, the web map client repo, it's installing the core by npm, so it's hard to change code in core on the client side, we can install the core by `folder` locally, and get the change on the client side immediately, to do so:
The scenario: sometimes we need to find an easy way to debug the core web map in the parent client side application
(for example, the web map client repo). The web map client repo is installing web map core as a npm package using npm,
so it's hard to change code in core and see the results in the parent client application. One way around this is by
installing web map core by a reference to its local `folder`, which allows changes made to web map core locally
to propagate to the parent client application immediately. To do so:

1. Download the web map core repository, `git clonet [path to repo]`
1. Download the web map core repository: `git clone https://github.com/Greenstand/treetracker-web-map-core.git`
1. Change to code you want in core
1. Change the version number in `package.json` (this is neccessary, if don't do it, it's posssible the client will ignore/skip the installment)
1. Generate the bundle: `npm run pre-publish` (this is nessessary, the npm will fetch the bundle file rather than the src files)
1. Change the version number in `package.json` (this is necessary, if don't do it, it's possible the client will ignore/skip the installment)
1. Generate the bundle: `npm run pre-publish` (this is necessary, the npm will fetch the bundle file rather than the src files)
1. Install the core in web map client: `npm install --save [relative path to the core folder]`
1. Restart the web map client
2 changes: 0 additions & 2 deletions dist/main.js

This file was deleted.

45 changes: 2 additions & 43 deletions src/Map.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* The main model for the treetracker model
* The main model for the treetracker map
*/
import regeneratorRuntime from 'regenerator-runtime'
import axios from 'axios'
import expect from 'expect-runtime'
import log from 'loglevel'
Expand All @@ -25,8 +24,6 @@ import NearestTreeArrows from './NearestTreeArrows'

class MapError extends Error {}

console.log('Greenstand web map core, version:')

export default class Map {
// events
static REGISTERED_EVENTS = {
Expand All @@ -40,7 +37,7 @@ export default class Map {
}

constructor(options) {
// default
// merge constructor parameter options with default map options
const mapOptions = {
...{
L: window.L,
Expand All @@ -62,15 +59,8 @@ export default class Map {
this[key] = mapOptions[key]
})

// memeber/properties/statuses

// requester
this.requester = new Requester()

// events
this.events = new EventEmitter()

// mount element
this._mountDomElement = null

log.warn('map core version:', require('../package.json').version)
Expand Down Expand Up @@ -640,12 +630,6 @@ export default class Map {
return queryUrl
}

// getClusterRadius(zoomLevel){
// //old code
// //var clusterRadius = getQueryStringValue("clusterRadius") || getClusterRadius(queryZoomLevel);
// return Map.getClusterRadius(zoomLevel);
// }

_goNextPoint() {
log.info('go next tree')
const currentPoint = this.layerSelected.payload
Expand Down Expand Up @@ -1423,29 +1407,4 @@ export default class Map {
clearSelection() {
this._unselectMarker()
}

// async rerender() {
// log.info('rerender')
// log.info('reload tile')

// // unslect the current selected point
// this._unselectMarker()

// await this._unloadTileServer()

// // load tile
// if (this.filters.treeid) {
// log.info('treeid mode do not need tile server')
// log.info('load tree by id')
// await this._loadTree(this.filters.treeid)
// this.tileLoadingMonitor && this.tileLoadingMonitor.destroy()
// } else if (this.filters.tree_name) {
// log.info('tree name mode do not need tile server')
// log.info('load tree by name')
// this.tileLoadingMonitor && this.tileLoadingMonitor.destroy()
// await this._loadTree(undefined, this.filters.tree_name)
// } else {
// await this._loadTileServer()
// }
// }
}

0 comments on commit 506a5db

Please sign in to comment.