Skip to content

Commit

Permalink
Merge pull request #73 from IgniteUI/simeonoff/bump-typedoc
Browse files Browse the repository at this point in the history
refactor(*): bump typedoc and read templateString from options
  • Loading branch information
simeonoff authored Nov 6, 2023
2 parents 11aa16a + 47052de commit 9e613e8
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 89 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/npm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- run: echo ${VERSION}
Expand Down
37 changes: 19 additions & 18 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as process from 'process';
import * as fs from 'fs-extra';

import { Application } from 'typedoc'
import { Application, Converter, Renderer } from 'typedoc'
import { ConvertComponent } from './components/convert-component';
import { RenderComponenet } from './components/render-component';
import { Constants } from './utils/constants';
import { GlobalFuncs } from './utils/global-funcs';
import { HardcodedStrings } from './utils/template-strings';
import { ThemeComponent } from './components/theme-component';
import { pluginOptions } from './utils/options';
Expand All @@ -22,6 +21,7 @@ export function load(PluginHost: Application) {
let startConverter = false;
let startRenderer = false;
const processArgs = process.argv;

/**
* Determines it it is necessary to run Conversion or Render process based on the
* Command line arguments(Options).
Expand Down Expand Up @@ -61,23 +61,24 @@ export function load(PluginHost: Application) {
* Register theme component.
*/
new ThemeComponent(app);
// app.renderer.addComponent('theme-component', new ThemeComponent(app.renderer));
registerHardcodedTemplateStrings(processArgs);
}

/**
* Build the Cache containing all localized template strings.
*/
function registerHardcodedTemplateStrings(options) {
const shellStringsFilePath = GlobalFuncs.getCmdLineArgumentValue(options, Constants.TEMPLATE_STRINGS_OPTION);
const local = GlobalFuncs.getCmdLineArgumentValue(options, Constants.LOCALIZE_OPTION);
/**
* Build the Cache containing all localized template strings.
*/
const registerTemplateStrings = () => {
const shellStringsFilePath = app.options.getValue(Constants.TEMPLATE_STRINGS_OPTION);
const locale = app.options.getValue(Constants.LOCALIZE_OPTION) as string;

if (!shellStringsFilePath || !locale) {
return;
}

if (!shellStringsFilePath || !local) {
return;
const templateStrings = fs.readJsonSync(shellStringsFilePath);

HardcodedStrings.setLocal(locale);
HardcodedStrings.setTemplateStrings(templateStrings);
}

const templateStrings = fs.readJsonSync(shellStringsFilePath);

HardcodedStrings.setLocal(local);
HardcodedStrings.setTemplateStrings(templateStrings);
}
app.converter.on(Converter.EVENT_RESOLVE, registerTemplateStrings);
app.renderer.on(Renderer.EVENT_BEGIN, registerTemplateStrings);
}
137 changes: 77 additions & 60 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"devDependencies": {
"@types/node": "^18.11.0",
"typedoc": "^0.23.21",
"typescript": "^4.9.5"
"typedoc": "^0.25.3",
"typescript": "^5.2.2"
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"types": [
"node"
], /* Type declaration files to be included in compilation. */
"esModuleInterop": false, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Experimental Options */
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */
}
}
}
2 changes: 1 addition & 1 deletion utils/template-strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export class HardcodedStrings {
public static getTemplateStrings(): string {
return this.templateStrings;
}
}
}

0 comments on commit 9e613e8

Please sign in to comment.