Skip to content

Commit

Permalink
Merge pull request #70 from IgniteUI/dTsvetkov/add-additional-options
Browse files Browse the repository at this point in the history
Add additional context options
  • Loading branch information
hanastasov authored Oct 27, 2023
2 parents 31e9c98 + 532dec9 commit 11aa16a
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 41 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,68 @@ Here we would like to translate "Defined in" hardcoded string. </br>
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/**"
]
}
]
}
```
2 changes: 2 additions & 0 deletions utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
94 changes: 53 additions & 41 deletions utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,57 @@ import { Options, ParameterType } from 'typedoc'
import { Constants } from './constants';

export function pluginOptions(options: Pick<Options, "addDeclaration">) {

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.'
});
}

0 comments on commit 11aa16a

Please sign in to comment.