Skip to content

Commit 8f9eba3

Browse files
author
Taylor McIntyre
committed
remove cliDependencies installation
1 parent 642fdea commit 8f9eba3

File tree

4 files changed

+2
-56
lines changed

4 files changed

+2
-56
lines changed

cli/pbjs.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ var path = require("path"),
44
pkg = require("./package.json"),
55
util = require("./util");
66

7-
util.setup();
8-
97
var protobuf = require(util.pathToProtobufJs),
108
minimist = require("minimist"),
119
chalk = require("chalk"),

cli/pbts.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
var child_process = require("child_process"),
33
path = require("path"),
44
fs = require("fs"),
5-
pkg = require("./package.json"),
6-
util = require("./util");
7-
8-
util.setup();
5+
pkg = require("./package.json");
96

107
var minimist = require("minimist"),
118
chalk = require("chalk"),

cli/util.js

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"use strict";
22
var fs = require("fs"),
3-
path = require("path"),
4-
child_process = require("child_process");
5-
6-
var semver;
3+
path = require("path");
74

85
try {
96
// installed as a peer dependency
@@ -113,49 +110,6 @@ exports.inspect = function inspect(object, indent) {
113110
return sb.join("\n");
114111
};
115112

116-
function modExists(name, version) {
117-
for (var i = 0; i < module.paths.length; ++i) {
118-
try {
119-
var pkg = JSON.parse(fs.readFileSync(path.join(module.paths[i], name, "package.json")));
120-
return semver
121-
? semver.satisfies(pkg.version, version)
122-
: parseInt(pkg.version, 10) === parseInt(version.replace(/^[\^~]/, ""), 10); // used for semver only
123-
} catch (e) {/**/}
124-
}
125-
return false;
126-
}
127-
128-
function modInstall(install) {
129-
child_process.execSync("npm --silent install " + (typeof install === "string" ? install : install.join(" ")), {
130-
cwd: __dirname,
131-
stdio: "ignore"
132-
});
133-
}
134-
135-
exports.setup = function() {
136-
var pkg = require(path.join(__dirname, "..", "package.json"));
137-
var version = pkg.dependencies["semver"] || pkg.devDependencies["semver"];
138-
if (!modExists("semver", version)) {
139-
process.stderr.write("installing semver@" + version + "\n");
140-
modInstall("semver@" + version);
141-
}
142-
semver = require("semver"); // used from now on for version comparison
143-
var install = [];
144-
pkg.cliDependencies.forEach(function(name) {
145-
if (name === "semver")
146-
return;
147-
version = pkg.dependencies[name] || pkg.devDependencies[name];
148-
if (!modExists(name, version)) {
149-
process.stderr.write("installing " + name + "@" + version + "\n");
150-
install.push(name + "@" + version);
151-
}
152-
});
153-
require("../scripts/postinstall"); // emit postinstall warning, if any
154-
if (!install.length)
155-
return;
156-
modInstall(install);
157-
};
158-
159113
exports.wrap = function(OUTPUT, options) {
160114
var name = options.wrap || "default";
161115
var wrap;

scripts/postinstall.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ var path = require("path"),
44
fs = require("fs"),
55
pkg = require(path.join(__dirname, "..", "package.json"));
66

7-
// ensure that there is a node_modules folder for cli dependencies
8-
try { fs.mkdirSync(path.join(__dirname, "..", "cli", "node_modules")); } catch (e) {/**/}
9-
107
// check version scheme used by dependents
118
if (!pkg.versionScheme)
129
return;

0 commit comments

Comments
 (0)