-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add --url option to the truffle migrate
command
#5739
base: develop
Are you sure you want to change the base?
Changes from 2 commits
7031277
89ae0bc
a386352
afbeb9c
8811d74
d00ba47
d9293fe
9aee86c
b53f4e7
1271865
4c94755
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,10 @@ module.exports = { | |
type: "boolean", | ||
default: true, | ||
hidden: true | ||
}, | ||
"url": { | ||
describe: "Use specified URL for provider", | ||
type: "string" | ||
} | ||
}, | ||
help: { | ||
|
@@ -62,7 +66,7 @@ module.exports = { | |
" " + // spacing to align with previous line | ||
"[--compile-all] [--compile-none] [--verbose-rpc] [--interactive]\n" + | ||
" " + // spacing to align with previous line | ||
"[--skip-dry-run] [--describe-json] [--dry-run]", | ||
"[--skip-dry-run] [--describe-json] [--dry-run] [--network <network>|--url <provider_url>]", | ||
lsqproduction marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
options: [ | ||
{ | ||
option: "--reset", | ||
|
@@ -118,8 +122,18 @@ module.exports = { | |
option: "--save", | ||
description: "Specify whether the migration will save on chain", | ||
hidden: true | ||
}, | ||
{ | ||
option: "--url", | ||
description: | ||
"Creates a provider using the given url and connects to the network." | ||
}, | ||
{ | ||
option: "--network", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious about why you prefer Actually, can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The global options generally appends the options at the end of the usage. The reason behind keeping There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okie. thank you for the explanation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we add a note in each of these letting the user know that these options are mutually exclusive? do you think that would be helpful? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whatever you think, I don't feel strongly about it :) |
||
description: | ||
"The network to connect to, as specified in the Truffle config." | ||
} | ||
], | ||
allowedGlobalOptions: ["network", "config", "quiet"] | ||
allowedGlobalOptions: ["config", "quiet"] | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
module.exports = async function (options) { | ||
const WorkflowCompile = require("@truffle/workflow-compile").default; | ||
const { Environment } = require("@truffle/environment"); | ||
const Config = require("@truffle/config"); | ||
const determineDryRunSettings = require("./determineDryRunSettings"); | ||
const prepareConfigForRealMigrations = require("./prepareConfigForRealMigrations"); | ||
const runMigrations = require("./runMigrations"); | ||
const setUpDryRunEnvironmentThenRunMigrations = require("./setUpDryRunEnvironmentThenRunMigrations"); | ||
const loadConfig = require("../../loadConfig"); | ||
const OS = require("os"); | ||
const TruffleError = require("@truffle/error"); | ||
const tmp = require("tmp"); | ||
tmp.setGracefulCleanup(); | ||
|
||
const config = Config.detect(options); | ||
if (options.url && options.network) { | ||
const message = | ||
"" + | ||
"Mutually exclusive options, --url and --network detected!" + | ||
OS.EOL + | ||
"Please use either --url or --network and try again." + | ||
OS.EOL + | ||
"See: https://trufflesuite.com/docs/truffle/reference/truffle-commands/#migrate" + | ||
OS.EOL; | ||
throw new TruffleError(message); | ||
} | ||
cds-amal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let config = loadConfig(options); | ||
|
||
if (config.compileNone || config["compile-none"]) { | ||
config.compiler = "none"; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.