Skip to content

Commit 74dd536

Browse files
authored
Merge pull request #2 from tech-advantage/wip/v2.1.1
[Release] v2.1.1: Update readme and dependencies
2 parents b470d18 + 6d3f77f commit 74dd536

File tree

8 files changed

+934
-1231
lines changed

8 files changed

+934
-1231
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ typings/
1414

1515

1616
# compiled output
17-
/dist
1817
/.yarn-cache
1918
/tmp
2019

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Learn more at [https://www.easydoccontents.com](https://www.easydoccontents.com)
88

99
## edc Version Compatibility
1010

11-
edc current release (v2.3+) uses edc-client-js v2.0.2
11+
edc current release (v2.7+) uses edc-client-js v2.1.1
1212

1313
## Note
1414

dist/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "edc-client-js",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "edc-client-js",
55
"license": "MIT",
66
"repository": "",
@@ -18,39 +18,39 @@
1818
},
1919
"pre-push": "lint",
2020
"dependencies": {
21-
"axios": "0.17.1",
22-
"es6-promise": "4.2.3",
23-
"lodash": "4.17.5"
21+
"axios": "0.18.0",
22+
"es6-promise": "4.2.4",
23+
"lodash": "4.17.4"
2424
},
2525
"devDependencies": {
26-
"@types/jasmine": "2.5.38",
27-
"@types/lodash": "4.14.104",
28-
"@types/node": "6.0.60",
29-
"del": "2.2.2",
26+
"@types/jasmine": "2.8.8",
27+
"@types/lodash": "4.14.74",
28+
"@types/node": "10.5.8",
29+
"del": "3.0.0",
3030
"dotbin": "1.0.1",
3131
"gulp": "4.0.0",
3232
"gulp-filter": "5.1.0",
3333
"gulp-help": "1.6.1",
3434
"gulp-hub": "frankwallis/gulp-hub#4.1.0",
3535
"gulp-tslint": "8.1.3",
3636
"gulp-util": "3.0.8",
37-
"jasmine": "2.5.2",
38-
"jsdom": "9.11.0",
39-
"karma": "1.7.0",
40-
"karma-firefox-launcher": "1.0.0",
41-
"karma-jasmine": "1.1.0",
42-
"karma-jasmine-html-reporter": "0.2.2",
43-
"karma-jsdom-launcher": "5.0.0",
37+
"jasmine": "3.2.0",
38+
"jsdom": "11.12.0",
39+
"karma": "3.0.0",
40+
"karma-firefox-launcher": "1.1.0",
41+
"karma-jasmine": "1.1.2",
42+
"karma-jasmine-html-reporter": "1.2.0",
43+
"karma-jsdom-launcher": "6.1.3",
4444
"karma-sourcemap-loader": "0.3.7",
45-
"karma-typescript": "3.0.4",
45+
"karma-typescript": "3.0.13",
4646
"pre-push": "0.1.1",
4747
"ts-loader": "3.3.0",
48-
"tslint": "5.9.1",
48+
"tslint": "5.11.0",
4949
"tslint-loader": "3.6.0",
50-
"typescript": "2.7.2",
51-
"uglifyjs-webpack-plugin": "1.2.2",
52-
"webpack": "3.10.0",
53-
"webpack-node-externals": "1.6.0"
50+
"typescript": "2.9.x",
51+
"uglifyjs-webpack-plugin": "1.2.7",
52+
"webpack": "3.12.0",
53+
"webpack-node-externals": "1.7.2"
5454
},
5555
"engines": {
5656
"node": ">=4.0.0"

src/edc-client-service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ export function getPluginIds(baseURL: string): Promise<string[]> {
2929

3030
export function getHelpContent(baseUrl: string, suffix: ContentTypeSuffix): Promise<any> {
3131
return axios.get(`${baseUrl}${suffix}`)
32-
.then((res: AxiosResponse) => get<number>(res, 'status') === 200 ? res.data : null,
32+
.then((res: AxiosResponse) => get(res, 'status') === 200 ? res.data : null,
3333
(err: AxiosError) => PromiseEs6.reject(err));
3434
}
3535

3636
export function getDocumentationById(globalToc: MultiToc, id: number): Documentation {
3737
const path = get(globalToc, `index[${id}]`);
38-
return get<Documentation>(globalToc, path);
38+
return get(globalToc, path);
3939
}
4040

4141
export function getContent<T extends Loadable>(baseURL: string, item: T): Promise<T> {
@@ -60,17 +60,17 @@ export function createExportsFromContent(exportsContent: DocumentationExport[]):
6060
}
6161

6262
export function createExportFromContent(exportContent: DocumentationExport): DocumentationExport {
63-
return assign<DocumentationExport>(exportContent, { toc: new Toc() });
63+
return assign(exportContent, { toc: new Toc() });
6464
}
6565

6666
export function findExportById(exports: DocumentationExport[], id: string): DocumentationExport {
6767
return find(exports, (docExport: DocumentationExport) => docExport.pluginId === id);
6868
}
6969

7070
export function getPluginIdFromDocumentId(globalToc: MultiToc, docId: number): string {
71-
const docPath = get<string>(globalToc, `index[${docId}]`);
71+
const docPath = get(globalToc, `index[${docId}]`) as string;
7272
const exportPath = first(split(docPath, '.'));
73-
return get<string>(globalToc, `${exportPath}.pluginId`);
73+
return get(globalToc, `${exportPath}.pluginId`);
7474
}
7575

7676
export function initEachToc(baseURL: string, exports: DocumentationExport[], multiToc: MultiToc): any {
@@ -81,7 +81,7 @@ export function initEachToc(baseURL: string, exports: DocumentationExport[], mul
8181
}
8282

8383
export function addTocIMsToIndex(baseUrl: string, sourceExport: DocumentationExport, multiToc: MultiToc): Promise<DocumentationExport> {
84-
const pluginId = get<string>(sourceExport, 'pluginId');
84+
const pluginId = get(sourceExport, 'pluginId');
8585
if (!pluginId) {
8686
return null;
8787
}
@@ -107,15 +107,15 @@ export function addTocIMsToIndex(baseUrl: string, sourceExport: DocumentationExp
107107
* @return {Promise<DocumentationExport>} returns a promise containing the current export
108108
*/
109109
function addExportToGlobalToc(rootUrl: string, currentToc: Toc, sourceExport: DocumentationExport, multiToc: MultiToc): PromiseEs6<DocumentationExport> {
110-
const informationMaps = get<InformationMap[]>(currentToc, 'toc');
110+
const informationMaps: InformationMap[] = get(currentToc, 'toc');
111111
if (!informationMaps) {
112112
return null;
113113
}
114114
return addInformationMapsToIndex(rootUrl, informationMaps, multiToc)
115115
.then(() => addTocToExport(sourceExport, currentToc, multiToc));
116116
}
117117

118-
function addInformationMapsToIndex(rootUrl: string, informationMaps: InformationMap[], multiToc: MultiToc): PromiseEs6<void[]> {
118+
function addInformationMapsToIndex(rootUrl: string, informationMaps: InformationMap[], multiToc: MultiToc): PromiseEs6<any> {
119119
return PromiseEs6.all(map(informationMaps, (informationMap, key) => getHelpContent(`${rootUrl}/${informationMap.file}`, ContentTypeSuffix.TYPE_EMPTY_SUFFIX)
120120
.then((content: InformationMap) => addSingleIMContentToIndex(informationMap, content, key, multiToc))));
121121
}

src/edc-client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class EdcClient {
5757
return this.globalTocReady.then((tocs: MultiToc) => {
5858
const pluginId = targetPluginId || this.currentPluginId;
5959
if (pluginId) {
60-
return get<Toc>(edcClientService.findExportById(tocs.exports, pluginId), 'toc');
60+
return get(edcClientService.findExportById(tocs.exports, pluginId), 'toc') as Toc;
6161
}
6262
});
6363
}
@@ -112,7 +112,7 @@ export class EdcClient {
112112
if (helper) {
113113
return PromiseEs6.all(
114114
[edcClientService.getContent<Helper>(this.baseURL, helper),
115-
...helper.articles.map(article => edcClientService.getContent<Article>(this.baseURL, article))]
115+
...helper.articles.map(article => edcClientService.getContent<Article>(this.baseURL, article))]
116116
);
117117
}
118118
})
@@ -181,12 +181,12 @@ export class EdcClient {
181181
return this.globalTocReady.then(() => {
182182
const docPath = this.globalToc.index[id];
183183
const iMPath = join(split(docPath, '.', 3), '.');
184-
return get<InformationMap>(this.globalToc, iMPath);
184+
return get(this.globalToc, iMPath) as InformationMap;
185185
});
186186
}
187187

188188
getKey(key: string, subKey: string, lang: string): Helper {
189-
return get<Helper>(this.context, `['${key}']['${subKey}']['${lang}']`);
189+
return get(this.context, `['${key}']['${subKey}']['${lang}']`);
190190
}
191191

192192
setCurrentPluginId(newPluginId: string): void {

src/utils/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class Utils {
1414
*/
1515
static indexTree(indexables: Indexable[], prefix?: string, isRoot?: boolean): Map<string, string> {
1616
// iterate through topics and reduce the documentations concatenating the path with parents
17-
return reduce(indexables, (memo: any, {id, topics}: Documentation, index: number) => {
17+
const tree = reduce(indexables, (memo: any, {id, topics}: Documentation, index: number) => {
1818
let newPrefix: string;
1919
// if it's not the root, append the prefix with keyword topics
2020
if (!isRoot) {
@@ -28,6 +28,7 @@ export class Utils {
2828
// recall the function upon topics until finding the leaf
2929
return assign(memo, this.indexTree(topics, newPrefix));
3030
}, {});
31+
return tree;
3132
}
3233

3334
static checkMultiDocContent(content: any): boolean {
@@ -38,9 +39,10 @@ export class Utils {
3839
}
3940

4041
static isMultiTocContentValid(exportsContent: any[]): boolean {
41-
return !chain(exportsContent)
42+
const result = !chain(exportsContent)
4243
.map(exportContent => exportContent.pluginId)
4344
.isEmpty()
4445
.valueOf();
46+
return result;
4547
}
4648
}

0 commit comments

Comments
 (0)