@itwin/build-tools 3.0.0-extension.1 → 3.1.0-dev.6
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/CHANGELOG.md +76 -1
- package/LICENSE.md +1 -1
- package/bin/betools.js +1 -1
- package/mocha-reporter/index.js +1 -1
- package/package.json +7 -8
- package/scripts/docs.js +15 -13
- package/scripts/{rush → utils}/utils.js +0 -0
- package/scripts/utils/validateTags.js +2 -0
- package/scripts/rush/audit.js +0 -100
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,81 @@
|
|
1
1
|
# Change Log - @itwin/build-tools
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Wed, 12 Jan 2022 14:52:38 GMT and should not be manually modified.
|
4
|
+
|
5
|
+
## 2.19.28
|
6
|
+
Wed, 12 Jan 2022 14:52:38 GMT
|
7
|
+
|
8
|
+
_Version update only_
|
9
|
+
|
10
|
+
## 2.19.27
|
11
|
+
Wed, 05 Jan 2022 20:07:20 GMT
|
12
|
+
|
13
|
+
_Version update only_
|
14
|
+
|
15
|
+
## 2.19.26
|
16
|
+
Wed, 08 Dec 2021 20:54:52 GMT
|
17
|
+
|
18
|
+
_Version update only_
|
19
|
+
|
20
|
+
## 2.19.25
|
21
|
+
Fri, 03 Dec 2021 20:05:49 GMT
|
22
|
+
|
23
|
+
_Version update only_
|
24
|
+
|
25
|
+
## 2.19.24
|
26
|
+
Mon, 29 Nov 2021 18:44:31 GMT
|
27
|
+
|
28
|
+
_Version update only_
|
29
|
+
|
30
|
+
## 2.19.23
|
31
|
+
Mon, 22 Nov 2021 20:41:39 GMT
|
32
|
+
|
33
|
+
_Version update only_
|
34
|
+
|
35
|
+
## 2.19.22
|
36
|
+
Wed, 17 Nov 2021 01:23:26 GMT
|
37
|
+
|
38
|
+
_Version update only_
|
39
|
+
|
40
|
+
## 2.19.21
|
41
|
+
Wed, 10 Nov 2021 10:58:24 GMT
|
42
|
+
|
43
|
+
_Version update only_
|
44
|
+
|
45
|
+
## 2.19.20
|
46
|
+
Fri, 29 Oct 2021 16:14:22 GMT
|
47
|
+
|
48
|
+
_Version update only_
|
49
|
+
|
50
|
+
## 2.19.19
|
51
|
+
Mon, 25 Oct 2021 16:16:25 GMT
|
52
|
+
|
53
|
+
_Version update only_
|
54
|
+
|
55
|
+
## 2.19.18
|
56
|
+
Thu, 21 Oct 2021 20:59:44 GMT
|
57
|
+
|
58
|
+
_Version update only_
|
59
|
+
|
60
|
+
## 2.19.17
|
61
|
+
Thu, 14 Oct 2021 21:19:43 GMT
|
62
|
+
|
63
|
+
_Version update only_
|
64
|
+
|
65
|
+
## 2.19.16
|
66
|
+
Mon, 11 Oct 2021 17:37:46 GMT
|
67
|
+
|
68
|
+
_Version update only_
|
69
|
+
|
70
|
+
## 2.19.15
|
71
|
+
Fri, 08 Oct 2021 16:44:23 GMT
|
72
|
+
|
73
|
+
_Version update only_
|
74
|
+
|
75
|
+
## 2.19.14
|
76
|
+
Fri, 01 Oct 2021 13:07:03 GMT
|
77
|
+
|
78
|
+
_Version update only_
|
4
79
|
|
5
80
|
## 2.19.13
|
6
81
|
|
package/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# MIT License
|
2
2
|
|
3
|
-
Copyright © 2017-
|
3
|
+
Copyright © 2017-2022 Bentley Systems, Incorporated. All rights reserved.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
6
|
|
package/bin/betools.js
CHANGED
@@ -107,7 +107,7 @@ function docsCommand(options) {
|
|
107
107
|
const baseUrlOpt = options.baseUrl ? ["--baseUrl", options.baseUrl] : [];
|
108
108
|
const includesOpt = options.includes ? ["--includes", options.includes] : [];
|
109
109
|
const excludesOpt = options.excludes ? ["--excludes", options.excludes] : [];
|
110
|
-
const excludesGlobOpt = options.
|
110
|
+
const excludesGlobOpt = options.excludeGlob ? ["--excludeGlob", options.excludeGlob] : [];
|
111
111
|
const indexFileOpt = options.tsIndexFile ? ["--tsIndexFile", options.tsIndexFile] : [];
|
112
112
|
const onlyJsonOpt = options.onlyJson ? ["--onlyJson"] : [];
|
113
113
|
exec(["node", path.resolve(__dirname, "../scripts/docs.js"),
|
package/mocha-reporter/index.js
CHANGED
@@ -13,7 +13,7 @@ if (debugLeaks)
|
|
13
13
|
require("wtfnode");
|
14
14
|
const path = require("path");
|
15
15
|
const fs = require("fs-extra");
|
16
|
-
const { logBuildWarning, logBuildError, failBuild } = require("../scripts/
|
16
|
+
const { logBuildWarning, logBuildError, failBuild } = require("../scripts/utils/utils");
|
17
17
|
const Base = require("mocha/lib/reporters/base");
|
18
18
|
const Spec = require("mocha/lib/reporters/spec");
|
19
19
|
const MochaJUnitReporter = require("mocha-junit-reporter");
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@itwin/build-tools",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.1.0-dev.6",
|
4
4
|
"description": "Bentley build tools",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"dependencies": {
|
23
23
|
"@microsoft/api-extractor": "7.7.3",
|
24
24
|
"chalk": "^3.0.0",
|
25
|
-
"
|
25
|
+
"cpx2": "^3.0.0",
|
26
26
|
"cross-spawn": "^7.0.1",
|
27
27
|
"fs-extra": "^8.1.0",
|
28
28
|
"glob": "^7.1.2",
|
@@ -31,16 +31,14 @@
|
|
31
31
|
"recursive-readdir": "^2.2.2",
|
32
32
|
"rimraf": "^3.0.2",
|
33
33
|
"tree-kill": "^1.2.0",
|
34
|
-
"
|
35
|
-
"typedoc": "^0.
|
36
|
-
"typedoc-plugin-external-module-name": "3.0.0",
|
37
|
-
"typedoc-plugin-internal-external": "2.1.1",
|
34
|
+
"typedoc": "^0.22.11",
|
35
|
+
"typedoc-plugin-merge-modules": "^3.0.2",
|
38
36
|
"typescript": "~4.4.0",
|
39
37
|
"wtfnode": "^0.9.1",
|
40
38
|
"yargs": "^16.0.0"
|
41
39
|
},
|
42
40
|
"devDependencies": {
|
43
|
-
"@itwin/eslint-plugin": "3.
|
41
|
+
"@itwin/eslint-plugin": "3.1.0-dev.6",
|
44
42
|
"@types/node": "14.14.31",
|
45
43
|
"eslint": "^7.11.0"
|
46
44
|
},
|
@@ -61,5 +59,6 @@
|
|
61
59
|
"lint": "eslint -f visualstudio --config package.json --no-eslintrc \"./src/**/*.ts\" 1>&2",
|
62
60
|
"test": "",
|
63
61
|
"cover": ""
|
64
|
-
}
|
62
|
+
},
|
63
|
+
"readme": "# @itwin/build-tools\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.\r\n\r\n## Description\r\n\r\nThe **@itwin/build-tools** is a package for developers to consolidate the steps for building TypeScript-based packages. The tools contained in this package are written in either Typescript or Javascript within the src/ directory, and compiled for use into the lib/ directory. As a developer package, this package has only dependencies, no devDependencies.\r\n\r\n### tsconfig-base\r\n\r\nLocation: tsconfig-base.json\\\r\nRequires build: no\r\n\r\nThis file contains common tsconfig settings across all iTwin.js packages. Packages should extend this file in their own tsconfig.json file, and then overwrite and set new properties as needed. Note that this file is different from the tsconfig.json file for this package, as that contains different settings for bentleyjs-tools only.\r\n\r\n### NPM Scripts\r\n\r\nLocation: scripts/\\\r\nRequires build: no\r\n\r\nThe following node scripts are delivered in this package's scripts folder in order to ease development of iTwin.js packages with npm scripts. These scripts may require that additional packages be installed as dependencies of your package.\r\n\r\nThe default behaviors of the scripts (without parameters) assume that the directory structure of your package mirrors the following:\r\n\r\n- root\r\n - source\r\n - test\r\n - assets\r\n - lib\r\n - package.json\r\n - tsconfig.json\r\n\r\nThe following is a list of some of the most commonly used scripts within this package:\r\n\r\n#### docs.js\r\n\r\nThis script runs a TypeDoc command, with specific parameters, to generate html TypeScript documentation as well as a json representation of the documentation to be consumed for other purposes. It includes the following parameters:\r\n\r\n- source - specify the TypeScript source directory\r\n- out - specify the directory of the html output\r\n- json - specify the directory and filename of the json output\r\n- baseUrl - specify a baseUrl to resolve modules\r\n- onlyJson - including this option will skip the html output and only output the json file\r\n- includes - directory of files to include in documentation (ex: for sample code)\r\n- excludes - name of directory, files, or file extensions to exclude.\r\n - A list can be provided using a `,` as a separator\r\n - Each of the provided to exclude is added to a glob pattern which checks all directories within the source.\r\n - i.e `--excludes=test,docs/*.md` will translate to `**/{test,docs/*.md}/**/*`\r\n\r\n#### extract.js\r\n\r\nThis is a script designed to extract sample code from test.ts files in a specific directory. The sample code should be surrounded by comments containing \"\\_\\_PUBLISH_EXTRACT_START\\_\\_\" and \"\\_\\_PUBLISH_EXTRACT_END\\_\\_\" directives.\r\n\r\n- extractDir - the path at which the sample code files are located\r\n- outDir - the path at which to output the selected code\r\n\r\n#### pseudolocalize.js\r\n\r\nThis script handles translating an English localization JSON file into a pseudoLocalization file.\r\n"
|
65
64
|
}
|
package/scripts/docs.js
CHANGED
@@ -8,7 +8,7 @@ process.env.NODE_ENV = "prod";
|
|
8
8
|
|
9
9
|
const paths = require("./config/paths");
|
10
10
|
const path = require("path");
|
11
|
-
const cpx = require("
|
11
|
+
const cpx = require("cpx2");
|
12
12
|
const fs = require("fs");
|
13
13
|
const { spawn, handleInterrupts } = require("./utils/simpleSpawn");
|
14
14
|
const { validateTags } = require("./utils/validateTags");
|
@@ -26,7 +26,6 @@ const out = (argv.out === undefined) ? paths.appDocs : argv.out;
|
|
26
26
|
const json = (argv.json === undefined) ? paths.appJsonDocs : argv.json;
|
27
27
|
|
28
28
|
const baseUrlOptions = (argv.baseUrl === undefined) ? [] : ["--baseUrl", argv.baseUrl];
|
29
|
-
console.log("Input: " + argv)
|
30
29
|
const includeOptions = (argv.includes === undefined) ? [] : ["--includes", argv.includes];
|
31
30
|
|
32
31
|
let excludeList = "**/node_modules/**/*,**/*test*/**/*";
|
@@ -35,6 +34,10 @@ if (argv.excludes !== undefined)
|
|
35
34
|
if (argv.excludeGlob !== undefined)
|
36
35
|
excludeList += "," + argv.excludeGlob;
|
37
36
|
|
37
|
+
excludeList = excludeList.replace(/,/g, ',--exclude,')
|
38
|
+
const excludeArray = excludeList.split(",");
|
39
|
+
excludeArray.unshift("--exclude");
|
40
|
+
|
38
41
|
let outputOptions = [
|
39
42
|
"--json", json
|
40
43
|
];
|
@@ -46,11 +49,14 @@ const readmeOption = (argv.readme === undefined) ? "none" : argv.readme;
|
|
46
49
|
|
47
50
|
const options = [
|
48
51
|
"--excludePrivate",
|
49
|
-
"--experimentalDecorators",
|
50
|
-
"--excludeExternals",
|
51
|
-
"--excludeNotExported",
|
52
|
-
"--ignoreCompilerErrors",
|
53
52
|
"--hideGenerator",
|
53
|
+
"--logLevel",
|
54
|
+
"Error"
|
55
|
+
];
|
56
|
+
|
57
|
+
const pluginOptions = [
|
58
|
+
"--plugin", "typedoc-plugin-merge-modules",
|
59
|
+
"--mergeModulesMergeMode", "module",
|
54
60
|
];
|
55
61
|
|
56
62
|
if (argv.name) options.push("--name", argv.name);
|
@@ -58,16 +64,12 @@ if (argv.name) options.push("--name", argv.name);
|
|
58
64
|
if (argv.theme) options.push("--theme", argv.theme);
|
59
65
|
|
60
66
|
const args = [
|
61
|
-
path.resolve(process.cwd(), source),
|
67
|
+
"--entryPointStrategy", "expand", path.resolve(process.cwd(), source),
|
62
68
|
...options,
|
63
|
-
|
69
|
+
...excludeArray,
|
64
70
|
...outputOptions,
|
65
|
-
"--mode", "modules",
|
66
71
|
"--readme", readmeOption,
|
67
|
-
|
68
|
-
"--plugin", "typedoc-plugin-external-module-name,typedoc-plugin-internal-external",
|
69
|
-
"--external-aliases", "alpha,internal",
|
70
|
-
"--internal-aliases", "UNUSED",
|
72
|
+
...pluginOptions,
|
71
73
|
...baseUrlOptions,
|
72
74
|
...includeOptions
|
73
75
|
];
|
File without changes
|
package/scripts/rush/audit.js
DELETED
@@ -1,100 +0,0 @@
|
|
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");
|
7
|
-
const path = require("path");
|
8
|
-
const { spawn } = require("child_process");
|
9
|
-
const { logBuildError, logBuildWarning, failBuild, throwAfterTimeout } = require("./utils");
|
10
|
-
|
11
|
-
const rushCommonDir = path.join(__dirname, "../../../../common/");
|
12
|
-
|
13
|
-
(async () => {
|
14
|
-
const commonTempDir = path.join(rushCommonDir, "config/rush");
|
15
|
-
|
16
|
-
// Npm audit will occasionally take minutes to respond - we believe this is just the npm registry being terrible and slow.
|
17
|
-
// We don't want this to slow down our builds though - we'd rather fail fast and try again later. So we'll just timeout after 30 seconds.
|
18
|
-
let jsonOut = {};
|
19
|
-
try {
|
20
|
-
console.time("Audit time");
|
21
|
-
jsonOut = await Promise.race([runPnpmAuditAsync(commonTempDir), throwAfterTimeout(180000, "Timed out contacting npm registry.")]);
|
22
|
-
console.timeEnd("Audit time");
|
23
|
-
console.log();
|
24
|
-
} catch (error) {
|
25
|
-
// We want to stop failing the build on transient failures and instead fail only on high/critical vulnerabilities.
|
26
|
-
logBuildWarning(error);
|
27
|
-
process.exit();
|
28
|
-
}
|
29
|
-
|
30
|
-
if (jsonOut.error) {
|
31
|
-
console.error(jsonOut.error.summary);
|
32
|
-
logBuildWarning("Rush audit failed. This may be caused by a problem with the npm audit server.");
|
33
|
-
}
|
34
|
-
|
35
|
-
// A list of temporary advisories excluded from the High and Critical list.
|
36
|
-
// Warning this should only be used as a temporary measure to avoid build failures
|
37
|
-
// for development dependencies only.
|
38
|
-
// All security issues should be addressed asap.
|
39
|
-
const excludedAdvisories = [
|
40
|
-
"GHSA-8p5q-j9m2-g8wr", // https://github.com/advisories/GHSA-8p5q-j9m2-g8wr.
|
41
|
-
"GHSA-ww39-953v-wcq6", // https://github.com/advisories/GHSA-ww39-953v-wcq6.
|
42
|
-
"GHSA-8v27-2fg9-7h62", // https://github.com/advisories/GHSA-8v27-2fg9-7h62.
|
43
|
-
"GHSA-33f9-j839-rf8h", // https://github.com/advisories/GHSA-33f9-j839-rf8h.
|
44
|
-
"GHSA-c36v-fmgq-m8hx", // https://github.com/advisories/GHSA-c36v-fmgq-m8hx.
|
45
|
-
"GHSA-4jqc-8m5r-9rpr", // https://github.com/advisories/GHSA-4jqc-8m5r-9rpr.
|
46
|
-
"GHSA-whgm-jr23-g3j9", // https://github.com/advisories/GHSA-whgm-jr23-g3j9.
|
47
|
-
];
|
48
|
-
|
49
|
-
let shouldFailBuild = false;
|
50
|
-
for (const action of jsonOut.actions) {
|
51
|
-
for (const issue of action.resolves) {
|
52
|
-
const advisory = jsonOut.advisories[issue.id];
|
53
|
-
|
54
|
-
// TODO: This path no longer resolves to a specific package in the repo. Need to figure out the best way to handle it
|
55
|
-
const mpath = issue.path; // .replace("@rush-temp", "@bentley");
|
56
|
-
|
57
|
-
const severity = advisory.severity.toUpperCase();
|
58
|
-
const message = `${severity} Security Vulnerability: ${advisory.title} in ${advisory.module_name} (from ${mpath}). See ${advisory.url} for more info.`;
|
59
|
-
|
60
|
-
// For now, we'll only treat CRITICAL and HIGH vulnerabilities as errors in CI builds.
|
61
|
-
if (!excludedAdvisories.includes(advisory.github_advisory_id) && (severity === "HIGH" || severity === "CRITICAL")) {
|
62
|
-
logBuildError(message);
|
63
|
-
shouldFailBuild = true;
|
64
|
-
} else if (excludedAdvisories.includes(advisory.github_advisory_id) || severity === "MODERATE") // Only warn on MODERATE severity items
|
65
|
-
logBuildWarning(message);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
// For some reason yarn audit can return the json without the vulnerabilities
|
70
|
-
if (undefined === jsonOut.metadata.vulnerabilities || shouldFailBuild)
|
71
|
-
failBuild();
|
72
|
-
|
73
|
-
process.exit();
|
74
|
-
})();
|
75
|
-
|
76
|
-
function runPnpmAuditAsync(cwd) {
|
77
|
-
return new Promise((resolve, reject) => {
|
78
|
-
// pnpm audit requires a package.json file so we temporarily create one and
|
79
|
-
// then delete it later
|
80
|
-
fs.writeFileSync(path.join(rushCommonDir, "config/rush/package.json"), JSON.stringify("{}", null, 2));
|
81
|
-
|
82
|
-
console.log("Running audit");
|
83
|
-
const pnpmPath = path.join(rushCommonDir, "temp/pnpm-local/node_modules/.bin/pnpm");
|
84
|
-
const child = spawn(pnpmPath, ["audit", "--json"], { cwd, shell: true });
|
85
|
-
|
86
|
-
let stdout = "";
|
87
|
-
child.stdout.on('data', (data) => {
|
88
|
-
stdout += data;
|
89
|
-
});
|
90
|
-
|
91
|
-
child.on('error', (data) => {
|
92
|
-
fs.unlinkSync(path.join(rushCommonDir, "config/rush/package.json"));
|
93
|
-
reject(data)
|
94
|
-
});
|
95
|
-
child.on('close', () => {
|
96
|
-
fs.unlinkSync(path.join(rushCommonDir, "config/rush/package.json"));
|
97
|
-
resolve(JSON.parse(stdout.trim()));
|
98
|
-
});
|
99
|
-
});
|
100
|
-
}
|