@progress/kendo-typescript-tasks 10.0.22-dev.0 → 10.0.22-dev.4

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 CHANGED
@@ -12,15 +12,13 @@ module.exports = (gulp, userConfig) => {
12
12
  const series = gulp.series;
13
13
 
14
14
  const config = merge({}, apiConfig, userConfig);
15
- const DECLARATIONS = ["typings/index.d.ts", "node_modules/@types/core-js/index.d.ts"];
15
+ const DECLARATIONS = [ "typings/index.d.ts", "node_modules/@types/core-js/index.d.ts" ];
16
16
 
17
- gulp.task('api-json', () => {
18
- return gulp.src(["src/**/*.{ts,tsx}", ...DECLARATIONS, ...(config.externalApi || [])], { "allowEmpty": true })
19
- .pipe(typedoc(config.typedoc));
20
- });
17
+ gulp.task('api-json', () => gulp.src([ "src/**/*.{ts,tsx}", ...DECLARATIONS, ...(config.externalApi || []) ], { "allowEmpty": true })
18
+ .pipe(typedoc(config.typedoc)));
21
19
 
22
20
  gulp.task('api-clean', (done) => {
23
- execSync(`rm -rf docs/api`, {stdio:[0,1,2]});
21
+ execSync(`rm -rf docs/api`, { stdio: [ 0,1,2 ] });
24
22
  done();
25
23
  });
26
24
 
@@ -31,7 +29,7 @@ module.exports = (gulp, userConfig) => {
31
29
  }));
32
30
 
33
31
  gulp.task('api-check', series('api', (done) => {
34
- execSync(`git diff --exit-code --color -- ${config.outPath}`,{stdio:[0,1,2]});
32
+ execSync(`git diff --exit-code --color -- ${config.outPath}`,{ stdio: [ 0,1,2 ] });
35
33
  done();
36
34
  }));
37
35
  };
package/gulp-tasks.js CHANGED
@@ -27,17 +27,17 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
27
27
 
28
28
  childProcess.exec(`${cmd} -p ${tsConfigPath}`, err => {
29
29
  del.sync([ 'src/**/*.ngfactory.*', 'src/**/*.ngsummary.*',
30
- 'dist/**/*.ngfactory.*', 'dist/**/*.ngsummary.*' ]);
31
- done(err)
30
+ 'dist/**/*.ngfactory.*', 'dist/**/*.ngsummary.*' ]);
31
+ done(err);
32
32
  });
33
33
  };
34
34
 
35
35
  gulp.task('check-compilation', (done) => {
36
- childProcess.execSync(`${tscPath} --noEmit`, {stdio:[0,1,2]});
37
- done()
36
+ childProcess.execSync(`${tscPath} --noEmit`, { stdio: [ 0,1,2 ] });
37
+ done();
38
38
  });
39
39
 
40
- gulp.task('lint', series('check-compilation', (done) => {
40
+ gulp.task('lint', series('check-compilation', () => {
41
41
  const program = tslint.Linter.createProgram('./tsconfig.json', '.');
42
42
 
43
43
  return gulp.src([ 'src/**/*.{ts,tsx}', 'test/**/*.{ts,tsx}', 'e2e/**/*.{ts,tsx}' ])
@@ -51,7 +51,7 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
51
51
  gulp.task('lint-docs', () => {
52
52
  const program = tslint.Linter.createProgram('./tsconfig.docs.json', '.');
53
53
 
54
- return gulp.src([ 'docs/examples/**/*.{ts,tsx}'])
54
+ return gulp.src([ 'docs/examples/**/*.{ts,tsx}' ])
55
55
  .pipe(gulpTsLint({
56
56
  formatter: 'prose',
57
57
  program: program,
@@ -68,10 +68,10 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
68
68
 
69
69
  const config = Object.assign({}, webpackConfig.dev);
70
70
  config.resolve = Object.assign({}, config.resolve, {
71
- alias: {
72
- [packageInfo.name]: process.cwd() + '/src/main'
73
- },
74
- modules: [ path.join(process.cwd(), 'node_modules') ]
71
+ alias: {
72
+ [packageInfo.name]: process.cwd() + '/src/main'
73
+ },
74
+ modules: [ path.join(process.cwd(), 'node_modules') ]
75
75
  });
76
76
 
77
77
  const webpack = commonTasks.webpack(config);
@@ -86,7 +86,7 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
86
86
  server.listen(webpackPort, host, err => {
87
87
  if (err) {
88
88
  done();
89
- throw new $.util.PluginError('webpack-dev-server', err);
89
+ throw new $.util.PluginError('webpack-dev-server', err); // eslint-disable-line no-undef
90
90
  }
91
91
  });
92
92
  });
@@ -95,5 +95,5 @@ module.exports = (gulp, libraryName, compilerPath, options, webpackConfigPath) =
95
95
  gulp.task('build-es-bundle', compile('tsconfig.es.json'));
96
96
  gulp.task('build-es2015-bundle', compile('tsconfig.es2015.json'));
97
97
  gulp.task('build-npm-bundle', compile('tsconfig.npm.json'));
98
- gulp.task('build-package', series.apply(null, ['build-npm-bundle', 'build-es-bundle', 'build-cdn', 'build-systemjs-bundle']));
99
- };
98
+ gulp.task('build-package', series([ 'build-npm-bundle', 'build-es-bundle', 'build-cdn', 'build-systemjs-bundle' ]));
99
+ };
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
- .pipe(jasmine({
12
- includeStackTrace: true
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.22-dev.0+312a5e9",
5
+ "version": "10.0.22-dev.4+28182b5",
6
6
  "author": "Telerik",
7
7
  "license": "Apache-2.0",
8
8
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  "typescript": "^3.4.5"
19
19
  },
20
20
  "dependencies": {
21
- "@progress/kendo-common-tasks": "7.9.5-dev.3+312a5e9",
21
+ "@progress/kendo-common-tasks": "7.9.5-dev.8+28182b5",
22
22
  "core-js": "^2.2.2",
23
23
  "del": "2.2.2",
24
24
  "gulp": "^4.0.0",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "312a5e97951ec3e69926d909e573bf5aafff222f"
49
+ "gitHead": "28182b56d4b5969becc7e346d5fc13ac995b0426"
50
50
  }
package/spec-bundle.js CHANGED
@@ -31,5 +31,5 @@ function requireAll(requireContext) {
31
31
  return requireContext.keys().map(requireContext);
32
32
  }
33
33
 
34
- var modules = requireAll(testContext);
34
+ let modules = requireAll(testContext); // eslint-disable-line no-unused-vars
35
35
  // requires and returns all modules that match
@@ -22,12 +22,14 @@ const findDecorator = (decorators) => ((decorators || []).find(d =>
22
22
  const decoratorProp = (prop) => (decorators) => {
23
23
  const compDecorator = findDecorator(decorators);
24
24
 
25
- if (compDecorator) {
25
+ if (compDecorator) {
26
26
  const regExp = new RegExp(`${prop}:\\s?['"](.+?)['"]`);
27
27
  const match = compDecorator.arguments.obj.match(regExp);
28
28
 
29
29
  return match ? match[1] : undefined;
30
30
  }
31
+
32
+ return undefined;
31
33
  };
32
34
 
33
35
  const selector = decoratorProp('selector');
@@ -9,7 +9,7 @@ function enumValues(member) {
9
9
  comment: comment(child),
10
10
  name: child.name
11
11
  };
12
- })
12
+ });
13
13
  }
14
14
 
15
15
  const enumTemplate = template.compileFrom('enum-page.hbs');
@@ -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);
@@ -111,7 +107,7 @@ const normalizeMembers = (members) => {
111
107
  }
112
108
  }
113
109
  });
114
- }
110
+ };
115
111
 
116
112
  const mergeComments = (root, src) => {
117
113
  if (!root.comment && src.comment) {
@@ -123,23 +119,20 @@ const mergeComments = (root, src) => {
123
119
  mergeComments(root[key], src[key]);
124
120
  }
125
121
  });
126
- }
127
-
128
- const moduleRoot = (moduleName, rootModules) => {
129
- return rootModules.includes(moduleName) ? moduleName :
130
- rootModules.find(rootModule => moduleName.indexOf(rootModule) > -1);
131
122
  };
132
123
 
124
+ const moduleRoot = (moduleName, rootModules) => (rootModules.includes(moduleName) ? moduleName :
125
+ rootModules.find(rootModule => moduleName.indexOf(rootModule) > -1));
126
+
133
127
  const moduleFullName = (moduleName, packageName, rootModules) => {
134
128
  const rootModule = moduleRoot(moduleName, rootModules);
135
129
  let fullName = packageName;
136
- if (rootModule)
137
- {
130
+ if (rootModule) {
138
131
  fullName += '_' + rootModule;
139
132
  }
140
133
 
141
134
  return fullName;
142
- }
135
+ };
143
136
 
144
137
  const extractMembers = (packageName, modules, config) => {
145
138
  const knownTypes = {};
@@ -182,7 +175,7 @@ const extractMembers = (packageName, modules, config) => {
182
175
  const members = utils.flatten(models)
183
176
  .sort(utils.nameComparer)
184
177
  .map(model => {
185
- associateTypes([model], knownTypes);
178
+ associateTypes([ model ], knownTypes);
186
179
  return model;
187
180
  });
188
181
 
@@ -227,6 +220,18 @@ const groupMembers = (members) => {
227
220
  return membersByModule;
228
221
  };
229
222
 
223
+ const packagePlatform = (packageInfo) => {
224
+ let platform = '';
225
+
226
+ if (/-angular-/.test(packageInfo.name)) {
227
+ platform = 'Angular';
228
+ } else if (/-react-/.test(packageInfo.name)) {
229
+ platform = 'React';
230
+ }
231
+
232
+ return platform;
233
+ };
234
+
230
235
  const generate = (done, config, packageInfo) => {
231
236
  const meta = require(config.jsonPath);
232
237
  const namespaces = namespacesAsModules(meta.children);
@@ -234,8 +239,7 @@ const generate = (done, config, packageInfo) => {
234
239
  const membersByModule = config.reorderModules ?
235
240
  config.reorderModules(groupMembers(members)) : groupMembers(members);
236
241
  const outPath = config.outPath;
237
- const platform = /-angular-/.test(packageInfo.name) ? 'Angular' :
238
- /-react-/.test(packageInfo.name) ? 'React' : '';
242
+ const platform = packagePlatform(packageInfo);
239
243
  const info = Object.assign({ platform }, packageInfo['@progress']);
240
244
 
241
245
  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
 
@@ -11,7 +10,6 @@ const isConstructor = (prop) =>
11
10
 
12
11
  const mapConstructors = (member) =>
13
12
  utils.flatten(member.children.filter(isConstructor).map(ctr => {
14
- const name = ctr.name;
15
13
  const source = `${member.name}.constructor`;
16
14
 
17
15
  return ctr.signatures.map((signature) => ({
@@ -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) =>
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  const path = require('path');
4
- const template = require('./template-utils');
5
4
  const componentPage = require('./component-page');
6
5
  const constantPage = require('./constant-page');
7
6
  const classPage = require('./class-page');
@@ -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
- source = `${parentName } - ${source}`;
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' });
@@ -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 => !!obj[prop];
12
+ const hasProp = prop => obj => Boolean(obj[prop]);
13
13
 
14
14
  const groupBy = (predicate, list) =>
15
15
  list.reduce((acc, item) => {
16
- const field = predicate(item);
17
- acc[field] = acc[field] || [];
18
- acc[field].push(item);
19
- return acc;
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/stub-loader.js CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module.exports = function() {
3
- return '{}';
3
+ return '{}';
4
4
  };
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=\"module-name\">\\s*${name}\\s*<\\/h2>`).test(page)).toBeTruthy();
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', () => {