From 641e4918013886def73f2dc9ff03aa59a17bbf0f Mon Sep 17 00:00:00 2001 From: Dobromir Tsvetkov Date: Thu, 19 Jan 2023 13:21:01 +0200 Subject: [PATCH 1/2] Add additional context options --- utils/constants.ts | 2 + utils/options.ts | 94 ++++++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/utils/constants.ts b/utils/constants.ts index a42f1f8..507e8a8 100644 --- a/utils/constants.ts +++ b/utils/constants.ts @@ -25,6 +25,8 @@ export class Constants { static readonly INCLUDE_PARAMS_OPTION = 'params'; static readonly LOCALIZE_OPTION = 'localize' static readonly TEMPLATE_STRINGS_OPTION = 'templateStrings'; + static readonly INCLUDE_VERSIONS_OPTION = 'versioning'; + static readonly PRODUCT_OPTION = 'product'; static readonly GLOBAL_FUNCS_FILE_NAME = 'globalFunctions'; } \ No newline at end of file diff --git a/utils/options.ts b/utils/options.ts index ea03148..4549ea6 100644 --- a/utils/options.ts +++ b/utils/options.ts @@ -2,45 +2,57 @@ import { Options, ParameterType } from 'typedoc' import { Constants } from './constants'; export function pluginOptions(options: Pick) { - - options.addDeclaration({ - name: Constants.CONVERT_OPTION, - help: 'Specifies the directory where the json files have to be generated.' - }); - - options.addDeclaration({ - name: Constants.RENDER_OPTION, - help: 'Specify from where to get the loclized json data.' - }); - - options.addDeclaration({ - name: Constants.INCLUDE_TAGS_OPTION, - help: 'Specify whether to include tags per comment.', - type: ParameterType.Boolean, - defaultValue: false - }); - - options.addDeclaration({ - name: Constants.INCLUDE_PARAMS_OPTION, - help: 'Specify whether to include params per comment.', - type: ParameterType.Boolean, - defaultValue: false - }); - - options.addDeclaration({ - name: Constants.INCLUDE_WARNS_OPTION, - help: 'Specify whether to throw warnings of missed tags and parameters into the json\'s.', - type: ParameterType.Boolean, - defaultValue: false - }); - - options.addDeclaration({ - name: Constants.LOCALIZE_OPTION, - help: 'Specify your localization for instance (jp)' - }); - - options.addDeclaration({ - name: Constants.TEMPLATE_STRINGS_OPTION, - help: 'Path to the json file which contains your localized template strings' - }); + + options.addDeclaration({ + name: Constants.CONVERT_OPTION, + help: 'Specifies the directory where the json files have to be generated.' + }); + + options.addDeclaration({ + name: Constants.RENDER_OPTION, + help: 'Specify from where to get the loclized json data.' + }); + + options.addDeclaration({ + name: Constants.INCLUDE_TAGS_OPTION, + help: 'Specify whether to include tags per comment.', + type: ParameterType.Boolean, + defaultValue: false + }); + + options.addDeclaration({ + name: Constants.INCLUDE_PARAMS_OPTION, + help: 'Specify whether to include params per comment.', + type: ParameterType.Boolean, + defaultValue: false + }); + + options.addDeclaration({ + name: Constants.INCLUDE_WARNS_OPTION, + help: 'Specify whether to throw warnings of missed tags and parameters into the json\'s.', + type: ParameterType.Boolean, + defaultValue: false + }); + + options.addDeclaration({ + name: Constants.LOCALIZE_OPTION, + help: 'Specify your localization for instance (jp)' + }); + + options.addDeclaration({ + name: Constants.TEMPLATE_STRINGS_OPTION, + help: 'Path to the json file which contains your localized template strings' + }); + + options.addDeclaration({ + name: Constants.INCLUDE_VERSIONS_OPTION, + help: 'Specify whether to include versions dropdown into the header.', + type: ParameterType.Boolean, + defaultValue: false + }); + + options.addDeclaration({ + name: Constants.PRODUCT_OPTION, + help: 'Specify product name.' + }); } \ No newline at end of file From 8a65c72c8fde3b3d986d57476894f3291965af6c Mon Sep 17 00:00:00 2001 From: Dobromir Tsvetkov Date: Fri, 20 Jan 2023 13:59:33 +0200 Subject: [PATCH 2/2] chore(*): update readme file with link and debug section --- README.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/README.md b/README.md index 0389688..6a5f298 100644 --- a/README.md +++ b/README.md @@ -251,3 +251,68 @@ Here we would like to translate "Defined in" hardcoded string.
npx typedoc projects\igniteui-angular\src\ --localize jp --templateStrings ./extras/template/strings/shell-strings.json ``` You can see how our template strings file looks like here [./extras/template/strings/shell-strings.json](https://github.com/IgniteUI/igniteui-angular/blob/master/extras/template/strings/shell-strings.json). + +#### Link and Debug +In order to run the plugin locally, after it is build, it should be linked to the repo you want to use it. + +1. Execute the following commands + +``` +npm run build +``` + +``` +npm pack +``` + +``` +cp typedoc-plugin-localization-1.0.4.tgz ~ +``` + +2. Go to the theme repository where the plugin is included as peer dependency and add the reference to the packed file. +Example: + +``` + "peerDependecies": { + "typedoc-plugin-localization": "file:../../../typedoc-plugin-localization-1.0.4.tgz", + } +``` + +3. Go to the repository which is using the theme and plugin. + +``` +npm install ~/typedoc-plugin-localization-1.0.4.tgz +``` + +4. Add launch.json configuration to enable debbuging + +Example: +``` +{ + "configurations": [ + { + "name": "Typedoc plugin", + "type": "node", + "request": "launch", + "program": "${workspaceFolder}/node_modules/typedoc/bin/typedoc", + "args": [ + "${workspaceFolder}/projects/igniteui-angular/src/public_api.ts", + "--generate-json", + "${workspaceFolder}/dist", + "--localize", + "en", + "--versioning", + "--product", + "ignite-ui-angular", + "--tsconfig", + "${workspaceFolder}/tsconfig.json" + ], + "sourceMaps": true, + "resolveSourceMapLocations": [ + "${workspaceFolder}/**", + "!**/node_modules/**" + ] + } + ] +} +```