Code Monkey home page Code Monkey logo

file-resolver's Issues

Assertion Error on Windows.

Assertion Error on Windows

Getting AssertionError on Windows due to the backslashes in the Windows environment. Need to normalize the URL.

Work-around: Don't use windows :) (Still looking for another work-around)

    AssertionError: Provided start directory is not within root or one of its subdirectories.

I added the following logs to the file:

/node_modules/bundalo/node_modules/file-resolver/lib/util.js
exports.locate = function locate(name, root, start) {
    var removed, file, parent;

console.log("------------");
console.log("start:");
console.log(start);
console.log("------------");
console.log("root:");
console.log(root);
console.log("------------");
    assert(~start.indexOf(root), 'Provided start directory is not within root or one of its subdirectories.');

Output of the above logs:

------------
start:
locales\US\en
------------
root:
locales/
------------

Replicated with the Test Suite:

# resolve with a bogus locale object

assert.js:86
  throw new assert.AssertionError({
        ^
AssertionError: Provided start directory is not within root or one of its subdir
ectories.
    at Object.locate (Z:\Projects\file-resolver\lib\util.js:64:5)
    at Object.proto._locate (Z:\Projects\file-resolver\index.js:33:24)
    at Object.proto.resolve (Z:\Projects\file-resolver\index.js:51:26)
    at Test.<anonymous> (Z:\Projects\file-resolver\test\index.js:116:28)
    at Test.bound [as _cb] (Z:\Projects\file-resolver\node_modules\tape\lib\test
.js:62:32)
    at Test.run (Z:\Projects\file-resolver\node_modules\tape\lib\test.js:75:10)
    at Test.bound [as run] (Z:\Projects\file-resolver\node_modules\tape\lib\test
.js:62:32)
    at Test._end (Z:\Projects\file-resolver\node_modules\tape\lib\test.js:141:11
)
    at Test.bound [as _end] (Z:\Projects\file-resolver\node_modules\tape\lib\tes
t.js:62:32)
    at Test.<anonymous> (Z:\Projects\file-resolver\node_modules\tape\lib\test.js
:140:40)
npm ERR! Test failed.  See above for more details.```

_locate *could* validate locale object

https://github.com/krakenjs/file-resolver/blob/master/index.js#L32

If something is wrong with the locale object, for example it is an empty object {} then _locate will pass non-string arguments to path.join resulting in:

TypeError: Arguments to path.join must be strings
   at path.js:360:15
   at Array.filter (native)
   at Object.exports.join (path.js:358:36)
   at Object.proto._locate (/Users/medelman/src/krakex/kraken-examples/with.i18n/node_modules/engine-munger/node_modules/file-resolver/index.js:32:29)

Not sure if this would be considered over-protective of the module or not...

Bump graceful-fs dependency

graceful-fs versions lower than v4 reevaluate native fs module source, which is not supported.
You should update your graceful-fs dependency to v4 or later.

Tracking issue: nodejs/node#5213.

Problem resolving the 'root' property for templates' path.

Hi team. I'm using Windows 7 64 bits, and I tried to run the latest version of the Kraken's examples (i.e., i18n, Shopping Cart, and others for Kraken v1.0.1) using production mode (NODE_ENV=production), but the server always threw an 'Internal Server Error', because the compiled templates couldn't be found (.build/templates/**/*.js files).

I debugged the source code, and found a problem with the 'util.js' file (line 67). This file is used by engine-munger to resolve the templates' path, but didn't consider the OS dependency when working with slashes and backslashes (it fails on Windows platform).

The old line is: root : file.replace(name, ''),
A possible solution is: root : file.replace(path.normalize(name), ''),

Using this approach the file.replace operation works as expected.

Thanks team for the great work with KrakenJS! I enjoy it :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.