Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dojo build issues #547

Merged
merged 22 commits into from
Jul 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e8ef183
Move proj4 to the app config to allow developers to use offline vers…
green3g Apr 19, 2016
c5eeb40
Remove proj4 cdn path from streetview
green3g Apr 19, 2016
35e8d8d
Add a package.js build descriptor file
green3g Apr 20, 2016
becb23c
Switch to the bower version of google maps loader.
green3g Apr 21, 2016
ec2b691
Use quotes around reserved property 'float'
green3g Apr 21, 2016
2e74d21
Update package descriptor to only copy the image files
green3g Apr 21, 2016
683f5de
Remove old plugin import
green3g Apr 21, 2016
66a73bd
Fix indentation
green3g Apr 25, 2016
580347d
Disable eslint on vendor google-maps loader
green3g Apr 25, 2016
6a83281
Switch style setter to use dojo/dom-style
green3g Apr 25, 2016
8ced6d2
Exclude node_modules from amd search
green3g Apr 29, 2016
0e1ba87
Tell dojo to use the package.js build file
green3g Apr 29, 2016
1cf7750
Exclude node_modules and other non-amd files from being tagged as amd
green3g Apr 29, 2016
059b3ac
Remove troublesome error from Google Loader
green3g May 2, 2016
a62df6a
Add more rules to the package.js
green3g May 2, 2016
95ed51c
Makes config/app dojo-build friendly
green3g May 12, 2016
1e916e6
Fix proj4js path merge
green3g May 12, 2016
3f89efc
Fix eslint errors (again)
green3g May 12, 2016
0e5224f
Revert app.js back to cmv default and ignore app.js via the profile.
green3g May 12, 2016
088b9c9
Merge branch 'develop' into fix/fix-dojo-build-issues
green3g Jun 17, 2016
9914473
Merge branch 'develop' into fix/fix-dojo-build-issues
green3g Jul 9, 2016
90ee802
Merge branch 'develop' into fix/fix-dojo-build-issues
green3g Jul 14, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* This file is referenced by the `dojoBuild` key in `package.json` and provides extra hinting specific to the Dojo
* build system about how certain files in the package need to be handled at build time. Build profiles for the
* application itself are stored in the `profiles` directory.
*/

var profile = (function () {
//only copy files matching these expressions
//this prevents them from being evaluated as amd modules
var reCopyOnly = [
/Gruntfile/,
/package/,
/app\.js/
];
//exclude from builds completely
var reMiniExclude = [
/Gruntfile/,
/package/
];
//non-amd modules
var reNonAmd = [
/plugins\/Google/
];
return {
// Resource tags are functions that provide hints to the build system about the way files should be processed.
// Each of these functions is called once for every file in the package directory. The first argument passed to
// the function is the filename of the file, and the second argument is the computed AMD module ID of the file.
resourceTags: {
// Files that contain test code and should be excluded when the `copyTests` build flag exists and is `false`.
// It is strongly recommended that the `mini` build flag be used instead of `copyTests`. Therefore, no files
// are marked with the `test` tag here.
test: function (filename, mid) {
return false;
},

// Files that should be copied as-is without being modified by the build system.
// All files in the `app/resources` directory that are not CSS files are marked as copy-only, since these files
// are typically binaries (images, etc.) and may be corrupted by the build system if it attempts to process
// them and naively assumes they are scripts.
copyOnly: function (filename, mid) {
for (var i = 0; i < reCopyOnly.length; i++) {
if (reCopyOnly[i].test(filename)) {
return true;
}
}
return (/\/(images)\//.test(mid) && !/\.css$/.test(filename)) ||
/\/node_modules\//.test(mid);
},

// Files that are AMD modules.
// All JavaScript in this package should be AMD modules if you are starting a new project. If you are copying
// any legacy scripts from an existing project, those legacy scripts should not be given the `amd` tag.
amd: function (filename, mid) {
for (var i = 0; i < reNonAmd.length; i++) {
if (reNonAmd[i].test(filename)) {
return false;
}
}
return !this.copyOnly(filename, mid) && /\.js$/.test(filename);
},

// Files that should not be copied when the `mini` build flag is set to true.
// In this case, we are excluding this package configuration file which is not necessary in a built copy of
// the application.
miniExclude: function (filename, mid) {
for (var i = 0; i < reMiniExclude.length; i++) {
if (reMiniExclude[i].test(filename)) {
return true;
}
}
return false;
}
}
};
})();
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
"grunt-contrib-compress": "1.2.x",
"proxypage": "*"
},
"engine": "node >= 4"
}
"engine": "node >= 4",
"dojoBuild": "package.js"
}
5 changes: 4 additions & 1 deletion viewer/js/config/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
name: 'xstyle',
main: 'css',
location: 'https://cdn.rawgit.com/kriszyp/xstyle/v0.3.2'
}, {
name: 'proj4js',
location: '//cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12'
Copy link
Member

@tmcgee tmcgee Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roemhildtg A heads up. From my latest PR #571, I am recommending we use HTTPS wherever possible as it has now become the preferred "standard" practice versus the old // url pattern. Assuming that recommendation passes review from @DavidSpriggs, this proj4js reference would change to HTTPS.

}
]
};
Expand Down Expand Up @@ -61,4 +64,4 @@
]))();
controller.startup();
});
})();
})();
19 changes: 11 additions & 8 deletions viewer/js/gis/dijit/Directions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ define([
'esri/geometry/Point',
'esri/SpatialReference',
'dojo/topic',
'dojo/i18n!./Directions/nls/resource'
], function (declare, _WidgetBase, _TemplatedMixin, Directions, template, lang, Menu, MenuItem, PopupMenuItem, MenuSeparator, Point, SpatialReference, topic, i18n) {
'dojo/i18n!./Directions/nls/resource',
'dojo/dom-style'
], function (declare, _WidgetBase, _TemplatedMixin, Directions, template, lang, Menu, MenuItem, PopupMenuItem, MenuSeparator, Point, SpatialReference, topic, i18n, domStyle) {

return declare([_WidgetBase, _TemplatedMixin], {
templateString: template,
Expand All @@ -27,12 +28,14 @@ define([

//temp fix for 3.12 and 3.13 map click button.
if (this.directions._activateButton) {
this.directions._activateButton.style.display = 'none';
domStyle.set(this.directions._activateButton, 'display', 'none');
} else if (this.directions._activateButtonNode) {
this.directions._activateButtonNode.style.display = 'none';
this.directions._addDestinationNode.style.float = 'inherit';
this.directions._optionsButtonNode.style.float = 'inherit';
this.directions._optionsButtonNode.style.marginRight = '5px';
domStyle.set(this.directions._activateButtonNode, 'display', 'none');
domStyle.set(this.directions._addDestinationNode, 'float', 'inherit');
domStyle.set(this.directions._optionsButtonNode, {
'float': 'inherit',
marginRight: '5px'
});
}

if (this.mapRightClickMenu) {
Expand Down Expand Up @@ -130,4 +133,4 @@ define([
});
}
});
});
});
4 changes: 2 additions & 2 deletions viewer/js/gis/dijit/MapInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ define([
'dojo/dom-style',
'dojo/number',
'dojo/topic',
'//cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12/proj4.js',
'proj4js/proj4',
'xstyle/css!./MapInfo/css/MapInfo.css'
], function (
declare,
Expand Down Expand Up @@ -217,4 +217,4 @@ define([
return deg + '&deg;' + minIntTxt + '\'' + secTxt + '"&nbsp;' + dir;
}
});
});
});
83 changes: 45 additions & 38 deletions viewer/js/gis/dijit/StreetView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*global google */
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
Expand All @@ -17,31 +16,21 @@ define([
'esri/geometry/Point',
'esri/SpatialReference',
'dijit/MenuItem',
'//cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12/proj4.js',
'proj4js/proj4',
'dojo/i18n!./StreetView/nls/resource',

'gis/plugins/Google',
'dijit/form/ToggleButton',
'xstyle/css!./StreetView/css/StreetView.css',
'gis/plugins/async!//maps.google.com/maps/api/js?v=3'
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, aspect, topic, GraphicsLayer, Graphic, SimpleRenderer, template, PictureMarkerSymbol, domStyle, domGeom, Point, SpatialReference, MenuItem, proj4, i18n) {

'xstyle/css!./StreetView/css/StreetView.css'
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, aspect, topic, GraphicsLayer, Graphic, SimpleRenderer, template, PictureMarkerSymbol, domStyle, domGeom, Point, SpatialReference, MenuItem, proj4, i18n, Google) {
//cache google so
var google;
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
widgetsInTemplate: true,
templateString: template,
i18n: i18n,
mapClickMode: null,

panoOptions: {
addressControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
},
linksControl: false,
panControl: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
},
enableCloseButton: false
},
panoOptions: null,

// in case this changes some day
proj4BaseURL: 'http://spatialreference.org/',
Copy link
Member

@tmcgee tmcgee Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the spatialreference.org domain does not work using HTTPS, I will switch references from http://spatialreference.org to use https://epsg.io and revise the JS once this PR has been merged. This change will apply to the MapInfo widget as well.

Expand All @@ -57,29 +46,47 @@ define([

postCreate: function () {
this.inherited(arguments);
this.createGraphicsLayer();
this.map.on('click', lang.hitch(this, 'getStreetView'));
//load the google api asynchronously
Google.load(lang.hitch(this, function (g) {
//store a reference to google
google = g;

this.own(topic.subscribe('mapClickMode/currentSet', lang.hitch(this, 'setMapClickMode')));
//init our panoOptions since they depend on google
this.panoOptions = {
addressControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
},
linksControl: false,
panControl: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
},
enableCloseButton: false
};
this.createGraphicsLayer();
this.map.on('click', lang.hitch(this, 'getStreetView'));

if (this.parentWidget) {
if (this.parentWidget.toggleable) {
this.own(aspect.after(this.parentWidget, 'toggle', lang.hitch(this, function () {
this.onLayoutChange(this.parentWidget.open);
})));
this.own(topic.subscribe('mapClickMode/currentSet', lang.hitch(this, 'setMapClickMode')));

if (this.parentWidget) {
if (this.parentWidget.toggleable) {
this.own(aspect.after(this.parentWidget, 'toggle', lang.hitch(this, function () {
this.onLayoutChange(this.parentWidget.open);
})));
}
this.own(aspect.after(this.parentWidget, 'resize', lang.hitch(this, 'resize')));
this.own(topic.subscribe(this.parentWidget.id + '/resize/resize', lang.hitch(this, 'resize')));
}
this.own(aspect.after(this.parentWidget, 'resize', lang.hitch(this, 'resize')));
this.own(topic.subscribe(this.parentWidget.id + '/resize/resize', lang.hitch(this, 'resize')));
}

// spatialreference.org uses the old
// Proj4js style so we need an alias
// https://github.com/proj4js/proj4js/issues/23
window.Proj4js = proj4;
// spatialreference.org uses the old
// Proj4js style so we need an alias
// https://github.com/proj4js/proj4js/issues/23
window.Proj4js = proj4;

if (this.mapRightClickMenu) {
this.addRightClickMenu();
}
if (this.mapRightClickMenu) {
this.addRightClickMenu();
}
}));
},
createGraphicsLayer: function () {
this.pointSymbol = new PictureMarkerSymbol(require.toUrl('gis/dijit/StreetView/images/blueArrow.png'), 30, 30);
Expand Down Expand Up @@ -129,7 +136,7 @@ define([
} else {
this.connectMapClick();
}
//get map click, set up listener in post create
//get map click, set up listener in post create
},
disconnectMapClick: function () {
this.streetViewButtonDijit.set('checked', true);
Expand Down Expand Up @@ -302,4 +309,4 @@ define([
this.mapClickMode = mode;
}
});
});
});
Loading