-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Conversation
Is there any docs on the requirements for the tabs/spaces etc for the spaces/tabs indentation? |
This discussion of a build system is very timely. I will comment more when back at the office. As to the code rules: The rules are in the .eslintrc file travis uses that file to impose our perhaps overly strict rules. ;) You can run |
Here's an example of possibly an overly strict rule: https://travis-ci.org/cmv/cmv-app/builds/124825733#L1352 Alternative is to use dojo's domStyle to set the float value. This should pass the eslint checks AND avoid the float is a reserved word. |
@roemhildtg This is GREAT! Thanks for putting in the time to make this work. It has been on our list for awhile. Please get the Travis checks passing, as @tmcgee mentioned, and we will take steps to include this PR. |
@roemhildtg Please update with base branch. |
0117e09
to
a53d766
Compare
@roemhildtg Let us know when it's working. |
Oh sorry, I've tried it out and everything seems to work as expected. |
@roemhildtg I am curious if loading the Google maps api as a plugin addresses the issue noted at the bottom of the README for the new Google Nearby contributed widget that also uses that api? |
I think that issue should be addressed by the google-maps plugin. It looks like if Google is defined, it simply returns the result. https://github.com/Carrooi/Js-GoogleMapsLoader/blob/develop/lib/Google.js#L62-L78 |
We should wait on merging this, I've just started discovering a new set of issues with the dojo builder and cmv. I'd like to get those cleared up I think before. |
@roemhildtg @DavidSpriggs I understand the need/desire for moving proj4js to the dojoConfig packages array for build purposes. In PR #553 I added xstyle (and put-selector) to the packages array - a necessity to address a potential issue with Google Chrome identified in #552. That got me thinking about a topic that has been tossed around before. Should we be more in control of our own destiny and include some or all of these third-party libraries in a |
Another comment related to proj4js. I am wanting to move all resources and map services over HTTPS whenever possible. Even when the originating app is served over HTTP, accessing other resources securely using HTTPS is best practice. The new Google plugin loads the google api using HTTPS - a move in the right direction. I think http://spatialreference.org is the only blocker in the core cmv project. The references to spatialreference.org needs to change regardless since it will not work when the app is served over HTTPS. A move to epsg.io would address this. |
Its definitely relevant, its great to look into the other options available. I've found the dojo builder really difficult to configure and work with and very finicky. So I've also been looking into loading dojo with systemjs with esri systemjs. |
SystemJS has been used to create StealJS which comes with a very easy build tool. I've been using Steal on a different project and its build process scans for dependencies by telling it an entry point. Really neat and almost no config necessary. |
+1 on epsg.io |
@tmcgee One of the issues I'm currently looking into is the My only thought is to move the window.dojoConfig back into the index.html. |
@roemhildtg does the build succeed if you use |
It doesn't. Edit: I was wrong. the |
This is how I'm able to get the build to work: (function () {
//var path = location.pathname.replace(/[^\/]+$/, '');
dojoConfig = {
async: true,
packages: [
{
name: 'viewer',
location: 'js/viewer'
}, {
name: 'gis',
location: 'js/gis'
}, {
name: 'config',
location: 'js/config'
}, {
name: 'proj4js',
location: '//cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12'
}
]
};
require(dojoConfig, [
'dojo/_base/declare',
//........ |
Can you wrap it in a define statement like this: define([], function () { // or perhaps define(null, function () { ?
var path = location.pathname.replace(/[^\/]+$/, '');
window.dojoConfig = {
async: true,
packages: [
{
name: 'viewer',
location: path + 'js/viewer'
}, {
name: 'gis',
location: path + 'js/gis'
}, {
name: 'config',
location: path + 'js/config'
}
]
};
require(window.dojoConfig, [
'dojo/_base/declare',
...
}); which seems a little more "dojo-ish" than the original (function () {
...
})(); The function wrapped in the |
@roemhildtg Some thoughts... Simply pass (function () {
require({
async: true,
baseUrl: '/',
packages: [{
name: 'app',
location: './app'
}, {
name: 'dojo',
location: './dojo'
}, {
name: 'dijit',
location: './dijit'
}, {
name: 'dojox',
location: './dojox'
}, {
name: 'dstore',
location: './dstore'
}, {
name: 'dgrid',
location: './dgrid'
}, {
name: 'esri',
location: './esri'
}, {
name: 'dgrid-esri',
location: './dgrid-esri'
}, {
name: 'put-selector',
location: './put-selector'
}, {
name: 'xstyle',
location: './xstyle'
}, {
name: 'ArcGISServerStore',
location: './ArcGISServerStore',
main: 'ArcGISServerStore'
}, {
name: 'TerraArcGIS',
location: './TerraArcGIS',
main: 'TerraArcGIS'
}, {
name: 'proj4',
location: './proj4',
main: 'proj4'
}],
map: {
esri: {
dgrid: 'dgrid-esri'
}
}
}, ['app/App', '/config.js', 'dojo/domReady!'], function (App, config) {
App.run(config);
});
})(); The above is <script data-dojo-config="deps:['app/main']" src='dojo/dojo.js'></script> |
@tmcgee This is working: define(['dojo/_base/window'], function(window){
var path = window.global.location.pathname.replace(/[^\/]+$/, '');
var dojoConfig = window.global.dojoConfig = {
async: true,
packages: [
{
name: 'viewer',
location: path + 'js/viewer'
}, {
name: 'gis',
location: path + 'js/gis'
}, {
name: 'config',
location: path + 'js/config'
}, {
name: 'proj4js',
location: '//cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12'
}
]
};
require(dojoConfig, [
'dojo/_base/declare',
// minimal Base Controller
'viewer/_ControllerBase',
// *** Controller Mixins
// Use the core mixins, add custom mixins
// or replace core mixins with your own
'viewer/_ConfigMixin', // manage the Configuration
'viewer/_LayoutMixin', // build and manage the Page Layout and User Interface
'viewer/_MapMixin', // build and manage the Map
'viewer/_WidgetsMixin' // build and manage the Widgets
//'config/_customMixin'
], function (
declare,
_ControllerBase,
_ConfigMixin,
_LayoutMixin,
_MapMixin,
_WidgetsMixin
//_MyCustomMixin
) {
var controller = new (declare([
_ControllerBase,
_ConfigMixin,
_LayoutMixin,
_MapMixin,
_WidgetsMixin
]))();
controller.startup();
});
//we have to return something
return dojoConfig;
}); @btfou That approach looks good and clean. |
@roemhildtg This seems to be getting more complicated only to please the build system... |
Additional Comments: GoogleMapsLoader.VERSIONThe** version of the Google Maps API should be set to GoogleMapsLoader.KEYWe need to provide a way for a Google Maps Key be passed to the API when it is loaded. Using this new plugin provides the opportunity. If you do not include a KEY, there is a console message of With some modification to the plugin, the version, key and other Google API parameters could be configured within viewer.js or elsewhere using something like this: GoogleMapsLoader = {
VERSION: 3,
KEY: 'MyKey'
} |
@tmcgee I think that the plugin can be configured without modification like this: require(['gis/plugins/Google'], function(GoogleMapsLoader){
GoogleMapsLoader.URL = 'https://maps.googleapis.com/maps/api/js';
GoogleMapsLoader.KEY = null;
GoogleMapsLoader.LIBRARIES = [];
GoogleMapsLoader.CLIENT = null;
GoogleMapsLoader.CHANNEL = null;
GoogleMapsLoader.LANGUAGE = null;
GoogleMapsLoader.REGION = null;
GoogleMapsLoader.VERSION = googleVersion;
GoogleMapsLoader.WINDOW_CALLBACK_NAME = '__google_maps_api_provider_initializator__';
}); Documentation here: https://www.npmjs.com/package/google-maps |
e3c7b4e
to
1e916e6
Compare
Ready for review. Sorry for all the commits, I could try and merge them into one, but I'm not sure exactly how to do so, and I would rather not mess anything up. Rather than changing the whole app.js, I just use the package.js to ignore it. It passes the dojo build so there's no problem there. |
Hi guys, just added a demo: http://roemhildtg.github.io/cmv-app-dojo-builder/dist/ Enjoy! |
@roemhildtg Thanks for this. I should have some time this weekend to check it out. |
@roemhildtg Can you merge the revised develop branch into your branch? @DavidSpriggs Do you have any input on this PR? I haven't tested the dojo build process but the other changes make sense to me. I have pending changes to the StreetView and MapInfo widgets to migrate from spatialreference.org to epsg.io since the former site does not work with HTTPS. |
Github is so awesome. That was too easy. |
FYI if anyone wants to test out the dojo build, I have a repo set up. It would be awesome to hear feedback from someone on their experiences with the process and usage. |
@tmcgee @DavidSpriggs I updated the branch again. Is this good to be merged? |
@roemhildtg I do like this and think it should be merged. I believe @DavidSpriggs wants to discuss it further once he returns from his extended holiday. |
@@ -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' |
There was a problem hiding this comment.
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.
Looking good. Thanks for the work on this! |
Merge the base branch back in and we will do a final merge. |
I wanted to start discussion on the possibility of increasing compatibility with the dojo build system.
This branch includes the necessary changes to perform a successful dojo build on the cmv widgets, core, and config files. Some of the changes are beneficial in general as well and don't necessarily apply directly to a dojo build.
Changes include:
Build system file
Directions widget
float
MapInfo widget and app config
app.js
config file. This is necessary because the dojo builder cannot access files remotely to bundle. In addition, this is a useful addition because it allows for easier upgrade of proj4 in the future (if more than one widget uses proj4) and lets people load proj4 locally without modifying any widgets.Streetview widget