MCPcopy
hub / github.com/meteor/meteor / isValidCommand

Function isValidCommand

tools/cli/dev-bundle-bin-helpers.js:39–63  ·  view source on GitHub ↗
(name, devBundleDir)

Source from the content-addressed store, hash-verified

37};
38
39function isValidCommand(name, devBundleDir) {
40 if (name === "node" ||
41 name === "npm" ||
42 name === "npx") {
43 return true;
44 }
45
46 if (! name || name.charAt(0) === ".") {
47 // Disallow empty commands and commands that start with a period.
48 return false;
49 }
50
51 var meteorCommandsJsonPath =
52 path.join(devBundleDir, "bin", ".meteor-commands.json");
53
54 try {
55 var meteorCommands = require(meteorCommandsJsonPath);
56 } catch (e) {
57 return false;
58 }
59
60 // If `meteor <name>` is already a Meteor command, don't let anything in
61 // dev_bundle/bin override it.
62 return ! hasOwn.call(meteorCommands, name);
63}
64
65exports.getEnv = function (options) {
66 var devBundle = options && options.devBundle;

Callers 1

Calls 1

callMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…