bromote icon indicating copy to clipboard operation
bromote copied to clipboard

bromote with gmaps

Open newtonianb opened this issue 10 years ago • 12 comments

I am a bit confused in trying to get this working. There was a similar issue I looked at but I still couldn't understand/get this working referencing it and would very much appreciate some help.

reference project: I am also using the gulp-starter project with this browserify configuration: https://github.com/greypants/gulp-starter/blob/master/gulp/tasks/browserify.js

reference bromote integration To integrate bromote into this I looked at this reference: http://stackoverflow.com/questions/24414614/browserify-factor-bundle-dependency-ids

my gist And tried to integrate it with the gulp-starter configuration and came up with this gist: https://gist.github.com/newtonianb/18f8bcd23ee9762324c6

This gist compiles fine but then I don't know how to make use of this. I tried in my source javascripts file to run the following but my require('bromote') is failling.

var bromote = require('bromote');
bromote.google_maps(funciton(g) {

});

I get the following error

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Cannot find module node_moduleromotelibexport-remote.js' from 'node_modules\bromote\loaders'
  at node_modules\browserify\node_modules\resolve\lib\async.js:50:17
  at process (node_modules\browserify\node_modules\resolve\lib\async.js:119:43)
  at node_modules\browserify\node_modules\resolve\lib\async.js:128:21
  at load (node_modules\browserify\node_modules\resolve\lib\async.js:60:43)
  at node_modules\browserify\node_modules\resolve\lib\async.js:66:22
  at node_modules\browserify\node_modules\resolve\lib\async.js:21:47
  at Object.oncomplete (fs.js:107:15)

reference: https://github.com/thlorenz/bromote/issues/7

newtonianb avatar Sep 22 '14 23:09 newtonianb

@toddself should know more here since he was dealing with gmaps.

thlorenz avatar Nov 11 '14 16:11 thlorenz

Sorry I've been super busy with work recently, let me take a look at this @newtonianb . Thanks for the heads up @thlorenz.

toddself avatar Nov 17 '14 13:11 toddself

This is a troubling line:

Error: Cannot find module node_moduleromotelibexport-remote.js

Being that should read

node_modules/bromote/lib/export-report.js

Do you have some odd escaping on?

toddself avatar Nov 17 '14 13:11 toddself

I think this is an issue with the handlebars templating. I have a fix in a project I'm using it for. @thlorenz is ok to fork/pr?

wtvamp avatar Aug 06 '15 18:08 wtvamp

Would love to see it

On Aug 6, 2015, at 11:43, wtvamp [email protected] wrote:

I think this is an issue with the handlebars templating. I have a fix in a project I'm using it for. @thlorenz is ok to fork/pr?

— Reply to this email directly or view it on GitHub.

toddself avatar Aug 06 '15 18:08 toddself

@wtvamp of course we like PRs with fixes :) @toddself if you got some time could you take care of merging this into master once it's done? I'll publish a patch once it's in.

thlorenz avatar Aug 06 '15 18:08 thlorenz

Gladly

On Aug 6, 2015, at 11:56, Thorsten Lorenz [email protected] wrote:

@wtvamp of course we like PRs with fixes :) @toddself if you got some time could you take care of merging this into master once it's done? I'll publish a patch once it's in.

— Reply to this email directly or view it on GitHub.

toddself avatar Aug 06 '15 18:08 toddself

https://github.com/thlorenz/bromote/pull/10

wtvamp avatar Aug 06 '15 19:08 wtvamp

I'm curious - do you use windows for dev normally? The issue does not repro in my osx environment, but does in my windows environment.

wtvamp avatar Aug 06 '15 23:08 wtvamp

I don't, and I dont't Thorsten does anymore. Let me open my windows VM and give this a shot.

What version of node & windows are you using? Can you provide a test case that replicates the issue unfixed?

On Aug 6, 2015, at 4:06 PM, wtvamp [email protected] wrote:

I'm curious - do you use windows for dev normally? The issue does not repro in my osx environment, but does in my windows environment.

— Reply to this email directly or view it on GitHub https://github.com/thlorenz/bromote/issues/8#issuecomment-128535753.

toddself avatar Aug 06 '15 23:08 toddself

I'm thinking you would see this bug on any windows - I'm using windows 10. The issue seems to be centered around gen-remote.js outputting the loader file to loaders/.js.

In OSX, it looks like:

'use strict';

module.exports = function (cb) { require('/Users/warrenthompson/Sites/bromote/lib/export-remote.js')({ url : ' https://maps.googleapis.com/maps/api/js?key=AIzaSyA3WHUVQvWNydFRagaOiQNVxulLTFtvJOY&sensor=false ',

exports :  'google_maps'

}, cb); };

In Windows, it looks like:

'use strict';

module.exports = function (cb) {

require('C:\Users\warrenthompson\Source\Repos\sn-template\Web\node_modules\b romote\lib\export-remote.js')({ url : ' https://maps.googleapis.com/maps/api/js?key=AIzaSyA3WHUVQvWNydFRagaOiQNVxulLTFtvJOY&sensor=false ',

exports :  'google_maps'

}, cb);

}; So, in windows in the handlebars template puts that out as:

C:UserswarrenthompsonSourceRepossn-templateWebode_modulesromotelib export-remote.js

Notice the \n and \b treated as special characters. My fix is just proposing using a regex to escape the slashes in that string, and then it seems to work for me in windows.

As far as testing, I started writing it but then running it I realized the escape backslash test does the same thing, so that test would suffice.

On Thu, Aug 6, 2015 at 4:14 PM, Todd Kennedy [email protected] wrote:

I don't, and I dont't Thorsten does anymore. Let me open my windows VM and give this a shot.

What version of node & windows are you using? Can you provide a test case that replicates the issue unfixed?

On Aug 6, 2015, at 4:06 PM, wtvamp [email protected] wrote:

I'm curious - do you use windows for dev normally? The issue does not repro in my osx environment, but does in my windows environment.

— Reply to this email directly or view it on GitHub < https://github.com/thlorenz/bromote/issues/8#issuecomment-128535753>.

— Reply to this email directly or view it on GitHub https://github.com/thlorenz/bromote/issues/8#issuecomment-128536755.

Warren Thompson Founder Thompson Web, Inc. (503)383-9489 http://www.thompsonwebinc.com

wtvamp avatar Aug 06 '15 23:08 wtvamp

Nice observation guys and definitely now that you mention it it seems like a windows path bug. You would not believe how many npm libraries all have this kind of bug in their code, I've been submitting issues left and right and the fix is always the same really

path.join path.resolve

newtonianb avatar Aug 07 '15 00:08 newtonianb