fix: ohif-cli cosmetic changes for help description (#2776)
* fix ohif-cli cosmetic changes for help description * refact code review fix main command name * fix extension template fix extension-default package version
This commit is contained in:
parent
cfcf5e48e7
commit
86dcaf6293
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import program from 'commander';
|
import { Command } from 'commander';
|
||||||
import inquirer from 'inquirer';
|
import inquirer from 'inquirer';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
@ -51,7 +51,7 @@ function _createPackage(packageType) {
|
|||||||
let pathAnswers;
|
let pathAnswers;
|
||||||
|
|
||||||
const askPathQuestions = () => {
|
const askPathQuestions = () => {
|
||||||
inquirer.prompt(pathQuestions).then((answers) => {
|
inquirer.prompt(pathQuestions).then(answers => {
|
||||||
pathAnswers = answers;
|
pathAnswers = answers;
|
||||||
if (pathAnswers.confirm) {
|
if (pathAnswers.confirm) {
|
||||||
askRepoQuestions(answers.baseDir, answers.name);
|
askRepoQuestions(answers.baseDir, answers.name);
|
||||||
@ -62,7 +62,7 @@ function _createPackage(packageType) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const askRepoQuestions = () => {
|
const askRepoQuestions = () => {
|
||||||
inquirer.prompt(repoQuestions).then((repoAnswers) => {
|
inquirer.prompt(repoQuestions).then(repoAnswers => {
|
||||||
const answers = {
|
const answers = {
|
||||||
...pathAnswers,
|
...pathAnswers,
|
||||||
...repoAnswers,
|
...repoAnswers,
|
||||||
@ -80,12 +80,19 @@ function _createPackage(packageType) {
|
|||||||
askPathQuestions();
|
askPathQuestions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for now ohif-cli is ran through yarn only.
|
||||||
|
// see ohif-cli.md section # OHIF Command Line Interface for reference.
|
||||||
|
const program = new Command('yarn run cli');
|
||||||
// Todo: inject with webpack
|
// Todo: inject with webpack
|
||||||
program.version('2.0.7').description('OHIF CLI');
|
program
|
||||||
|
.version('2.0.7')
|
||||||
|
.description('OHIF CLI')
|
||||||
|
.configureHelp({ sortOptions: true, sortSubcommands: true })
|
||||||
|
.showHelpAfterError('(add --help for additional information)');
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('create-extension')
|
.command('create-extension')
|
||||||
.description('Create a new template extension')
|
.description('Create a new template Extension')
|
||||||
.action(() => {
|
.action(() => {
|
||||||
_createPackage('extension');
|
_createPackage('extension');
|
||||||
});
|
});
|
||||||
@ -99,7 +106,7 @@ program
|
|||||||
|
|
||||||
program
|
program
|
||||||
.command('add-extension <packageName> [version]')
|
.command('add-extension <packageName> [version]')
|
||||||
.description('Adds an ohif extension')
|
.description('Adds an OHIF Extension')
|
||||||
.action((packageName, version) => {
|
.action((packageName, version) => {
|
||||||
// change directory to viewer
|
// change directory to viewer
|
||||||
process.chdir(viewerDirectory);
|
process.chdir(viewerDirectory);
|
||||||
@ -108,8 +115,8 @@ program
|
|||||||
|
|
||||||
program
|
program
|
||||||
.command('remove-extension <packageName>')
|
.command('remove-extension <packageName>')
|
||||||
.description('removes an ohif extension')
|
.description('Removes an OHIF Extension')
|
||||||
.action((packageName) => {
|
.action(packageName => {
|
||||||
// change directory to viewer
|
// change directory to viewer
|
||||||
process.chdir(viewerDirectory);
|
process.chdir(viewerDirectory);
|
||||||
removeExtension(packageName);
|
removeExtension(packageName);
|
||||||
@ -117,7 +124,7 @@ program
|
|||||||
|
|
||||||
program
|
program
|
||||||
.command('add-mode <packageName> [version]')
|
.command('add-mode <packageName> [version]')
|
||||||
.description('Removes an ohif mode')
|
.description('Add an OHIF Mode')
|
||||||
.action((packageName, version) => {
|
.action((packageName, version) => {
|
||||||
// change directory to viewer
|
// change directory to viewer
|
||||||
process.chdir(viewerDirectory);
|
process.chdir(viewerDirectory);
|
||||||
@ -126,8 +133,8 @@ program
|
|||||||
|
|
||||||
program
|
program
|
||||||
.command('remove-mode <packageName>')
|
.command('remove-mode <packageName>')
|
||||||
.description('Removes an ohif mode')
|
.description('Removes an OHIF Mode')
|
||||||
.action((packageName) => {
|
.action(packageName => {
|
||||||
// change directory to viewer
|
// change directory to viewer
|
||||||
process.chdir(viewerDirectory);
|
process.chdir(viewerDirectory);
|
||||||
removeMode(packageName);
|
removeMode(packageName);
|
||||||
@ -136,13 +143,13 @@ program
|
|||||||
program
|
program
|
||||||
.command('link-extension <packageDir>')
|
.command('link-extension <packageDir>')
|
||||||
.description(
|
.description(
|
||||||
'Links a local OHIF extension to the Viewer to be used for development'
|
'Links a local OHIF Extension to the Viewer to be used for development'
|
||||||
)
|
)
|
||||||
.action((packageDir) => {
|
.action(packageDir => {
|
||||||
if (!fs.existsSync(packageDir)) {
|
if (!fs.existsSync(packageDir)) {
|
||||||
console.log(
|
console.log(
|
||||||
chalk.red(
|
chalk.red(
|
||||||
'The extension directory does not exist, please provide a valid directory'
|
'The Extension directory does not exist, please provide a valid directory'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@ -152,12 +159,12 @@ program
|
|||||||
|
|
||||||
program
|
program
|
||||||
.command('unlink-extension <extensionName>')
|
.command('unlink-extension <extensionName>')
|
||||||
.description('Unlinks a local OHIF extension from the Viewer')
|
.description('Unlinks a local OHIF Extension from the Viewer')
|
||||||
.action((extensionName) => {
|
.action(extensionName => {
|
||||||
unlinkExtension(extensionName, { viewerDirectory });
|
unlinkExtension(extensionName, { viewerDirectory });
|
||||||
console.log(
|
console.log(
|
||||||
chalk.green(
|
chalk.green(
|
||||||
`Successfully unlinked extension ${extensionName} from the Viewer, don't forget to run yarn install --force`
|
`Successfully unlinked Extension ${extensionName} from the Viewer, don't forget to run yarn install --force`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -165,13 +172,13 @@ program
|
|||||||
program
|
program
|
||||||
.command('link-mode <packageDir>')
|
.command('link-mode <packageDir>')
|
||||||
.description(
|
.description(
|
||||||
'Links a local OHIF mode to the Viewer to be used for development'
|
'Links a local OHIF Mode to the Viewer to be used for development'
|
||||||
)
|
)
|
||||||
.action((packageDir) => {
|
.action(packageDir => {
|
||||||
if (!fs.existsSync(packageDir)) {
|
if (!fs.existsSync(packageDir)) {
|
||||||
console.log(
|
console.log(
|
||||||
chalk.red(
|
chalk.red(
|
||||||
'The mode directory does not exist, please provide a valid directory'
|
'The Mode directory does not exist, please provide a valid directory'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@ -181,12 +188,12 @@ program
|
|||||||
|
|
||||||
program
|
program
|
||||||
.command('unlink-mode <modeName>')
|
.command('unlink-mode <modeName>')
|
||||||
.description('Unlinks a local OHIF mode from the Viewer')
|
.description('Unlinks a local OHIF Mode from the Viewer')
|
||||||
.action((modeName) => {
|
.action(modeName => {
|
||||||
unlinkMode(modeName, { viewerDirectory });
|
unlinkMode(modeName, { viewerDirectory });
|
||||||
console.log(
|
console.log(
|
||||||
chalk.green(
|
chalk.green(
|
||||||
`Successfully unlinked mode ${modeName} from the Viewer, don't forget to run yarn install --force`
|
`Successfully unlinked Mode ${modeName} from the Viewer, don't forget to run yarn install --force`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -203,7 +210,7 @@ program
|
|||||||
.command('search')
|
.command('search')
|
||||||
.option('-v, --verbose', 'Verbose output')
|
.option('-v, --verbose', 'Verbose output')
|
||||||
.description('Search NPM for the list of Modes and Extensions')
|
.description('Search NPM for the list of Modes and Extensions')
|
||||||
.action((options) => {
|
.action(options => {
|
||||||
searchPlugins(options);
|
searchPlugins(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ohif/core": "^3.0.0",
|
"@ohif/core": "^3.0.0",
|
||||||
"@ohif/extension-default": "^1.0.1",
|
"@ohif/extension-default": "^3.0.0",
|
||||||
"@ohif/extension-cornerstone": "^3.0.0",
|
"@ohif/extension-cornerstone": "^3.0.0",
|
||||||
"@ohif/i18n": "^1.0.0",
|
"@ohif/i18n": "^1.0.0",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user