@progress/kendo-typescript-tasks 10.0.21-ng12.37 → 10.0.21-ng12.38
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.js +3 -3
- package/gulp-tasks.js +11 -11
- package/gulpfile.js +3 -6
- package/package.json +3 -3
- package/spec-bundle.js +1 -1
- package/src/api/component-page.js +2 -0
- package/src/api/enum-page.js +1 -1
- package/src/api/generator.js +25 -21
- package/src/api/map-constructors.js +0 -2
- package/src/api/map-props.js +1 -1
- package/src/api/member-page.js +0 -1
- package/src/api/return-type.js +1 -1
- package/src/api/template-utils.js +1 -1
- package/src/api/type-utils.js +2 -2
- package/src/api/utils.js +6 -6
- package/src/linter.js +2 -2
- package/stub-loader.js +1 -1
- package/test/api.js +8 -8
package/api.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = (gulp, userConfig) => {
|
|
|
14
14
|
|
|
15
15
|
const config = merge({}, apiConfig, userConfig);
|
|
16
16
|
|
|
17
|
-
gulp.task('api-json', async
|
|
17
|
+
gulp.task('api-json', async(done) => {
|
|
18
18
|
const entryPoints = [
|
|
19
19
|
...glob.sync("src/**/*.{ts,tsx}"),
|
|
20
20
|
...(config.externalApi || [])
|
|
@@ -40,7 +40,7 @@ module.exports = (gulp, userConfig) => {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
gulp.task('api-clean', (done) => {
|
|
43
|
-
execSync(`rm -rf docs/api`, {stdio:[0,1,2]});
|
|
43
|
+
execSync(`rm -rf docs/api`, { stdio: [ 0,1,2 ] });
|
|
44
44
|
done();
|
|
45
45
|
});
|
|
46
46
|
|
|
@@ -51,7 +51,7 @@ module.exports = (gulp, userConfig) => {
|
|
|
51
51
|
}));
|
|
52
52
|
|
|
53
53
|
gulp.task('api-check', series('api', (done) => {
|
|
54
|
-
execSync(`git diff --exit-code --color -- ${config.outPath}`,{stdio:[0,1,2]});
|
|
54
|
+
execSync(`git diff --exit-code --color -- ${config.outPath}`,{ stdio: [ 0,1,2 ] });
|
|
55
55
|
done();
|
|
56
56
|
}));
|
|
57
57
|
};
|
package/gulp-tasks.js
CHANGED
|
@@ -26,14 +26,14 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
|
|
|
26
26
|
|
|
27
27
|
childProcess.exec(`${cmd} -p ${tsConfigPath}`, err => {
|
|
28
28
|
del.sync([ 'src/**/*.ngfactory.*', 'src/**/*.ngsummary.*',
|
|
29
|
-
|
|
30
|
-
done(err)
|
|
29
|
+
'dist/**/*.ngfactory.*', 'dist/**/*.ngsummary.*' ]);
|
|
30
|
+
done(err);
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
gulp.task('check-compilation', (done) => {
|
|
35
|
-
childProcess.execSync(`${tscPath} --noEmit`, {stdio:[0,1,2]});
|
|
36
|
-
done()
|
|
35
|
+
childProcess.execSync(`${tscPath} --noEmit`, { stdio: [ 0,1,2 ] });
|
|
36
|
+
done();
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
gulp.task('lint', series(
|
|
@@ -53,10 +53,10 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
|
|
|
53
53
|
|
|
54
54
|
const config = Object.assign({}, webpackConfig.dev);
|
|
55
55
|
config.resolve = Object.assign({}, config.resolve, {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
alias: {
|
|
57
|
+
[packageInfo.name]: process.cwd() + '/src/main'
|
|
58
|
+
},
|
|
59
|
+
modules: [ path.join(process.cwd(), 'node_modules') ]
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
const webpack = commonTasks.webpack(config);
|
|
@@ -71,7 +71,7 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
|
|
|
71
71
|
server.listen(webpackPort, host, err => {
|
|
72
72
|
if (err) {
|
|
73
73
|
done();
|
|
74
|
-
throw new $.util.PluginError('webpack-dev-server', err);
|
|
74
|
+
throw new $.util.PluginError('webpack-dev-server', err); // eslint-disable-line no-undef
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
});
|
|
@@ -80,5 +80,5 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
|
|
|
80
80
|
gulp.task('build-es-bundle', compile('tsconfig.es.json'));
|
|
81
81
|
gulp.task('build-es2015-bundle', compile('tsconfig.es2015.json'));
|
|
82
82
|
gulp.task('build-npm-bundle', compile('tsconfig.npm.json'));
|
|
83
|
-
gulp.task('build-package', series
|
|
84
|
-
|
|
83
|
+
gulp.task('build-package', series([ 'build-npm-bundle', 'build-es-bundle', 'build-cdn', 'build-systemjs-bundle' ]));
|
|
84
|
+
};
|
package/gulpfile.js
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
const gulp = require('gulp');
|
|
4
4
|
const jasmine = require('gulp-jasmine');
|
|
5
5
|
|
|
6
|
-
// kendo-common-task linter is ancient, skip it for now
|
|
7
|
-
gulp.task('lint', (done) => done());
|
|
8
|
-
|
|
9
6
|
gulp.task('test', () =>
|
|
10
7
|
gulp.src('test/**/*.js')
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
.pipe(jasmine({
|
|
9
|
+
includeStackTrace: true
|
|
10
|
+
}))
|
|
14
11
|
);
|
|
15
12
|
|
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.21-ng12.
|
|
5
|
+
"version": "10.0.21-ng12.38+e004129",
|
|
6
6
|
"author": "Telerik",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"scripts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"typescript": "^4.3.4"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@progress/kendo-common-tasks": "7.9.5-ng12.
|
|
21
|
+
"@progress/kendo-common-tasks": "7.9.5-ng12.38+e004129",
|
|
22
22
|
"@typescript-eslint/eslint-plugin": "4.28.2",
|
|
23
23
|
"@typescript-eslint/parser": "4.28.2",
|
|
24
24
|
"core-js": "^3.18.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e004129f16f1f60aeff1f0c7b876f4f886b05927"
|
|
52
52
|
}
|
package/spec-bundle.js
CHANGED
|
@@ -31,5 +31,5 @@ function requireAll(requireContext) {
|
|
|
31
31
|
return requireContext.keys().map(requireContext);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
let modules = requireAll(testContext); // eslint-disable-line no-unused-vars
|
|
35
35
|
// requires and returns all modules that match
|
package/src/api/enum-page.js
CHANGED
package/src/api/generator.js
CHANGED
|
@@ -71,7 +71,7 @@ const associateTypes = (elements, knownTypes) => {
|
|
|
71
71
|
traverseElements(elements, element => {
|
|
72
72
|
addTypeSlug(element, knownTypes);
|
|
73
73
|
});
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
|
|
76
76
|
const normalizeUnionReferences = (element, members) => {
|
|
77
77
|
if (element.kind === 'union') {
|
|
@@ -79,19 +79,17 @@ const normalizeUnionReferences = (element, members) => {
|
|
|
79
79
|
for (let idx = types.length - 1; idx >= 0; idx--) {
|
|
80
80
|
const type = types[idx];
|
|
81
81
|
if (type.type === 'reference') {
|
|
82
|
-
const unionReference = members.find((child) =>
|
|
83
|
-
return child.name === type.name;
|
|
84
|
-
});
|
|
82
|
+
const unionReference = members.find((child) => child.name === type.name);
|
|
85
83
|
|
|
86
84
|
if (unionReference && unionReference.kind === 'union') {
|
|
87
85
|
normalizeUnionReferences(unionReference, members);
|
|
88
86
|
const toReplace = unionReference.type.types;
|
|
89
|
-
types.splice.apply(types, [idx, 1].concat(toReplace));
|
|
87
|
+
types.splice.apply(types, [ idx, 1 ].concat(toReplace));
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
|
-
}
|
|
92
|
+
};
|
|
95
93
|
|
|
96
94
|
const normalizeMembers = (members) => {
|
|
97
95
|
traverseElements(members, (element) => {
|
|
@@ -99,9 +97,7 @@ const normalizeMembers = (members) => {
|
|
|
99
97
|
|
|
100
98
|
if (!element.comment && element.implementationOf) {
|
|
101
99
|
const interfaceName = element.implementationOf.name.split('.')[0];
|
|
102
|
-
const interfaceOptions = members.find((child) =>
|
|
103
|
-
return child.name === interfaceName;
|
|
104
|
-
});
|
|
100
|
+
const interfaceOptions = members.find((child) => child.name === interfaceName);
|
|
105
101
|
|
|
106
102
|
if (interfaceOptions) {
|
|
107
103
|
const baseOption = interfaceOptions.children.find(child => child.name === element.name);
|
|
@@ -116,7 +112,7 @@ const normalizeMembers = (members) => {
|
|
|
116
112
|
element.comment = accessor[0].comment;
|
|
117
113
|
}
|
|
118
114
|
});
|
|
119
|
-
}
|
|
115
|
+
};
|
|
120
116
|
|
|
121
117
|
const mergeComments = (root, src) => {
|
|
122
118
|
if (!root.comment && src.comment) {
|
|
@@ -128,23 +124,20 @@ const mergeComments = (root, src) => {
|
|
|
128
124
|
mergeComments(root[key], src[key]);
|
|
129
125
|
}
|
|
130
126
|
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const moduleRoot = (moduleName, rootModules) => {
|
|
134
|
-
return rootModules.includes(moduleName) ? moduleName :
|
|
135
|
-
rootModules.find(rootModule => moduleName.indexOf(rootModule) > -1);
|
|
136
127
|
};
|
|
137
128
|
|
|
129
|
+
const moduleRoot = (moduleName, rootModules) => (rootModules.includes(moduleName) ? moduleName :
|
|
130
|
+
rootModules.find(rootModule => moduleName.indexOf(rootModule) > -1));
|
|
131
|
+
|
|
138
132
|
const moduleFullName = (moduleName, packageName, rootModules) => {
|
|
139
133
|
const rootModule = moduleRoot(moduleName, rootModules);
|
|
140
134
|
let fullName = packageName;
|
|
141
|
-
if (rootModule)
|
|
142
|
-
{
|
|
135
|
+
if (rootModule) {
|
|
143
136
|
fullName += '_' + rootModule;
|
|
144
137
|
}
|
|
145
138
|
|
|
146
139
|
return fullName;
|
|
147
|
-
}
|
|
140
|
+
};
|
|
148
141
|
|
|
149
142
|
const extractMembers = (packageName, modules, config) => {
|
|
150
143
|
const knownTypes = {};
|
|
@@ -187,7 +180,7 @@ const extractMembers = (packageName, modules, config) => {
|
|
|
187
180
|
const members = utils.flatten(models)
|
|
188
181
|
.sort(utils.nameComparer)
|
|
189
182
|
.map(model => {
|
|
190
|
-
associateTypes([model], knownTypes);
|
|
183
|
+
associateTypes([ model ], knownTypes);
|
|
191
184
|
return model;
|
|
192
185
|
});
|
|
193
186
|
|
|
@@ -231,6 +224,18 @@ const groupMembers = (members) => {
|
|
|
231
224
|
return membersByModule;
|
|
232
225
|
};
|
|
233
226
|
|
|
227
|
+
const packagePlatform = (packageInfo) => {
|
|
228
|
+
let platform = '';
|
|
229
|
+
|
|
230
|
+
if (/-angular-/.test(packageInfo.name)) {
|
|
231
|
+
platform = 'Angular';
|
|
232
|
+
} else if (/-react-/.test(packageInfo.name)) {
|
|
233
|
+
platform = 'React';
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return platform;
|
|
237
|
+
};
|
|
238
|
+
|
|
234
239
|
const generate = (done, config, packageInfo) => {
|
|
235
240
|
const meta = require(config.jsonPath);
|
|
236
241
|
const namespaces = namespacesAsModules(meta.children);
|
|
@@ -238,8 +243,7 @@ const generate = (done, config, packageInfo) => {
|
|
|
238
243
|
const membersByModule = config.reorderModules ?
|
|
239
244
|
config.reorderModules(groupMembers(members)) : groupMembers(members);
|
|
240
245
|
const outPath = config.outPath;
|
|
241
|
-
const platform =
|
|
242
|
-
/-react-/.test(packageInfo.name) ? 'React' : '';
|
|
246
|
+
const platform = packagePlatform(packageInfo);
|
|
243
247
|
const info = Object.assign({ platform }, packageInfo['@progress']);
|
|
244
248
|
|
|
245
249
|
writeFile(`${outPath}/index.md`, indexPage(packageInfo.name, membersByModule, info));
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const comment = require('./comment');
|
|
4
4
|
const isPublic = require('./is-public');
|
|
5
|
-
const isInput = require('./is-input');
|
|
6
5
|
const types = require('./type-utils');
|
|
7
6
|
const utils = require('./utils');
|
|
8
7
|
|
|
@@ -16,7 +15,6 @@ const mapConstructors = (member) => {
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
return utils.flatten(member.children.filter(isConstructor).map(ctr => {
|
|
19
|
-
const name = ctr.name;
|
|
20
18
|
const source = `${member.name}.constructor`;
|
|
21
19
|
|
|
22
20
|
return ctr.signatures.map((signature) => ({
|
package/src/api/map-props.js
CHANGED
|
@@ -15,7 +15,7 @@ const defaultValue = prop => {
|
|
|
15
15
|
return text && ` (default: ${text.trim()})`;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const accessor = signature => Array.isArray(signature) ? signature[0] : signature;
|
|
18
|
+
const accessor = signature => (Array.isArray(signature) ? signature[0] : signature);
|
|
19
19
|
|
|
20
20
|
const isProp = (prop) => isPublic(prop) && !isConstructor(prop) && !isMethod(prop);
|
|
21
21
|
const mapProps = (children, parentName) =>
|
package/src/api/member-page.js
CHANGED
package/src/api/return-type.js
CHANGED
|
@@ -16,7 +16,7 @@ const returnType = (definition, parentName) => {
|
|
|
16
16
|
if (!comment && definition.type.name !== 'void') {
|
|
17
17
|
let source = `${definition.name}`;
|
|
18
18
|
if (parentName) {
|
|
19
|
-
|
|
19
|
+
source = `${parentName } - ${source}`;
|
|
20
20
|
}
|
|
21
21
|
utils.warn('Undocumented return type', source);
|
|
22
22
|
}
|
|
@@ -8,7 +8,7 @@ hbs.registerHelper('capitalize',
|
|
|
8
8
|
s => s.slice(0,1).toUpperCase() + s.slice(1));
|
|
9
9
|
|
|
10
10
|
hbs.registerHelper('contains',
|
|
11
|
-
(s, chars, options) => s.includes(chars) ? options.fn(s) : options.inverse(s));
|
|
11
|
+
(s, chars, options) => (s.includes(chars) ? options.fn(s) : options.inverse(s)));
|
|
12
12
|
|
|
13
13
|
const readLocal = (src) =>
|
|
14
14
|
fs.readFileSync(path.join(__dirname, src), { encoding: 'utf-8' });
|
package/src/api/type-utils.js
CHANGED
|
@@ -118,7 +118,7 @@ const singleTypeString = (type) => {
|
|
|
118
118
|
if (type.typeArguments) {
|
|
119
119
|
suffix = `<${singleTypeString(type.typeArguments[0])}>`;
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
if (type.type === 'array') {
|
|
123
123
|
suffix += '[]';
|
|
124
124
|
}
|
|
@@ -153,7 +153,7 @@ const fullName = (member) => {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
return member.name + suffix;
|
|
156
|
-
}
|
|
156
|
+
};
|
|
157
157
|
|
|
158
158
|
module.exports = {
|
|
159
159
|
callSignature: callSignature,
|
package/src/api/utils.js
CHANGED
|
@@ -9,15 +9,15 @@ const not = predicate => member => !predicate(member);
|
|
|
9
9
|
|
|
10
10
|
const ignore = predicate => props => (props || []).filter(predicate);
|
|
11
11
|
|
|
12
|
-
const hasProp = prop => obj =>
|
|
12
|
+
const hasProp = prop => obj => Boolean(obj[prop]);
|
|
13
13
|
|
|
14
14
|
const groupBy = (predicate, list) =>
|
|
15
15
|
list.reduce((acc, item) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, {})
|
|
16
|
+
const field = predicate(item);
|
|
17
|
+
acc[field] = acc[field] || [];
|
|
18
|
+
acc[field].push(item);
|
|
19
|
+
return acc;
|
|
20
|
+
}, {});
|
|
21
21
|
|
|
22
22
|
const WARNINGS = [];
|
|
23
23
|
const warn = (type, text) => {
|
package/src/linter.js
CHANGED
|
@@ -4,7 +4,7 @@ const linter = (files, options = {}) => async function lint(done) {
|
|
|
4
4
|
const eslint = new ESLint(options);
|
|
5
5
|
const results = await eslint.lintFiles(files);
|
|
6
6
|
const formatter = await eslint.loadFormatter('stylish');
|
|
7
|
-
const errors = ESLint.getErrorResults(results)
|
|
7
|
+
const errors = ESLint.getErrorResults(results);
|
|
8
8
|
const resultText = formatter.format(results);
|
|
9
9
|
console.log(resultText);
|
|
10
10
|
|
|
@@ -13,6 +13,6 @@ const linter = (files, options = {}) => async function lint(done) {
|
|
|
13
13
|
} else {
|
|
14
14
|
done();
|
|
15
15
|
}
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
|
|
18
18
|
module.exports = linter;
|
package/stub-loader.js
CHANGED
package/test/api.js
CHANGED
|
@@ -51,7 +51,7 @@ describe('API generation', () => {
|
|
|
51
51
|
|
|
52
52
|
describe('for modules', () => {
|
|
53
53
|
const pkg = require('./package.json');
|
|
54
|
-
const members = generator.extractMembers(pkg.name, pkg.children, { modules: ['module1'] });
|
|
54
|
+
const members = generator.extractMembers(pkg.name, pkg.children, { modules: [ 'module1' ] });
|
|
55
55
|
|
|
56
56
|
it('adds module to slug', () => {
|
|
57
57
|
expect(members[0].slug).toEqual('api_package-name_module1_foo');
|
|
@@ -325,22 +325,22 @@ describe('API generation', () => {
|
|
|
325
325
|
describe('index', () => {
|
|
326
326
|
const page = indexPage('foo/bar', {
|
|
327
327
|
'': {
|
|
328
|
-
'Function': [{
|
|
328
|
+
'Function': [ {
|
|
329
329
|
'slug': 'root-f',
|
|
330
330
|
'name': 'root-f'
|
|
331
|
-
}]
|
|
331
|
+
} ]
|
|
332
332
|
},
|
|
333
333
|
'a': {
|
|
334
|
-
'Function': [{
|
|
334
|
+
'Function': [ {
|
|
335
335
|
'slug': 'a-f',
|
|
336
336
|
'name': 'a-f'
|
|
337
|
-
}]
|
|
337
|
+
} ]
|
|
338
338
|
},
|
|
339
339
|
'b': {
|
|
340
|
-
'Function': [{
|
|
340
|
+
'Function': [ {
|
|
341
341
|
'slug': 'b-f',
|
|
342
342
|
'name': 'b-f'
|
|
343
|
-
}]
|
|
343
|
+
} ]
|
|
344
344
|
}
|
|
345
345
|
}, {
|
|
346
346
|
friendlyName: 'Foo',
|
|
@@ -348,7 +348,7 @@ describe('API generation', () => {
|
|
|
348
348
|
});
|
|
349
349
|
|
|
350
350
|
const assertModule = name => {
|
|
351
|
-
expect(new RegExp(`<h2 class
|
|
351
|
+
expect(new RegExp(`<h2 class="module-name">\\s*${name}\\s*<\\/h2>`).test(page)).toBeTruthy();
|
|
352
352
|
};
|
|
353
353
|
|
|
354
354
|
it('renders default group', () => {
|