Skip to content

Instantly share code, notes, and snippets.

@mcwhittemore
Last active January 2, 2016 11:09
Show Gist options
  • Save mcwhittemore/8295169 to your computer and use it in GitHub Desktop.
Save mcwhittemore/8295169 to your computer and use it in GitHub Desktop.

Entire - module dependencies

Today @danmactough raised a question about entire_module dependencies vs node_modules dependencies. In general I'm thinking of Entire as extending the node_module system to the browser, but I had kept entire_modules different from node_modules because it is easier to know what should be in the koa stack if its in a folder just for it. Obviously, this is not a good enough reason.

A proposed change

Included in this gist are three files. Two entire_module package.json files, saved in some likely named folder in the node_modules folder and a standard node_module package.json file, defining the dependencies of my first entire app.

Reasons for this change

  • By including the two entire_modules and entire itself into the app's package.json file, we enable the usage of npm for installing entire_modules.
  • By making entire a possible param on a node_module package.json, we give a way to tell what modules are for entire and which ones aren't.
  • By changing dependencies to extending under the entire param of the package.json, we drawn a line between how entire_modules depend on other entire_modules while still keeping the default node.js dependency flow in place.

Reasons againts this change

  • By moving entire_modules dependencies out of dependencies and into extending, we open up the problem of vetting versions and complacate checking for the exhistance of said dependencies.
{
"name": "my-app",
"version": "0.0.0",
"description": "my first entire app",
"main": "app.js",
"dependencies":{
"entire": "https://github.com/EntireJS/entire/archive/v0.1.0.tar.gz",
"feature-one":"0.0.1",
"feature-two":"0.0.1"
}
}
{
"name": "feature-one",
"version": "0.0.1",
"description": "a feature",
"main": "model.js",
"dependencies": {
"uuid": "*"
},
"entire": {
"router": "router.js",
"scripts": "scripts.js",
"styles": "styles.css"
}
}
{
"name": "feature-two",
"version": "0.0.1",
"description": "another feature",
"main": "model.js",
"dependencies": {
"koa-route": "*"
},
"entire": {
"router": "router.js",
"scripts": "scripts.js",
"styles": "styles.css",
"extending": {
"feature-one":"0.0.1"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment