Comparing version 0.9.0 to 0.10.0
@@ -17,9 +17,12 @@ "use strict"; | ||
const addTestFile = (file) => testFiles.push(file); | ||
const canisterNames = []; | ||
const addCanisterName = (name) => canisterNames.push(name); | ||
const examples = [ | ||
['-r', 'redeploy canisters on file change'], | ||
['-d', 'upgrade canisters on file change'], | ||
['-d', 'redeploy canisters on file change'], | ||
['-d -y', 'upgrade canisters on file change'], | ||
['-g', 'generate TypeScript bindings on file change'], | ||
['-t', 'run unit tests on file change'], | ||
['-r -c foo_canister -c bar_canister', 'redeploy `foo_canister` and `bar_canister` on file change'], | ||
]; | ||
const { cwd, version, port, delay, exec, generate, deploy, test, yes, hotReload, ci, } = commander_1.program | ||
const { cwd, version, port, delay, exec, generate, deploy, test, yes, hotReload, } = commander_1.program | ||
.name('mo-dev') | ||
@@ -35,2 +38,3 @@ .description(`Examples:\n${examples | ||
.option('-f, --testfile <prefix>', `only run tests with the given file name prefix`, addTestFile) | ||
.option('-c, --canister <canister>', `use the given Motoko canister`, addCanisterName) | ||
.option('-y, --yes', `respond "yes" to reinstall prompts (may reset canister state)`) | ||
@@ -59,2 +63,3 @@ .option('-g, --generate', `run \`dfx generate\` on file change`) | ||
testFiles: testFiles.length ? testFiles : settings_1.defaultSettings.testModes, | ||
canisterNames: canisterNames.length ? canisterNames : settings_1.defaultSettings.canisterNames, | ||
reinstall: !!yes || settings_1.defaultSettings.reinstall, | ||
@@ -61,0 +66,0 @@ hotReload: !!hotReload || settings_1.defaultSettings.hotReload, |
@@ -13,2 +13,3 @@ import { TestMode } from './testing'; | ||
testFiles: string[]; | ||
canisterNames: string[]; | ||
reinstall: boolean; | ||
@@ -15,0 +16,0 @@ hotReload: boolean; |
@@ -29,2 +29,3 @@ "use strict"; | ||
testFiles: [], | ||
canisterNames: [], | ||
reinstall: false, | ||
@@ -31,0 +32,0 @@ hotReload: false, |
@@ -106,2 +106,16 @@ "use strict"; | ||
canisters = (0, canister_1.getDfxCanisters)(directory, dfxConfig); | ||
if (settings.canisterNames.length) { | ||
const showExpected = settings.canisterNames.some((name) => { | ||
if (!canisters.some((c) => name === c.alias)) { | ||
log(0, 'unexpected canister:', picocolors_1.default.yellow(picocolors_1.default.bold(name))); | ||
return true; | ||
} | ||
}); | ||
if (showExpected) { | ||
log(0, `options:`, picocolors_1.default.gray(canisters | ||
.map((c) => picocolors_1.default.bold(picocolors_1.default.green(c.alias))) | ||
.join(', '))); | ||
} | ||
canisters = canisters.filter((canister) => settings.canisterNames.some((name) => name === canister.alias)); | ||
} | ||
} | ||
@@ -108,0 +122,0 @@ catch (err) { |
{ | ||
"name": "mo-dev", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "A live reload development server for Motoko smart contracts.", | ||
@@ -5,0 +5,0 @@ "author": "DFINITY Foundation (https://dfinity.org)", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2345881
1930