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

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
njgheorghita committed Oct 30, 2020
1 parent 4b1b100 commit de6f7a2
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 344 deletions.
1 change: 0 additions & 1 deletion packages/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const pkg = require("./package.json");
module.exports = {
build: require("./lib/build"),
create: require("./lib/commands/create/helpers"),
console: require("./lib/repl"),
// TODO: update this to non-legacy the next breaking change
contracts: require("@truffle/workflow-compile/legacy"),
test: require("./lib/testing/Test"),
Expand Down
12 changes: 6 additions & 6 deletions packages/core/lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const command = {
description: "Install a package from the Ethereum Package Registry",
builder: {},
help: {
usage: "truffle install <package-identifier> [--alias]",
usage: "truffle install <packageIdentifier> [--alias]",
options: [
{
option: "packageIdentifier",
description: `(required) Name of the package as listed in the Ethereum Package Registry. Accepted formats: packageName, packageName@version, ethpm URI, ipfs URI.`
description: `Name of the package as listed in the Ethereum Package Registry. Accepted formats: packageName, packageName@version, ethpm URI, ipfs URI. (required)`
},
{
option: "--alias",
Expand Down Expand Up @@ -39,16 +39,16 @@ const command = {
options.packageIdentifier = options._[0];

const config = Config.detect(options);
let callbackFunction;
let installPackage;

if (config.ethpm.version == "1") {
callbackFunction = callbackify(PackageV1.install);
installPackage = callbackify(PackageV1.install);
} else if (config.ethpm.version == "3") {
callbackFunction = callbackify(PackageV3.install);
installPackage = callbackify(PackageV3.install);
} else {
done(new Error(`Unsupported ethpm version: ${config.ethpm.version}.`));
}
callbackFunction(config, done);
installPackage(config, done);
}
};

Expand Down
18 changes: 9 additions & 9 deletions packages/core/lib/commands/packages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { callbackify } = require("util");

var command = {
const command = {
command: "packages",
description: "List available packages on connected EthPM Registry",
builder: {},
Expand All @@ -9,21 +9,21 @@ var command = {
options: []
},
run: function (options, done) {
var Config = require("@truffle/config");
var PackageV1 = require("@truffle/ethpm-v1");
var PackageV3 = require("@truffle/ethpm-v3");
const Config = require("@truffle/config");
const PackageV1 = require("@truffle/ethpm-v1");
const PackageV3 = require("@truffle/ethpm-v3");

var config = Config.detect(options);
let callbackFunction;
const config = Config.detect(options);
let listPackages;

if (config.ethpm.version == "1") {
callbackFunction = callbackify(PackageV1.packages);
listPackages = callbackify(PackageV1.packages);
} else if (config.ethpm.version == "3") {
callbackFunction = callbackify(PackageV3.packages);
listPackages = callbackify(PackageV3.packages);
} else {
done(new Error(`Unsupported ethpm version: ${config.ethpm.version}.`));
}
callbackFunction(config, done);
listPackages(config, done);
}
};

Expand Down
18 changes: 9 additions & 9 deletions packages/core/lib/commands/publish.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { callbackify } = require("util");

var command = {
const command = {
command: "publish",
description: "Publish a package to the Ethereum Package Registry",
builder: {},
Expand All @@ -9,21 +9,21 @@ var command = {
options: []
},
run: function (options, done) {
var Config = require("@truffle/config");
var PackageV1 = require("@truffle/ethpm-v1");
var PackageV3 = require("@truffle/ethpm-v3");
const Config = require("@truffle/config");
const PackageV1 = require("@truffle/ethpm-v1");
const PackageV3 = require("@truffle/ethpm-v3");

var config = Config.detect(options);
let callbackFunction;
const config = Config.detect(options);
let publishPackage;

if (config.ethpm.version == "1") {
callbackFunction = callbackify(PackageV1.publish);
publishPackage = callbackify(PackageV1.publish);
} else if (config.ethpm.version == "3") {
callbackFunction = callbackify(PackageV3.publish);
publishPackage = callbackify(PackageV3.publish);
} else {
done(new Error(`Unsupported ethpm version: ${config.ethpm.version}.`));
}
callbackFunction(config, done);
publishPackage(config, done);
}
};

Expand Down
Loading

0 comments on commit de6f7a2

Please sign in to comment.