Skip to content

feat(extensions): Allow generation of help content for extension commands #3365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2018

Conversation

rosen-vladimirov
Copy link
Contributor

Each CLI extension may add new commands to CLI. Allow showing command help for these commands in case:

Commmand execution fails.
Users need more information for command - tns --help
Users need full html help for command - tns help .
Each extension that wants to use this functionality will have to add nativescript key in its package.json and add docs key in it. The docs key must point to the directory where the help content (.md files) is located, relative to the root directory of the extension.
When CLI needs to show command line help for extension's command, it will search the docs directories of all extensions.
When CLI needs to show HTML help for the extension's commands, it will generate html directory right next to the docs dir in the extension.

Move extensibility.d.ts from {N} to mobile-cli-lib just to ensure correct transpilation.

Add different basic page for extensions html pages
When generating html pages for extensions commands, use a different html
page that has the extension name as header at the top.
Add a placeholder and replace it when generating the html page.

public getInstalledExtensionsData(): IExtensionData[] {
const installedExtensions = this.getInstalledExtensions();
return _.keys(installedExtensions).map(installedExtension => {
return this.getInstalledExtensionData(installedExtension);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use short syntax here

@@ -35,7 +35,16 @@ export class ExtensibilityService implements IExtensibilityService {
const installResultInfo = await this.$npm.install(packageName, this.pathToExtensions, npmOpts);
this.$logger.trace(`Finished installation of extension '${extensionName}'. Trying to load it now.`);

return { extensionName: installResultInfo.name };
const packageJsonData = this.getExtensionPackageJsonData(installResultInfo.name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just return getInstalledExtensionData here

@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/extensions-help branch from d6c7676 to ea061aa Compare February 14, 2018 22:56
@rosen-vladimirov
Copy link
Contributor Author

Ping @Mitko-Kerezov - comments are fixed.

Copy link
Contributor

@Mitko-Kerezov Mitko-Kerezov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/extensions-help branch from ea061aa to 11345e8 Compare February 15, 2018 22:32
…ands

Each CLI extension may add new commands to CLI. Allow showing command help for these commands in case:
1. Commmand execution fails.
2. Users need more information for command - `tns <command> --help`
3. Users need full html help for command - `tns help <command>`.

Each extension that wants to use this functionality will have to add `nativescript` key in its `package.json` and add `docs` key in it. The `docs` key must point to the directory where the help content (.md files) is located, relative to the root directory of the extension.
When CLI needs to show command line help for extension's command, it will search the docs directories of all extensions.
When CLI needs to show HTML help for the extension's commands, it will generate `html` directory right next to the docs dir in the extension.

Move extensibility.d.ts from {N} to mobile-cli-lib just to ensure correct transpilation.
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/extensions-help branch from 11345e8 to e44029f Compare February 19, 2018 11:41
@rosen-vladimirov rosen-vladimirov merged commit 6374d38 into master Feb 19, 2018
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/extensions-help branch February 19, 2018 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants