@itwin/build-tools 3.0.0-dev.84 → 3.0.0-dev.85

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.
@@ -1,120 +1,120 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- const FS = require('fs-extra');
7
- const validTags = [
8
- "see",
9
- "note",
10
- "throws",
11
- "param",
12
- "module",
13
- "type",
14
- "minimum",
15
- "minlength",
16
- "default",
17
- "example",
18
- "pattern",
19
-
20
- // Following flags are added to support API-extractor (https://api-extractor.com/pages/tsdoc/syntax/#release-tags)
21
- "alpha",
22
- "beta",
23
- "deprecated",
24
- "internal",
25
- "public",
26
- ];
27
-
28
- function validateTags(path) {
29
- return parseFile(path);
30
- }
31
-
32
- function parseFile(path) {
33
- let allTags = {};
34
-
35
- if (FS.existsSync(path) && FS.statSync(path).isFile()) {
36
- const contents = FS.readFileSync(path, 'utf-8');
37
- let jsonContents = JSON.parse(contents);
38
-
39
- let tags = findValues(jsonContents, 'tags');
40
-
41
- for (let j = 0; j < tags.length; j++) {
42
- for (let i = 0; i < tags[j].length; i++)
43
- allTags[tags[j][i]['tag']] = allTags[tags[j][i]['tag']] ? allTags[tags[j][i]['tag']] + 1 : 1;
44
- }
45
-
46
- let invalidTagObjects = [];
47
- for (tag in allTags) {
48
- if (!validTags.includes(tag))
49
- invalidTagObjects.push(tag, findSource(jsonContents, 'tag', tag));
50
- }
51
- return invalidTagObjects;
52
- }
53
- }
54
-
55
- function findValues(obj, key) {
56
- return findValuesHelper(obj, key, []);
57
- }
58
-
59
- function findValuesHelper(obj, key, list) {
60
- if (!obj) return list;
61
- if (obj instanceof Array) {
62
- for (var i in obj)
63
- list = list.concat(findValuesHelper(obj[i], key, []));
64
- return list;
65
- }
66
-
67
- if (obj[key]) list.push(obj[key]);
68
-
69
- if ((typeof obj == "object") && (obj !== null)) {
70
- const children = Object.keys(obj);
71
- if (children.length > 0) {
72
- for (i = 0; i < children.length; i++)
73
- list = list.concat(findValuesHelper(obj[children[i]], key, []));
74
- }
75
- }
76
- return list;
77
- }
78
-
79
- function findSource(obj, key, value) {
80
- return findSourceHelper(obj, key, value, []);
81
- }
82
-
83
- function findSourceHelper(obj, key, value, list) {
84
- if (!obj) return list;
85
- if (obj instanceof Array) {
86
- for (var i in obj)
87
- list = list.concat(findSourceHelper(obj[i], key, value, []));
88
- return list;
89
- }
90
-
91
- //Look for tag in signature or in comment
92
- if (obj['signatures']) {
93
- if (obj['signatures'][0] && obj['signatures'][0]['comment'] && obj['signatures'][0]['comment']['tags']) {
94
- for (let tag in obj['signatures'][0]['comment']['tags']) {
95
- if (obj['signatures'][0]['comment']['tags'][tag].tag === value && obj['sources'] && obj['sources'][0])
96
- list.push(obj['sources'][0]);
97
- }
98
- }
99
- }
100
-
101
- if (obj['comment'] && obj['comment']['tags']) {
102
- for (let tag in obj['comment']['tags']) {
103
- if (obj['comment']['tags'][tag].tag === value && obj['sources'] && obj['sources'][0])
104
- list.push(obj['sources'][0]);
105
- }
106
- }
107
-
108
- if ((typeof obj == "object") && (obj !== null)) {
109
- const children = Object.keys(obj);
110
- if (children.length > 0) {
111
- for (i = 0; i < children.length; i++)
112
- list = list.concat(findSourceHelper(obj[children[i]], key, value, []));
113
- }
114
- }
115
- return list;
116
- }
117
-
118
- module.exports = {
119
- validateTags: validateTags,
120
- };
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ const FS = require('fs-extra');
7
+ const validTags = [
8
+ "see",
9
+ "note",
10
+ "throws",
11
+ "param",
12
+ "module",
13
+ "type",
14
+ "minimum",
15
+ "minlength",
16
+ "default",
17
+ "example",
18
+ "pattern",
19
+
20
+ // Following flags are added to support API-extractor (https://api-extractor.com/pages/tsdoc/syntax/#release-tags)
21
+ "alpha",
22
+ "beta",
23
+ "deprecated",
24
+ "internal",
25
+ "public",
26
+ ];
27
+
28
+ function validateTags(path) {
29
+ return parseFile(path);
30
+ }
31
+
32
+ function parseFile(path) {
33
+ let allTags = {};
34
+
35
+ if (FS.existsSync(path) && FS.statSync(path).isFile()) {
36
+ const contents = FS.readFileSync(path, 'utf-8');
37
+ let jsonContents = JSON.parse(contents);
38
+
39
+ let tags = findValues(jsonContents, 'tags');
40
+
41
+ for (let j = 0; j < tags.length; j++) {
42
+ for (let i = 0; i < tags[j].length; i++)
43
+ allTags[tags[j][i]['tag']] = allTags[tags[j][i]['tag']] ? allTags[tags[j][i]['tag']] + 1 : 1;
44
+ }
45
+
46
+ let invalidTagObjects = [];
47
+ for (tag in allTags) {
48
+ if (!validTags.includes(tag))
49
+ invalidTagObjects.push(tag, findSource(jsonContents, 'tag', tag));
50
+ }
51
+ return invalidTagObjects;
52
+ }
53
+ }
54
+
55
+ function findValues(obj, key) {
56
+ return findValuesHelper(obj, key, []);
57
+ }
58
+
59
+ function findValuesHelper(obj, key, list) {
60
+ if (!obj) return list;
61
+ if (obj instanceof Array) {
62
+ for (var i in obj)
63
+ list = list.concat(findValuesHelper(obj[i], key, []));
64
+ return list;
65
+ }
66
+
67
+ if (obj[key]) list.push(obj[key]);
68
+
69
+ if ((typeof obj == "object") && (obj !== null)) {
70
+ const children = Object.keys(obj);
71
+ if (children.length > 0) {
72
+ for (i = 0; i < children.length; i++)
73
+ list = list.concat(findValuesHelper(obj[children[i]], key, []));
74
+ }
75
+ }
76
+ return list;
77
+ }
78
+
79
+ function findSource(obj, key, value) {
80
+ return findSourceHelper(obj, key, value, []);
81
+ }
82
+
83
+ function findSourceHelper(obj, key, value, list) {
84
+ if (!obj) return list;
85
+ if (obj instanceof Array) {
86
+ for (var i in obj)
87
+ list = list.concat(findSourceHelper(obj[i], key, value, []));
88
+ return list;
89
+ }
90
+
91
+ //Look for tag in signature or in comment
92
+ if (obj['signatures']) {
93
+ if (obj['signatures'][0] && obj['signatures'][0]['comment'] && obj['signatures'][0]['comment']['tags']) {
94
+ for (let tag in obj['signatures'][0]['comment']['tags']) {
95
+ if (obj['signatures'][0]['comment']['tags'][tag].tag === value && obj['sources'] && obj['sources'][0])
96
+ list.push(obj['sources'][0]);
97
+ }
98
+ }
99
+ }
100
+
101
+ if (obj['comment'] && obj['comment']['tags']) {
102
+ for (let tag in obj['comment']['tags']) {
103
+ if (obj['comment']['tags'][tag].tag === value && obj['sources'] && obj['sources'][0])
104
+ list.push(obj['sources'][0]);
105
+ }
106
+ }
107
+
108
+ if ((typeof obj == "object") && (obj !== null)) {
109
+ const children = Object.keys(obj);
110
+ if (children.length > 0) {
111
+ for (i = 0; i < children.length; i++)
112
+ list = list.concat(findSourceHelper(obj[children[i]], key, value, []));
113
+ }
114
+ }
115
+ return list;
116
+ }
117
+
118
+ module.exports = {
119
+ validateTags: validateTags,
120
+ };
@@ -1,28 +1,28 @@
1
- {
2
- "compilerOptions": {
3
- "alwaysStrict": true,
4
- "declaration": true,
5
- "declarationMap": true,
6
- "esModuleInterop": false,
7
- "experimentalDecorators": true,
8
- "forceConsistentCasingInFileNames": true,
9
- "incremental": true,
10
- "inlineSources": true,
11
- "jsx": "react",
12
- "module": "commonjs",
13
- "moduleResolution": "node",
14
- "noFallthroughCasesInSwitch": false,
15
- "noImplicitAny": true,
16
- "noImplicitOverride": true,
17
- "noImplicitReturns": true,
18
- "noImplicitThis": true,
19
- "noUnusedLocals": false,
20
- "noUnusedParameters": true,
21
- "skipLibCheck": true,
22
- "sourceMap": true,
23
- "strict": true,
24
- "strictNullChecks": true,
25
- "stripInternal": false,
26
- "target": "ES2019"
27
- }
1
+ {
2
+ "compilerOptions": {
3
+ "alwaysStrict": true,
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "esModuleInterop": false,
7
+ "experimentalDecorators": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "incremental": true,
10
+ "inlineSources": true,
11
+ "jsx": "react",
12
+ "module": "commonjs",
13
+ "moduleResolution": "node",
14
+ "noFallthroughCasesInSwitch": false,
15
+ "noImplicitAny": true,
16
+ "noImplicitOverride": true,
17
+ "noImplicitReturns": true,
18
+ "noImplicitThis": true,
19
+ "noUnusedLocals": false,
20
+ "noUnusedParameters": true,
21
+ "skipLibCheck": true,
22
+ "sourceMap": true,
23
+ "strict": true,
24
+ "strictNullChecks": true,
25
+ "stripInternal": false,
26
+ "target": "ES2019"
27
+ }
28
28
  }
package/tsconfig.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "extends": "./tsconfig-base.json",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "declarationMap": false,
6
- "sourceMap": false,
7
- "inlineSources": false,
8
- "incremental": false,
9
- "rootDir": "./src",
10
- "outDir": "." // We want the files to be accessible within a directory at the root alongside the scripts directory
11
- },
12
- "include": [
13
- "./src/**/*.ts"
14
- ],
15
- "exclude": [
16
- "lib",
17
- "node_modules"
18
- ]
19
- }
1
+ {
2
+ "extends": "./tsconfig-base.json",
3
+ "compilerOptions": {
4
+ "declaration": false,
5
+ "declarationMap": false,
6
+ "sourceMap": false,
7
+ "inlineSources": false,
8
+ "incremental": false,
9
+ "rootDir": "./src",
10
+ "outDir": "." // We want the files to be accessible within a directory at the root alongside the scripts directory
11
+ },
12
+ "include": [
13
+ "./src/**/*.ts"
14
+ ],
15
+ "exclude": [
16
+ "lib",
17
+ "node_modules"
18
+ ]
19
+ }