Skip to content
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

Use node ecosystem #20

Closed
tracker1 opened this issue Oct 22, 2014 · 6 comments
Closed

Use node ecosystem #20

tracker1 opened this issue Oct 22, 2014 · 6 comments

Comments

@tracker1
Copy link

Since you are already publishing to Bower, which requires node, I would suggest the following adjustments.

  • Expose your shim as a module.
  • Replace your shell script test runner with an environment that can run from within node
    • Suggest switching from qunit to mocha
    • Have a setup and teardown script to run your server for integration tests
  • For node users, have an implementation that exposes the API, but uses node's http, or a simple wrapper around request
  • Replace Makefile with npm tasks that run from package.json (example below)

Example package.json for scripts

{
  "private": true,
  "name": "fetch-client",
  "version": "0.2.1",
  "main": "./fetch.js"
  "scripts": {
    "post-install": "bower install"
    "browser-tests": "./test/run.sh",
    "lint": "jshint *.js test/*.js",
    "clean": "rimraf ./bower_components ./node_modules"
    "build": "npm run clean && npm install",
    "test": "npm run lint && npm run browser-tests"
  },
  "devDependencies": {
    "bower": "1.3.8",
    "jshint": "2.5.2",
    "node-qunit-phantomjs": "0.2.2",
    "rimraf": "*"
  }
}

npm install
will follow up with bower install (npm will resolve the execution path from node_modules)

npm test
will run linting and your existing test script

npm run build
will clean and re-install

I added the rimraf to remove the dependency.

Note, if you're open to pull requests, I'd be happy to do the initial changes to remove the dependencies on tools outside of node (namely the makefile, and shell script)

@josh
Copy link
Contributor

josh commented Oct 22, 2014

I get that node users prefer this flow, but what would be the benefit?

FWIW, browserify already works since its just a polyfill, not a module with any exported symbols.

@josh
Copy link
Contributor

josh commented Oct 22, 2014

If anything, going in the opposite direction would be preferred to me.

We can remove the bower install dependency from the dev chain and just use curl to fetch down the polyfill scripts we're depending on. Or just check them in.

@josh
Copy link
Contributor

josh commented Oct 22, 2014

How does the test tooling this repo uses affect you're actual application integration of the polyfill?

@josh
Copy link
Contributor

josh commented Oct 22, 2014

Replace your shell script test runner with an environment that can run from within node

Maybe you're confused, this polyfill is for running in browser environments, not node. Which is why we want to test in PhantomJS.

@tracker1
Copy link
Author

@josh

Honestly, my suggestions were mainly out of the fact that this is a JS project, that already needs node (for bower, phantom-js, your test environment, etc) and could, via some minor adjustments use that same environment without any need for additional tooling, and work cross platform. Windows and OSX don't have make and windows doesn't have bash without additional software... with minor adjustments you could remove those dependencies in favor of a node (already required) solution.

I'm now using browserify with most of my logic being the same for server (node) and client (browser) rendering, so tools that support both modes of operation and are published in npm are (imho) better than those that aren't. It also is a trend that is seeing a lot of growth.

@dgraham
Copy link
Contributor

dgraham commented Oct 23, 2014

I'm going to close this out since it's working well so far. I appreciate the suggestion to use more node ecosystem tools, but we can rely on make being available. The development flow is pretty simple right now.

@dgraham dgraham closed this as completed Oct 23, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants