Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
ignore optionalDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Dec 17, 2015
1 parent 0815894 commit f02fb0a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/node-conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var nodeCoreModules = {
'crypto': 'npm:crypto-browserify@^3.11.0', // (fork required)
'dgram': 'nodelibs/dgram',
'dns': 'nodelibs/dns',
'domain': 'npm:domain-browser@^1.1.4', // https://github.com/bevry/domain-browser/pull/7
'domain': 'npm:domain-browser@^1.1.5',
'events': 'npm:events@^1.1.0', // (fork required)
'fs': 'nodelibs/fs',
'http': 'npm:stream-http@^2.0.2', // https://github.com/jhiesey/stream-http/pull/31
Expand All @@ -28,7 +28,7 @@ var nodeCoreModules = {
'os': 'npm:os-browserify@^0.2.0',
'path': 'npm:path-browserify@^0.0.0', // https://github.com/substack/path-browserify/pull/7
'process': 'nodelibs/process',
'punycode': 'npm:punycode@^1.3.2', // pending 1.3.3 release
'punycode': 'npm:punycode@^1.4.0',
'querystring': 'npm:querystring@^0.2.0', // https://github.com/Gozala/querystring/pull/13
'readline': 'nodelibs/readline',
'repl': 'nodelibs/repl',
Expand Down Expand Up @@ -224,16 +224,15 @@ exports.convertPackage = function(packageConfig, packageName, packageDir, ui) {
*
* Currently we cater to (1) by creating a directory map for any index.js file present
* in a directory where the directory.js file does not exist.
* We then cater to (2 - 4) above by parsing all CommonJS requires of all JS files in
* the package and where a resolution matches one of these cases, we include meta: true
* We then cater to (2 - 5) above by parsing all CommonJS requires of all JS files in
* the package and where a resolution matches one of these cases, we include map or meta
* config for these files.
*
* We only cater to these assumptions for CommonJS modules
* We cater to these assumptions for CommonJS modules only
*
* It may turn out to be useful to do (2 - 4) for external requires as well, in which
* It may turn out to be useful to do (2 - 5) for external requires as well, in which
* case we can switch this algorithm to a comprehensive correction configuration
* being constructed against the entire fileTree to handle all resolution differences.
*
* Even better may turn out to have a post-install hook phase, which can actually investigate
* the contents of dependencies to do a similar analysis above to avoid config bloat
*/
Expand Down
7 changes: 7 additions & 0 deletions lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ NPMLocation.prototype = {

packageConfig.dependencies = parseDependencies(packageConfig.dependencies, this.ui);
packageConfig.peerDependencies = parseDependencies(packageConfig.peerDependencies, this.ui);
packageConfig.optionalDependencies = parseDependencies(packageConfig.optionalDependencies, this.ui);

// remove optionalDependencies from dependencies, which are merged into dependencies by the npm registry
if (packageConfig.optionalDependencies)
Object.keys(packageConfig.optionalDependencies).forEach(function(d) {
delete packageConfig.dependencies[d];
});

// ignore directory flattening for NodeJS, as npm doesn't do it
// we do allow if there was an override through the jspm property though
Expand Down

0 comments on commit f02fb0a

Please sign in to comment.