Giter VIP home page Giter VIP logo

hike-js's Introduction

Forums / Blogs / Groups / ...

Build Status

Live demo: https://rcopen.com

Nodeca itself is not expected for wide use. It's intended to replace old RC Design forum software and make programmer's life more comfortable.

But during development we create a lot of useful and popular packages for node.js. See organizations of @puzrin profile. Everything we do is published on github. Enjoy!

hike-js's People

Contributors

cgc avatar ixti avatar rlidwka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hike-js's Issues

Optimize find()

In 2.x find() will cause unnesessary searches when multiple search paths defined.

Doubt about source code

Hi guys, I have a little doubt about your code. Sorry if it is stupid, but I'm a little bit confused:

In file lib /hike/index.js the description of function match says that the purpose of function is check if a path exists in the file system, but in line 108 the function used was isFile.

This function will return true just if the path is a file, but it could be a dir or other thing... I was wondering if a best solution could not be calling fs.existsSync. Or the possibility of be a valid path but not a file is checked in other place?

Thank you in advance for the clarification.

Best Regards

test_environment errors

I don't think the test_environment.js test "should find pathname respecting extension aliases" is testing what it should.

I believe it is looking for

hike/test/fixtures/assets/css/app.styl

but the assets subdirectory is missing. The result of asset = trail.find('app.css') is undefined. This isn't null so the test passes.

assert.ok(null != asset, 'Asset not found');

would have caught this error (though it does not pass lint).

The test could also be:

assert.ok(asset.match(/assets\/css\/app\.styl/));

Check for built-in properties

This is a bit of a weird issue that'll require some explaining. I use grunt-testem-mincer for testing code in a browser. As the name implies, grunt-testem-mincer uses grunt, testem, and mincer and mincer uses this library. I have a test grunt task that runs my tests in node and then in a browser using testem. I discovered that the tests in the browser all fail if I run them like this, but pass correctly if I run only the browser tests. Weird, right? So I used grunt-testem-mincers --debug flag (or maybe it's part of grunt proper . . . not relevant here) to see what files it's trying to serve. It's super handy and leaves the mincer server running so you can try to fetch assets. In my case the file, node_modules/should/should.js was not returning the actual file, but instead the following text:

console.error("pattern.test is not a function")

After grepping my entire codebase (including modules) for pattern.test and digging through them. I've identified the problem. The function match in lib/hike/index.js calls pattern.test on what is supposed to be a regex returned by pattern_for in the same file. pattern_for checks for self.__patterns__[basename] where basename is the name of the file to server. In my failing case, that basename is simply should. This is not a problem when I run the browser-based tests directly. The reason it fails when I run it in conjunction with node-based tests is that I'm requiring should as part of my test setup and because mincer then starts in the same node instance, should is already in the require cache. The side effects of requiring should (forgive me if you know all this . . . I'm just being thorough) is that a should property is added to the Object prototype to make testing easier. So when my list of files to serve gets to should, pattern_for encounters this check:

  if (!self.__patterns__[basename]) {

which in this case is the same as

  if (!self.__patterns__.should) {

and self.__patterns__.should does exist. So then it returns self.__patterns__[basename] or in my case the getter added to Object by should. Which makes the file not serve correctly and all my tests fail.

So I have a couple thoughts. 1) It's pretty well agreed upon that adding methods, properties, etc. to built-in prototypes is bad (obviously this is why). So you'd probably be within your rights to ignore it. However, this would also happen if someone wanted to serve a file called toString.js or constructor.js or anything that's already built-in. So it could cause issues even without should's inclusion. 2) There are ways for me to work around it (like removing should after my tests complete or copying the should.js script to another name), but it seems like it shouldn't be that hard to address, as you could just expand your current check to something like:

  if (!self.__patterns__[basename] || !(self.__patterns__[basename] instanceof RegExp)) {

Or however you prefer to check that it it's not a regex (lodash, for instance). It's a little more than this I guess because you'd also need to be sure not to overwrite the existing property, so if self.__patterns__[basename] existed but wasn't a regex, maybe you need to preface it with, like __ or something. I don't know. That's getting into the weeds of your project a bit, and I don't know nearly enough about it to postulate.

hike 0.1.3 not published on npm

Hi there. I was attempting to install mincer for development and noticed that hike wasn't being installed as a dependency. After looking at the version mincer requests and at the latest version of hike that's been published to npm, I noticed mincer requests 0.1.3 which according to this repo does indeed exist, but is not published on the npm registry.

From npm show

  'dist-tags': { latest: '0.1.2' },
  versions: [ '0.1.0', '0.1.1', '0.1.2' ],

Maybe this is related to some of the recent issues npm had with publishing packages and needs a new push?

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.