@progress/kendo-typescript-tasks 10.0.22-dev.5 → 10.0.22-ng12.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.config.js +2 -16
- package/api.js +26 -4
- package/gulp-tasks.js +7 -22
- package/package.json +13 -11
- package/src/api/comment.js +3 -1
- package/src/api/generator.js +7 -2
- package/src/api/map-constructors.js +8 -2
- package/src/api/map-props.js +6 -4
- package/src/api/template-utils.js +3 -0
- package/src/api/type-utils.js +12 -8
- package/src/api/union-page.hbs +1 -1
- package/src/linter.js +18 -0
- package/test/api.js +6 -0
- package/test/intersection.json +2 -2
- package/test/type-union-operators.json +42 -0
- package/test/type-union.json +2 -2
package/api.config.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
const os = require('os');
|
|
2
1
|
const path = require('path');
|
|
3
2
|
|
|
4
|
-
const jsonPath = path.
|
|
3
|
+
const jsonPath = path.resolve('./api.json');
|
|
5
4
|
const typedoc = {
|
|
6
|
-
|
|
7
|
-
module: 'commonjs',
|
|
8
|
-
target: 'es6',
|
|
9
|
-
types: [],
|
|
10
|
-
experimentalDecorators: true,
|
|
11
|
-
jsx: 'react', // support for tsx files
|
|
12
|
-
|
|
13
|
-
// Output options
|
|
14
|
-
json: jsonPath,
|
|
15
|
-
|
|
16
|
-
// Typedoc options
|
|
17
|
-
excludeExternals: true,
|
|
18
|
-
ignoreCompilerErrors: false,
|
|
19
|
-
includeDeclarations: true
|
|
5
|
+
excludeExternals: false
|
|
20
6
|
};
|
|
21
7
|
|
|
22
8
|
module.exports = {
|
package/api.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const execSync = require('child_process').execSync;
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const typedoc = require('gulp-typedoc');
|
|
6
5
|
const { merge } = require('lodash');
|
|
6
|
+
const typedoc = require('typedoc');
|
|
7
|
+
const glob = require('glob');
|
|
7
8
|
|
|
8
9
|
const api = require('./src/api/generator.js');
|
|
9
10
|
const apiConfig = require('./api.config.js');
|
|
@@ -12,10 +13,31 @@ module.exports = (gulp, userConfig) => {
|
|
|
12
13
|
const series = gulp.series;
|
|
13
14
|
|
|
14
15
|
const config = merge({}, apiConfig, userConfig);
|
|
15
|
-
const DECLARATIONS = [ "typings/index.d.ts", "node_modules/@types/core-js/index.d.ts" ];
|
|
16
16
|
|
|
17
|
-
gulp.task('api-json', () =>
|
|
18
|
-
|
|
17
|
+
gulp.task('api-json', async(done) => {
|
|
18
|
+
const entryPoints = [
|
|
19
|
+
...glob.sync("src/**/*.{ts,tsx}"),
|
|
20
|
+
...(config.externalApi || [])
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const app = new typedoc.Application();
|
|
24
|
+
app.options.addReader(new typedoc.TSConfigReader());
|
|
25
|
+
app.bootstrap({ ...config.typedoc, entryPoints });
|
|
26
|
+
|
|
27
|
+
const project = app.convert();
|
|
28
|
+
if (!project) {
|
|
29
|
+
done(new Error('Unable to initialize TypeDoc.'));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await app.generateJson(project, apiConfig.jsonPath);
|
|
34
|
+
if (app.logger.hasErrors()) {
|
|
35
|
+
done(new Error('Unable to generate API reference, see messages above.'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
done();
|
|
40
|
+
});
|
|
19
41
|
|
|
20
42
|
gulp.task('api-clean', (done) => {
|
|
21
43
|
execSync(`rm -rf docs/api`, { stdio: [ 0,1,2 ] });
|
package/gulp-tasks.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
const del = require('del');
|
|
4
4
|
const childProcess = require('child_process');
|
|
5
5
|
const path = require('path');
|
|
6
|
-
const gulpTsLint = require('gulp-tslint');
|
|
7
|
-
const tslint = require('tslint');
|
|
8
6
|
|
|
9
7
|
const apiTasks = require('./api.js');
|
|
10
8
|
const commonTasks = require('@progress/kendo-common-tasks');
|
|
9
|
+
const linter = require('./src/linter');
|
|
11
10
|
|
|
12
11
|
const webpackConfig = require('./webpack.config.js');
|
|
13
12
|
const tscPath = path.join(process.cwd(), 'node_modules', '.bin', 'tsc');
|
|
@@ -37,29 +36,15 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
|
|
|
37
36
|
done();
|
|
38
37
|
});
|
|
39
38
|
|
|
40
|
-
gulp.task('lint', series(
|
|
41
|
-
|
|
39
|
+
gulp.task('lint', series(
|
|
40
|
+
'check-compilation',
|
|
41
|
+
linter([ 'src/**/*.{ts,tsx}', 'test/**/*.{ts,tsx}', 'e2e/**/*.{ts,tsx}' ])
|
|
42
|
+
));
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
program: program,
|
|
46
|
-
formatter: 'verbose'
|
|
47
|
-
}))
|
|
48
|
-
.pipe(gulpTsLint.report());
|
|
44
|
+
gulp.task('lint-docs', linter([ 'docs/examples/**/*.{ts,tsx}' ], {
|
|
45
|
+
overrideConfigFile: '.eslintrc.docs.json'
|
|
49
46
|
}));
|
|
50
47
|
|
|
51
|
-
gulp.task('lint-docs', () => {
|
|
52
|
-
const program = tslint.Linter.createProgram('./tsconfig.docs.json', '.');
|
|
53
|
-
|
|
54
|
-
return gulp.src([ 'docs/examples/**/*.{ts,tsx}' ])
|
|
55
|
-
.pipe(gulpTsLint({
|
|
56
|
-
formatter: 'prose',
|
|
57
|
-
program: program,
|
|
58
|
-
configuration: './tslint.docs.json'
|
|
59
|
-
}))
|
|
60
|
-
.pipe(gulpTsLint.report());
|
|
61
|
-
});
|
|
62
|
-
|
|
63
48
|
gulp.task('start', (done) => {
|
|
64
49
|
const webpackPort = 8888;
|
|
65
50
|
const host = listenAddress;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@progress/kendo-typescript-tasks",
|
|
3
3
|
"description": "Kendo UI TypeScript package gulp tasks",
|
|
4
4
|
"main": "gulp-tasks.js",
|
|
5
|
-
"version": "10.0.22-
|
|
5
|
+
"version": "10.0.22-ng12.72+c683c3c",
|
|
6
6
|
"author": "Telerik",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"scripts": {
|
|
@@ -15,29 +15,31 @@
|
|
|
15
15
|
"API Generation"
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"typescript": "^3.4
|
|
18
|
+
"typescript": "^4.3.4"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@progress/kendo-common-tasks": "7.9.5-
|
|
22
|
-
"
|
|
21
|
+
"@progress/kendo-common-tasks": "7.9.5-ng12.76+c683c3c",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "4.28.2",
|
|
23
|
+
"@typescript-eslint/parser": "4.28.2",
|
|
24
|
+
"core-js": "^3.18.0",
|
|
23
25
|
"del": "2.2.2",
|
|
26
|
+
"eslint": "7.32.0",
|
|
27
|
+
"eslint-plugin-import": "2.25.2",
|
|
28
|
+
"eslint-plugin-rxjs": "3.3.7",
|
|
29
|
+
"glob": "^7.2.0",
|
|
24
30
|
"gulp": "^4.0.0",
|
|
25
31
|
"gulp-add-src": "^1.0.0",
|
|
26
|
-
"gulp-tslint": "^8.0.0",
|
|
27
|
-
"gulp-typedoc": "~2.2.2",
|
|
28
32
|
"handlebars": "^4.0.5",
|
|
29
33
|
"highlight.js": "9.14.2",
|
|
30
34
|
"lodash": "^4.6.0",
|
|
31
35
|
"mkdirp": "^0.5.0",
|
|
32
36
|
"source-map-loader": "^0.1.5",
|
|
33
37
|
"ts-loader": "4.1.0",
|
|
34
|
-
"
|
|
35
|
-
"tslint-defocus": "^2.0.6",
|
|
36
|
-
"typedoc": "0.15.0"
|
|
38
|
+
"typedoc": "~0.22.5"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"gulp-jasmine": "^2.4.2",
|
|
40
|
-
"typescript": "~3.4
|
|
42
|
+
"typescript": "~4.3.4"
|
|
41
43
|
},
|
|
42
44
|
"repository": {
|
|
43
45
|
"type": "git",
|
|
@@ -46,5 +48,5 @@
|
|
|
46
48
|
"publishConfig": {
|
|
47
49
|
"access": "public"
|
|
48
50
|
},
|
|
49
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "c683c3cf53173e65898d3a40a13a2c6654e98238"
|
|
50
52
|
}
|
package/src/api/comment.js
CHANGED
|
@@ -27,7 +27,9 @@ const commentTags = (comment, member) =>
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
const formatComment = (member, parentName, memberKind) => {
|
|
30
|
-
const
|
|
30
|
+
const signatures = member.type?.declaration?.signatures;
|
|
31
|
+
const comment = member.comment || signatures && signatures[0]?.comment;
|
|
32
|
+
|
|
31
33
|
if (!comment) {
|
|
32
34
|
warn(member, parentName, memberKind);
|
|
33
35
|
|
package/src/api/generator.js
CHANGED
|
@@ -106,6 +106,11 @@ const normalizeMembers = (members) => {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
if (!element.comment && element.kindString === 'Accessor') {
|
|
111
|
+
const accessor = element.getSignature || element.setSignature || [];
|
|
112
|
+
element.comment = accessor[0].comment;
|
|
113
|
+
}
|
|
109
114
|
});
|
|
110
115
|
};
|
|
111
116
|
|
|
@@ -141,8 +146,9 @@ const extractMembers = (packageName, modules, config) => {
|
|
|
141
146
|
|
|
142
147
|
const models = nonEmptyModules.map(module => module
|
|
143
148
|
.children
|
|
144
|
-
.filter(child => child.
|
|
149
|
+
.filter(child => child.kindString !== "Reference")
|
|
145
150
|
.filter(child => child.name !== 'core')
|
|
151
|
+
.filter(child => !child.sources[0].fileName.includes('prosemirror'))
|
|
146
152
|
.map(child => {
|
|
147
153
|
const fullName = moduleFullName(module.name, packageName, rootModules);
|
|
148
154
|
|
|
@@ -188,7 +194,6 @@ const namespacesAsModules = data => {
|
|
|
188
194
|
const modules = [];
|
|
189
195
|
data.filter(moduleFilter).forEach(module => module
|
|
190
196
|
.children
|
|
191
|
-
.filter(child => child.flags.isExported)
|
|
192
197
|
.filter(child => child.name !== 'core')
|
|
193
198
|
.forEach(child => {
|
|
194
199
|
if (child.kindString === 'Module' && child.children) {
|
|
@@ -8,8 +8,13 @@ const utils = require('./utils');
|
|
|
8
8
|
const isConstructor = (prop) =>
|
|
9
9
|
prop.kindString && prop.kindString === 'Constructor' && isPublic(prop);
|
|
10
10
|
|
|
11
|
-
const mapConstructors = (member) =>
|
|
12
|
-
|
|
11
|
+
const mapConstructors = (member) => {
|
|
12
|
+
if (member.decorators && member.decorators.find(d => d.name === 'NgModule')) {
|
|
13
|
+
// Ignore NgModule constructors
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return utils.flatten(member.children.filter(isConstructor).map(ctr => {
|
|
13
18
|
const source = `${member.name}.constructor`;
|
|
14
19
|
|
|
15
20
|
return ctr.signatures.map((signature) => ({
|
|
@@ -19,6 +24,7 @@ const mapConstructors = (member) =>
|
|
|
19
24
|
params: types.params(signature, source)
|
|
20
25
|
}));
|
|
21
26
|
}));
|
|
27
|
+
};
|
|
22
28
|
|
|
23
29
|
module.exports = mapConstructors;
|
|
24
30
|
|
package/src/api/map-props.js
CHANGED
|
@@ -21,6 +21,7 @@ const isProp = (prop) => isPublic(prop) && !isConstructor(prop) && !isMethod(pro
|
|
|
21
21
|
const mapProps = (children, parentName) =>
|
|
22
22
|
children.filter(isProp).map(prop => {
|
|
23
23
|
let type;
|
|
24
|
+
let commentProp = prop;
|
|
24
25
|
if (prop.type) {
|
|
25
26
|
type = types.typeString(prop);
|
|
26
27
|
} else if (prop.kindString === 'Accessor') {
|
|
@@ -28,12 +29,13 @@ const mapProps = (children, parentName) =>
|
|
|
28
29
|
const setter = prop.setSignature;
|
|
29
30
|
|
|
30
31
|
// Fingers crossed
|
|
31
|
-
type = types.typeString(
|
|
32
|
-
accessor(
|
|
33
|
-
accessor(
|
|
32
|
+
type = types.typeString(setter ?
|
|
33
|
+
accessor(setter).parameters[0] :
|
|
34
|
+
accessor(getter)
|
|
34
35
|
);
|
|
35
36
|
} else if (prop.kindString === 'Method') {
|
|
36
37
|
type = types.callType(prop.signatures[0]);
|
|
38
|
+
commentProp = prop.signatures[0];
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
let name = prop.name;
|
|
@@ -53,7 +55,7 @@ const mapProps = (children, parentName) =>
|
|
|
53
55
|
name: name,
|
|
54
56
|
type: type,
|
|
55
57
|
defaultValue: defaultValue(prop),
|
|
56
|
-
comment: comment(
|
|
58
|
+
comment: comment(commentProp, parentName)
|
|
57
59
|
};
|
|
58
60
|
});
|
|
59
61
|
|
|
@@ -10,6 +10,9 @@ hbs.registerHelper('capitalize',
|
|
|
10
10
|
hbs.registerHelper('contains',
|
|
11
11
|
(s, chars, options) => (s.includes(chars) ? options.fn(s) : options.inverse(s)));
|
|
12
12
|
|
|
13
|
+
hbs.registerHelper('equals',
|
|
14
|
+
(s, comparer, options) => (s === comparer ? options.fn(s) : options.inverse(s)));
|
|
15
|
+
|
|
13
16
|
const readLocal = (src) =>
|
|
14
17
|
fs.readFileSync(path.join(__dirname, src), { encoding: 'utf-8' });
|
|
15
18
|
|
package/src/api/type-utils.js
CHANGED
|
@@ -5,7 +5,7 @@ const comment = require('./comment');
|
|
|
5
5
|
const unionTypes = (member) =>
|
|
6
6
|
member.type.types.map(type => {
|
|
7
7
|
switch (type.type) {
|
|
8
|
-
case '
|
|
8
|
+
case 'literal':
|
|
9
9
|
return `"${type.value}"`;
|
|
10
10
|
default:
|
|
11
11
|
return typeString({ type });
|
|
@@ -92,6 +92,10 @@ const INTERSECTION = ' [intersected](https://www.typescriptlang.org/docs/handboo
|
|
|
92
92
|
const singleTypeString = (type) => {
|
|
93
93
|
let suffix = '';
|
|
94
94
|
|
|
95
|
+
if (type.type === 'literal') {
|
|
96
|
+
return type.value;
|
|
97
|
+
}
|
|
98
|
+
|
|
95
99
|
if (type.type === 'intersection') {
|
|
96
100
|
return unionTypes({ type }).join(INTERSECTION);
|
|
97
101
|
}
|
|
@@ -100,7 +104,7 @@ const singleTypeString = (type) => {
|
|
|
100
104
|
const decl = type.declaration;
|
|
101
105
|
if (decl.signatures) {
|
|
102
106
|
const sig = decl.signatures[0];
|
|
103
|
-
if (decl.name === '__type' && sig.
|
|
107
|
+
if (decl.name === '__type' && sig.kindString === 'Call signature') {
|
|
104
108
|
return callType(sig);
|
|
105
109
|
}
|
|
106
110
|
} else if (decl.indexSignature) {
|
|
@@ -115,12 +119,12 @@ const singleTypeString = (type) => {
|
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
|
|
118
|
-
if (type.
|
|
119
|
-
|
|
122
|
+
if (type.type === 'array') {
|
|
123
|
+
return `${singleTypeString(type.elementType)}[]`;
|
|
120
124
|
}
|
|
121
125
|
|
|
122
|
-
if (type.
|
|
123
|
-
suffix
|
|
126
|
+
if (type.typeArguments) {
|
|
127
|
+
suffix = `<${singleTypeString(type.typeArguments[0])}>`;
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
const name = typeName(type);
|
|
@@ -135,8 +139,8 @@ const typeString = (prop) => {
|
|
|
135
139
|
return unionTypes(prop).join(' | ');
|
|
136
140
|
}
|
|
137
141
|
|
|
138
|
-
if (type.type === '
|
|
139
|
-
return `
|
|
142
|
+
if (type.type === 'literal') {
|
|
143
|
+
return `"${type.value}"`;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
return singleTypeString(prop.type);
|
package/src/api/union-page.hbs
CHANGED
package/src/linter.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { ESLint } = require('eslint');
|
|
2
|
+
|
|
3
|
+
const linter = (files, options = {}) => async function lint(done) {
|
|
4
|
+
const eslint = new ESLint(options);
|
|
5
|
+
const results = await eslint.lintFiles(files);
|
|
6
|
+
const formatter = await eslint.loadFormatter('stylish');
|
|
7
|
+
const errors = ESLint.getErrorResults(results);
|
|
8
|
+
const resultText = formatter.format(results);
|
|
9
|
+
console.log(resultText);
|
|
10
|
+
|
|
11
|
+
if (errors.length > 0) {
|
|
12
|
+
done(new Error('Lint failed.'));
|
|
13
|
+
} else {
|
|
14
|
+
done();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = linter;
|
package/test/api.js
CHANGED
|
@@ -170,6 +170,12 @@ describe('API generation', () => {
|
|
|
170
170
|
const page = unionPage(intersectionData);
|
|
171
171
|
expect(page).toContain('ColumnSortSettings [intersected](https://www.typescriptlang.org/docs/handbook/advanced-types.html#intersection-types) with { mode?: "single" | "multiple"; }');
|
|
172
172
|
});
|
|
173
|
+
|
|
174
|
+
it('formats values conatining or equaling "null"', () => {
|
|
175
|
+
const unionData = require('./type-union-operators.json');
|
|
176
|
+
const page = unionPage(unionData);
|
|
177
|
+
expect(page).toContain('`type` FilterOperator = "gt" | "gte" | "isnull" | "isnotnull" | `null`');
|
|
178
|
+
});
|
|
173
179
|
});
|
|
174
180
|
|
|
175
181
|
describe('for components', () => {
|
package/test/intersection.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": 416,
|
|
3
|
+
"name": "FilterOperator",
|
|
4
|
+
"kind": 4194304,
|
|
5
|
+
"kindString": "Type alias",
|
|
6
|
+
"flags": {},
|
|
7
|
+
"comment": {
|
|
8
|
+
"shortText": "Represents the FilterOperator type."
|
|
9
|
+
},
|
|
10
|
+
"sources": [
|
|
11
|
+
{
|
|
12
|
+
"fileName": "src/model/filter-expression.ts",
|
|
13
|
+
"line": 5,
|
|
14
|
+
"character": 12
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"type": {
|
|
18
|
+
"type": "union",
|
|
19
|
+
"types": [
|
|
20
|
+
{
|
|
21
|
+
"type": "literal",
|
|
22
|
+
"value": "gt"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "literal",
|
|
26
|
+
"value": "gte"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "literal",
|
|
30
|
+
"value": "isnull"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "literal",
|
|
34
|
+
"value": "isnotnull"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"type": "literal",
|
|
38
|
+
"value": null
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|