Dojo build via Node fails with non-standard util folder path

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Dojo build via Node fails with non-standard util folder path

sindilevich
Hello,

Dojo 1.12.1.

Dojo build via Node fails with non-standard util folder path. It can happen, when using npm to manage project's dependencies. With npm you would install dojo/util as npm install dojo-util, which places the util at the node_modules/dojo-util folder.

Building Dojo with Node in such a case, results in an error: Error: ENOENT: no such file or directory, open '/Users/XYZ/Projects/dojo-boilerplate/node_modules/util/build/main.js'.

I can fix the build, by manually editing dojo/dojo.js@L2012-2018, replacing the build and doh package configurations with:

{
        name:'build',
        location:'../dojo-util/build'
},{
        name:'doh',
        location:'../dojo-util/doh'
}


I'd prefer a configuration-based way to re-route the util folder to a non-standard location.

Your help is much appreciated!
Reply | Threaded
Open this post in threaded view
|

Re: Dojo build via Node fails with non-standard util folder path

dylanks
The challenge we've had that has led to this is that npm does not allow
name aliasing, so unless you're the first package with a name, you
cannot be that package.

npm does support scoped packages, e.g. @dojo/package , but this doesn't
work with bower. So for util, themes, and dstore, we're left with dojo-*.

The configuration based way to reroute is to set the package
configuration using a configuration files rather than modifying dojo.js

You may specify a package configuration both within the loading of your
app, as well as within your build profile, under the packages setting.

Regards,
-Dylan

on 2/11/17, 16:04 (GMT-07:00) sindilevich said the following:

> Hello,
>
> Dojo 1.12.1.
>
> Dojo build via Node fails with non-standard *util* folder path. It can
> happen, when using *npm* to manage project's dependencies. With npm you
> would install *dojo/util* as /npm install dojo-util/, which places the util
> at the *node_modules/dojo-util* folder.
>
> Building Dojo with Node in such a case, results in an error: *Error: ENOENT:
> no such file or directory, open
> '/Users/XYZ/Projects/dojo-boilerplate/node_modules/util/build/main.js'*.
>
> I can fix the build, by manually editing *dojo/dojo.js@L2012-2018*,
> replacing the /build/ and /doh/ package configurations with:
> *
> {
> name:'build',
> location:'../dojo-util/build'
> },{
> name:'doh',
> location:'../dojo-util/doh'
> }
> *
>
> I'd prefer a configuration-based way to re-route the util folder to a
> non-standard location.
>
> Your help is much appreciated!
>
>
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dojo-build-via-Node-fails-with-non-standard-util-folder-path-tp4007131.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|

Re: Dojo build via Node fails with non-standard util folder path

sindilevich
This post was updated on .
I got finally back to try build Dojo, when pulling the sources from npm.

I am using this repository as a starting point for the POC. Only updated some files as described below.

build.sh
@@ -9,7 +9,7 @@ BASEDIR=$(cd $(dirname $0) && pwd)
SRCDIR="$BASEDIR/src"

# Directory containing dojo build utilities
-TOOLSDIR="$SRCDIR/util/buildscripts"
+TOOLSDIR="$BASEDIR/node_modules/dojo-util/buildscripts"

# Destination directory for built code
DISTDIR="$BASEDIR/dist"


package.json
@@ -1,14 +1,25 @@
{
        "name": "dojo-boilerplate",
- "version": "1.12.1",
+ "version": "1.12.2",
        "description": "Dojo Boilerplate. A basic starting point for writing apps with Dojo.",
        "license": "BSD-3-Clause",
        "repository": {
                "type": "git",
                "url": "https://github.com/sindilevich/dojo-boilerplate.git"
        },
+ "dependencies": {
+ "dgrid": "^1.1.0",
+ "dijit": "^1.12.2",
+ "dojo": "^1.12.2",
+ "dojo-dstore": "^1.1.1",
+ "dojox": "^1.12.2",
+ "put-selector": "^0.3.6",
+ "xstyle": "git+https://github.com/kriszyp/xstyle.git"
+ },
        "devDependencies": {
+ "dojo-util": "^1.12.2",
                "intern": "^3.4.2",
+ "live-server": "^1.2.0",
                "stylus": "^0.54.5"
        },
        "bugs": "https://github.com/sindilevich/dojo-boilerplate/issues",


profiles/app.profile.js
@@ -45,12 +45,14 @@ var profile = {
        packages: [
                // Using a string as a package is shorthand for `{ name: 'app', location: 'app' }`
                'app',
- 'dgrid',
- 'dijit',
- 'dojo',
- 'dojox',
- 'put-selector',
- 'xstyle'
+ { name: 'dgrid', location: '../node_modules/dgrid' },
+ { name: 'dijit', location: '../node_modules/dijit' },
+ { name: 'dojo', location: '../node_modules/dojo' },
+ { name: 'dojox', location: '../node_modules/dojox' },
+ { name: 'put-selector', location: '../node_modules/put-selector' },
+ { name: 'build', location: '../node_modules/dojo-util/build' },
+ { name: 'doh', location: '../node_modules/dojo-util/doh' },
+ { name: 'xstyle', location: '../node_modules/xstyle' }
        ],

        // Strips all calls to console functions within the code. You can also set this to "warn" to strip everything


As you can see, I am trying to override the default folder layout by configuring my build profile to look into npm-specific folders for the utils: { name: 'build', location: '../node_modules/dojo-util/build' }, { name: 'doh', location: '../node_modules/dojo-util/doh' }

Yet it still would yield the Error: ENOENT: no such file or directory, open '/Users/XYZ/Projects/dojo-boilerplate/node_modules/util/build/main.js' error, when I run ./build.sh in the terminal.

I apparently doing something wrong. Hope you could pinpoint the change I need to do in the build profile file to make dojo build succeed with a non-standard folder layout.

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Dojo build via Node fails with non-standard util folder path

dylanks
Based on your error, something is looking for util rather than dojo-util
(which npm forces us to use because they don't believe in package aliasing).

So my guess is that boilerplate somewhere expects the package to be
called util and something may be hardcoded in there?

With a very quick look, I'm guessing this line is the problem:

https://github.com/csnover/dojo-boilerplate/blob/adfcdd483c69bd6f03ba4559c2e4c51cf4420d48/build.sh#L12

Regards,
-Dylan

on 3/7/17, 14:18 (GMT-07:00) sindilevich said the following:

> I got finally back to try build Dojo, when pulling the sources from npm.
>
> I am using  this repository
> <https://github.com/sindilevich/dojo-boilerplate>   as a starting point for
> the POC. Only updated some files as described below.
>
> /build.sh/
> *@@ -9,7 +9,7 @@ BASEDIR=$(cd $(dirname $0) && pwd)
> SRCDIR="$BASEDIR/src"
>
> # Directory containing dojo build utilities
> TOOLSDIR="$SRCDIR/util/buildscripts"
> TOOLSDIR="$BASEDIR/node_modules/dojo-util/buildscripts"
>
> # Destination directory for built code
> DISTDIR="$BASEDIR/dist"*
>
> /package.json/
> *@@ -1,14 +1,25 @@
> {
> "name": "dojo-boilerplate",
> "version": "1.12.1",
> "version": "1.12.2",
> "description": "Dojo Boilerplate. A basic starting point for writing apps
> with Dojo.",
> "license": "BSD-3-Clause",
> "repository": {
> "type": "git",
> "url": "https://github.com/sindilevich/dojo-boilerplate.git"
> },
> "dependencies": {
> "dgrid": "^1.1.0",
> "dijit": "^1.12.2",
> "dojo": "^1.12.2",
> "dojo-dstore": "^1.1.1",
> "dojox": "^1.12.2",
> "put-selector": "^0.3.6",
> "xstyle": "git+https://github.com/kriszyp/xstyle.git"
> },
> "devDependencies": {
> "dojo-util": "^1.12.2",
> "intern": "^3.4.2",
> "live-server": "^1.2.0",
> "stylus": "^0.54.5"
> },
> "bugs": "https://github.com/sindilevich/dojo-boilerplate/issues",*
>
> /profiles/app.profile.js/
> *@@ -45,12 +45,14 @@ var profile = {
> packages: [
> // Using a string as a package is shorthand for `{ name: 'app', location:
> 'app' }`
> 'app',
> 'dgrid',
> 'dijit',
> 'dojo',
> 'dojox',
> 'put-selector',
> 'xstyle'
> { name: 'dgrid', location: '../node_modules/dgrid' },
> { name: 'dijit', location: '../node_modules/dijit' },
> { name: 'dojo', location: '../node_modules/dojo' },
> { name: 'dojox', location: '../node_modules/dojox' },
> { name: 'put-selector', location: '../node_modules/put-selector' },
> { name: 'build', location: '../node_modules/dojo-util/build' },
> { name: 'doh', location: '../node_modules/dojo-util/doh' },
> { name: 'xstyle', location: '../node_modules/xstyle' }
> ],
>
> // Strips all calls to console functions within the code. You can also set
> this to "warn" to strip everything*
>
> As you can see, I am trying to override the default folder layout by
> configuring my build profile to look into npm-specific folders for the
> /utils/: *{ name: 'build', location: '../node_modules/dojo-util/build' }, {
> name: 'doh', location: '../node_modules/dojo-util/doh' }*
>
> Yet it still would yield the *Error: ENOENT: no such file or directory, open
> '/Users/XYZ/Projects/dojo-boilerplate/node_modules/util/build/main.js'*
> error, when I run /./build.sh/ in the terminal.
>
> I apparently doing something wrong. Hope you could pinpoint the change I
> need to do in the build profile file to make dojo build succeed with a
> non-standard folder layout.
>
> Thank you!
>
>
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dojo-build-via-Node-fails-with-non-standard-util-folder-path-tp4007131p4007166.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|

Re: Dojo build via Node fails with non-standard util folder path

sindilevich
Dylan,

Thank you for your super-quick reply.

I adjusted build.sh already (see my previous message) and it has been TOOLSDIR="$BASEDIR/node_modules/dojo-util/buildscripts" already, when I ran the Dojo build and got the error.

However, tweaking dojo/dojo.js@L2012-2018 does solve the problem, as I mentioned in my first message to the thread.

It seems like dojo/dojo.js@L2012-2018 override my packages configuration in profiles/app.profile.js.
Reply | Threaded
Open this post in threaded view
|

Re: Dojo build via Node fails with non-standard util folder path

sindilevich
An excerpt from profiles/app.profile.js where I try configuring the packages:

        packages: [
                // Using a string as a package is shorthand for `{ name: 'app', location: 'app' }`
                'app',
                { name: 'dgrid', location: '../node_modules/dgrid' },
                { name: 'dijit', location: '../node_modules/dijit' },
                { name: 'dojo', location: '../node_modules/dojo' },
                { name: 'dojox', location: '../node_modules/dojox' },
                { name: 'put-selector', location: '../node_modules/put-selector' },
                { name: 'build', location: '../node_modules/dojo-util/build' },
                { name: 'doh', location: '../node_modules/dojo-util/doh' },
                { name: 'xstyle', location: '../node_modules/xstyle' }
        ],