@itwin/build-tools 3.5.0-dev.8 → 3.5.1
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 +72 -1
- package/ThirdPartyNotices.md +24 -0
- package/mocha-reporter/index.js +97 -97
- package/package.json +3 -4
- package/scripts/extract.js +1 -1
- package/scripts/utils/recursiveReaddir.js +96 -0
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,77 @@
|
|
1
1
|
# Change Log - @itwin/build-tools
|
2
2
|
|
3
|
-
This log was last generated on Thu,
|
3
|
+
This log was last generated on Thu, 15 Dec 2022 16:38:28 GMT and should not be manually modified.
|
4
|
+
|
5
|
+
## 3.5.1
|
6
|
+
Thu, 15 Dec 2022 16:38:28 GMT
|
7
|
+
|
8
|
+
_Version update only_
|
9
|
+
|
10
|
+
## 3.5.0
|
11
|
+
Wed, 07 Dec 2022 19:12:36 GMT
|
12
|
+
|
13
|
+
_Version update only_
|
14
|
+
|
15
|
+
## 3.4.7
|
16
|
+
Wed, 30 Nov 2022 14:28:19 GMT
|
17
|
+
|
18
|
+
_Version update only_
|
19
|
+
|
20
|
+
## 3.4.6
|
21
|
+
Tue, 22 Nov 2022 14:24:19 GMT
|
22
|
+
|
23
|
+
_Version update only_
|
24
|
+
|
25
|
+
## 3.4.5
|
26
|
+
Thu, 17 Nov 2022 21:32:50 GMT
|
27
|
+
|
28
|
+
_Version update only_
|
29
|
+
|
30
|
+
## 3.4.4
|
31
|
+
Thu, 10 Nov 2022 19:32:17 GMT
|
32
|
+
|
33
|
+
_Version update only_
|
34
|
+
|
35
|
+
## 3.4.3
|
36
|
+
Fri, 28 Oct 2022 13:34:57 GMT
|
37
|
+
|
38
|
+
### Updates
|
39
|
+
|
40
|
+
- Replace use of recursive-readdir package with local implementation
|
41
|
+
|
42
|
+
## 3.4.2
|
43
|
+
Mon, 24 Oct 2022 13:23:45 GMT
|
44
|
+
|
45
|
+
_Version update only_
|
46
|
+
|
47
|
+
## 3.4.1
|
48
|
+
Mon, 17 Oct 2022 20:06:51 GMT
|
49
|
+
|
50
|
+
_Version update only_
|
51
|
+
|
52
|
+
## 3.4.0
|
53
|
+
Thu, 13 Oct 2022 20:24:47 GMT
|
54
|
+
|
55
|
+
### Updates
|
56
|
+
|
57
|
+
- Use Rush env variable to find root monorepo path
|
58
|
+
- Updated Node types declaration to support latest v16
|
59
|
+
- Update mocha-junit-reporter to v2.0.2
|
60
|
+
|
61
|
+
## 3.3.5
|
62
|
+
Tue, 27 Sep 2022 11:50:59 GMT
|
63
|
+
|
64
|
+
_Version update only_
|
65
|
+
|
66
|
+
## 3.3.4
|
67
|
+
Thu, 08 Sep 2022 19:00:04 GMT
|
68
|
+
|
69
|
+
_Version update only_
|
70
|
+
|
71
|
+
## 3.3.3
|
72
|
+
Tue, 06 Sep 2022 20:54:19 GMT
|
73
|
+
|
74
|
+
_Version update only_
|
4
75
|
|
5
76
|
## 3.3.2
|
6
77
|
Thu, 01 Sep 2022 14:37:22 GMT
|
package/ThirdPartyNotices.md
CHANGED
@@ -13,3 +13,27 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
13
13
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
16
|
+
|
17
|
+
## [recursive-readdir](https://github.com/jergason/recursive-readdir)
|
18
|
+
|
19
|
+
The MIT License (MIT)
|
20
|
+
|
21
|
+
Copyright (c) \<year> \<copyright holders>
|
22
|
+
|
23
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
24
|
+
of this software and associated documentation files (the "Software"), to deal
|
25
|
+
in the Software without restriction, including without limitation the rights
|
26
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
27
|
+
copies of the Software, and to permit persons to whom the Software is
|
28
|
+
furnished to do so, subject to the following conditions:
|
29
|
+
|
30
|
+
The above copyright notice and this permission notice shall be included in
|
31
|
+
all copies or substantial portions of the Software.
|
32
|
+
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
34
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
35
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
36
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
37
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
38
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
39
|
+
THE SOFTWARE.
|
package/mocha-reporter/index.js
CHANGED
@@ -1,97 +1,97 @@
|
|
1
|
-
"use strict";
|
2
|
-
var _a, _b;
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
/*---------------------------------------------------------------------------------------------
|
5
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
6
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
7
|
-
*--------------------------------------------------------------------------------------------*/
|
8
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
9
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
10
|
-
/* eslint-disable no-console */
|
11
|
-
const debugLeaks = process.env.DEBUG_LEAKS;
|
12
|
-
if (debugLeaks)
|
13
|
-
require("wtfnode");
|
14
|
-
const path = require("path");
|
15
|
-
const fs = require("fs-extra");
|
16
|
-
const { logBuildWarning, logBuildError, failBuild } = require("../scripts/utils/utils");
|
17
|
-
const Base = require("mocha/lib/reporters/base");
|
18
|
-
const Spec = require("mocha/lib/reporters/spec");
|
19
|
-
const MochaJUnitReporter = require("mocha-junit-reporter");
|
20
|
-
function withStdErr(callback) {
|
21
|
-
const originalConsoleLog = Base.consoleLog;
|
22
|
-
Base.consoleLog = console.error;
|
23
|
-
callback();
|
24
|
-
Base.consoleLog = originalConsoleLog;
|
25
|
-
}
|
26
|
-
const isCI = process.env.CI || process.env.TF_BUILD;
|
27
|
-
// Force rush test to fail CI builds if describe.only or it.only is used.
|
28
|
-
// These should only be used for debugging and must not be committed, otherwise we may be accidentally skipping lots of tests.
|
29
|
-
if (isCI) {
|
30
|
-
if (typeof (mocha) !== "undefined")
|
31
|
-
mocha.forbidOnly();
|
32
|
-
else
|
33
|
-
require.cache[require.resolve("mocha/lib/mocharc.json", { paths: (_b = (_a = require.main) === null || _a === void 0 ? void 0 : _a.paths) !== null && _b !== void 0 ? _b : module.paths })].exports.forbidOnly = true;
|
34
|
-
}
|
35
|
-
// This is necessary to enable colored output when running in rush test:
|
36
|
-
Object.defineProperty(Base, "color", {
|
37
|
-
get: () => process.env.FORCE_COLOR !== "false" && process.env.FORCE_COLOR !== "0",
|
38
|
-
set: () => { },
|
39
|
-
});
|
40
|
-
class BentleyMochaReporter extends Spec {
|
41
|
-
constructor(_runner, _options) {
|
42
|
-
super(...arguments);
|
43
|
-
this._junitReporter = new MochaJUnitReporter(...arguments);
|
44
|
-
}
|
45
|
-
epilogue(...args) {
|
46
|
-
// Force test errors to be printed to stderr instead of stdout.
|
47
|
-
// This will allow rush to correctly summarize test failure when running rush test.
|
48
|
-
if (this.stats.failures) {
|
49
|
-
withStdErr(() => super.epilogue(...args));
|
50
|
-
}
|
51
|
-
else {
|
52
|
-
super.epilogue(...args);
|
53
|
-
if (0 === this.stats.passes) {
|
54
|
-
logBuildError("There were 0 passing tests. That doesn't seem right."
|
55
|
-
+ "\nIf there are really no passing tests and no failures, then what was even the point?"
|
56
|
-
+ "\nIt seems likely that tests were skipped by it.only, it.skip, or grep filters, so I'm going to fail now.");
|
57
|
-
failBuild();
|
58
|
-
}
|
59
|
-
}
|
60
|
-
// Detect hangs caused by tests that leave timers/other handles open - not possible in electron frontends.
|
61
|
-
if (!("electron" in process.versions)) {
|
62
|
-
// NB: By calling unref() on this timer, we stop it from keeping the process alive, so it will only fire if _something else_ is still keeping
|
63
|
-
// the process alive after 5 seconds. This also has the benefit of preventing the timer from showing up in wtfnode's dump of open handles.
|
64
|
-
setTimeout(() => {
|
65
|
-
logBuildError(`Handle leak detected. Node was still running 5 seconds after tests completed.`);
|
66
|
-
if (debugLeaks) {
|
67
|
-
const wtf = require("wtfnode");
|
68
|
-
wtf.setLogger("info", console.error);
|
69
|
-
wtf.dump();
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
console.error("Try running with the DEBUG_LEAKS env var set to see open handles.");
|
73
|
-
}
|
74
|
-
// Not sure why, but process.exit(1) wasn't working here...
|
75
|
-
process.kill(process.pid);
|
76
|
-
}, 5000).unref();
|
77
|
-
}
|
78
|
-
if (!this.stats.pending)
|
79
|
-
return;
|
80
|
-
// Also log warnings in CI builds when tests have been skipped.
|
81
|
-
const currentPkgJson = path.join(process.cwd(), "package.json");
|
82
|
-
if (fs.existsSync(currentPkgJson)) {
|
83
|
-
const currentPackage = require(currentPkgJson).name;
|
84
|
-
if (this.stats.pending === 1)
|
85
|
-
logBuildWarning(`1 test skipped in ${currentPackage}`);
|
86
|
-
else
|
87
|
-
logBuildWarning(`${this.stats.pending} tests skipped in ${currentPackage}`);
|
88
|
-
}
|
89
|
-
else {
|
90
|
-
if (this.stats.pending === 1)
|
91
|
-
logBuildWarning(`1 test skipped`);
|
92
|
-
else
|
93
|
-
logBuildWarning(`${this.stats.pending} tests skipped`);
|
94
|
-
}
|
95
|
-
}
|
96
|
-
}
|
97
|
-
module.exports = BentleyMochaReporter;
|
1
|
+
"use strict";
|
2
|
+
var _a, _b;
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
8
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
9
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
10
|
+
/* eslint-disable no-console */
|
11
|
+
const debugLeaks = process.env.DEBUG_LEAKS;
|
12
|
+
if (debugLeaks)
|
13
|
+
require("wtfnode");
|
14
|
+
const path = require("path");
|
15
|
+
const fs = require("fs-extra");
|
16
|
+
const { logBuildWarning, logBuildError, failBuild } = require("../scripts/utils/utils");
|
17
|
+
const Base = require("mocha/lib/reporters/base");
|
18
|
+
const Spec = require("mocha/lib/reporters/spec");
|
19
|
+
const MochaJUnitReporter = require("mocha-junit-reporter");
|
20
|
+
function withStdErr(callback) {
|
21
|
+
const originalConsoleLog = Base.consoleLog;
|
22
|
+
Base.consoleLog = console.error;
|
23
|
+
callback();
|
24
|
+
Base.consoleLog = originalConsoleLog;
|
25
|
+
}
|
26
|
+
const isCI = process.env.CI || process.env.TF_BUILD;
|
27
|
+
// Force rush test to fail CI builds if describe.only or it.only is used.
|
28
|
+
// These should only be used for debugging and must not be committed, otherwise we may be accidentally skipping lots of tests.
|
29
|
+
if (isCI) {
|
30
|
+
if (typeof (mocha) !== "undefined")
|
31
|
+
mocha.forbidOnly();
|
32
|
+
else
|
33
|
+
require.cache[require.resolve("mocha/lib/mocharc.json", { paths: (_b = (_a = require.main) === null || _a === void 0 ? void 0 : _a.paths) !== null && _b !== void 0 ? _b : module.paths })].exports.forbidOnly = true;
|
34
|
+
}
|
35
|
+
// This is necessary to enable colored output when running in rush test:
|
36
|
+
Object.defineProperty(Base, "color", {
|
37
|
+
get: () => process.env.FORCE_COLOR !== "false" && process.env.FORCE_COLOR !== "0",
|
38
|
+
set: () => { },
|
39
|
+
});
|
40
|
+
class BentleyMochaReporter extends Spec {
|
41
|
+
constructor(_runner, _options) {
|
42
|
+
super(...arguments);
|
43
|
+
this._junitReporter = new MochaJUnitReporter(...arguments);
|
44
|
+
}
|
45
|
+
epilogue(...args) {
|
46
|
+
// Force test errors to be printed to stderr instead of stdout.
|
47
|
+
// This will allow rush to correctly summarize test failure when running rush test.
|
48
|
+
if (this.stats.failures) {
|
49
|
+
withStdErr(() => super.epilogue(...args));
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
super.epilogue(...args);
|
53
|
+
if (0 === this.stats.passes) {
|
54
|
+
logBuildError("There were 0 passing tests. That doesn't seem right."
|
55
|
+
+ "\nIf there are really no passing tests and no failures, then what was even the point?"
|
56
|
+
+ "\nIt seems likely that tests were skipped by it.only, it.skip, or grep filters, so I'm going to fail now.");
|
57
|
+
failBuild();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
// Detect hangs caused by tests that leave timers/other handles open - not possible in electron frontends.
|
61
|
+
if (!("electron" in process.versions)) {
|
62
|
+
// NB: By calling unref() on this timer, we stop it from keeping the process alive, so it will only fire if _something else_ is still keeping
|
63
|
+
// the process alive after 5 seconds. This also has the benefit of preventing the timer from showing up in wtfnode's dump of open handles.
|
64
|
+
setTimeout(() => {
|
65
|
+
logBuildError(`Handle leak detected. Node was still running 5 seconds after tests completed.`);
|
66
|
+
if (debugLeaks) {
|
67
|
+
const wtf = require("wtfnode");
|
68
|
+
wtf.setLogger("info", console.error);
|
69
|
+
wtf.dump();
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
console.error("Try running with the DEBUG_LEAKS env var set to see open handles.");
|
73
|
+
}
|
74
|
+
// Not sure why, but process.exit(1) wasn't working here...
|
75
|
+
process.kill(process.pid);
|
76
|
+
}, 5000).unref();
|
77
|
+
}
|
78
|
+
if (!this.stats.pending)
|
79
|
+
return;
|
80
|
+
// Also log warnings in CI builds when tests have been skipped.
|
81
|
+
const currentPkgJson = path.join(process.cwd(), "package.json");
|
82
|
+
if (fs.existsSync(currentPkgJson)) {
|
83
|
+
const currentPackage = require(currentPkgJson).name;
|
84
|
+
if (this.stats.pending === 1)
|
85
|
+
logBuildWarning(`1 test skipped in ${currentPackage}`);
|
86
|
+
else
|
87
|
+
logBuildWarning(`${this.stats.pending} tests skipped in ${currentPackage}`);
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
if (this.stats.pending === 1)
|
91
|
+
logBuildWarning(`1 test skipped`);
|
92
|
+
else
|
93
|
+
logBuildWarning(`${this.stats.pending} tests skipped`);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
module.exports = BentleyMochaReporter;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@itwin/build-tools",
|
3
|
-
"version": "3.5.
|
3
|
+
"version": "3.5.1",
|
4
4
|
"description": "Bentley build tools",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -28,7 +28,6 @@
|
|
28
28
|
"glob": "^7.1.2",
|
29
29
|
"mocha": "^10.0.0",
|
30
30
|
"mocha-junit-reporter": "^2.0.2",
|
31
|
-
"recursive-readdir": "^2.2.2",
|
32
31
|
"rimraf": "^3.0.2",
|
33
32
|
"tree-kill": "^1.2.0",
|
34
33
|
"typedoc": "^0.22.11",
|
@@ -38,8 +37,8 @@
|
|
38
37
|
"yargs": "^17.4.0"
|
39
38
|
},
|
40
39
|
"devDependencies": {
|
41
|
-
"@itwin/eslint-plugin": "3.5.
|
42
|
-
"@types/node": "
|
40
|
+
"@itwin/eslint-plugin": "3.5.1",
|
41
|
+
"@types/node": "18.11.5",
|
43
42
|
"eslint": "^7.11.0"
|
44
43
|
},
|
45
44
|
"eslintConfig": {
|
package/scripts/extract.js
CHANGED
@@ -8,7 +8,7 @@ const argv = require("yargs").argv;
|
|
8
8
|
const path = require("path");
|
9
9
|
const paths = require("./config/paths");
|
10
10
|
const fs = require("fs-extra");
|
11
|
-
const readDirectory = require("
|
11
|
+
const { readDirectory } = require("./utils/recursiveReaddir");
|
12
12
|
|
13
13
|
const __PUBLISH_EXTRACT_START__ = "__PUBLISH_EXTRACT_START__";
|
14
14
|
const __PUBLISH_EXTRACT_END__ = "__PUBLISH_EXTRACT_END__";
|
@@ -0,0 +1,96 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const p = require("path");
|
3
|
+
|
4
|
+
function matchesFile(ignorePath) {
|
5
|
+
return function (path, stats) {
|
6
|
+
return stats.isFile() && ignorePath === path;
|
7
|
+
};
|
8
|
+
}
|
9
|
+
|
10
|
+
function toMatcherFunction(ignoreEntry) {
|
11
|
+
if (typeof ignoreEntry == "function") {
|
12
|
+
return ignoreEntry;
|
13
|
+
} else {
|
14
|
+
return matchesFile(ignoreEntry);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
function readdir(path, ignores, callback) {
|
19
|
+
if (typeof ignores == "function") {
|
20
|
+
callback = ignores;
|
21
|
+
ignores = [];
|
22
|
+
}
|
23
|
+
|
24
|
+
if (!callback) {
|
25
|
+
return new Promise(function (resolve, reject) {
|
26
|
+
readdir(path, ignores || [], function (err, data) {
|
27
|
+
if (err) {
|
28
|
+
reject(err);
|
29
|
+
} else {
|
30
|
+
resolve(data);
|
31
|
+
}
|
32
|
+
});
|
33
|
+
});
|
34
|
+
}
|
35
|
+
|
36
|
+
ignores = ignores.map(toMatcherFunction);
|
37
|
+
|
38
|
+
let list = [];
|
39
|
+
|
40
|
+
fs.readdir(path, function (err, files) {
|
41
|
+
if (err) {
|
42
|
+
return callback(err);
|
43
|
+
}
|
44
|
+
|
45
|
+
let pending = files.length;
|
46
|
+
if (!pending) {
|
47
|
+
// we are done
|
48
|
+
return callback(null, list);
|
49
|
+
}
|
50
|
+
|
51
|
+
files.forEach(function (file) {
|
52
|
+
const filePath = p.join(path, file);
|
53
|
+
fs.stat(filePath, function (_err, stats) {
|
54
|
+
if (_err) {
|
55
|
+
return callback(_err);
|
56
|
+
}
|
57
|
+
|
58
|
+
if (
|
59
|
+
ignores.some(function (matcher) {
|
60
|
+
return matcher(filePath, stats);
|
61
|
+
})
|
62
|
+
) {
|
63
|
+
pending -= 1;
|
64
|
+
if (!pending) {
|
65
|
+
return callback(null, list);
|
66
|
+
}
|
67
|
+
return null;
|
68
|
+
}
|
69
|
+
|
70
|
+
if (stats.isDirectory()) {
|
71
|
+
readdir(filePath, ignores, function (__err, res) {
|
72
|
+
if (__err) {
|
73
|
+
return callback(__err);
|
74
|
+
}
|
75
|
+
|
76
|
+
list = list.concat(res);
|
77
|
+
pending -= 1;
|
78
|
+
if (!pending) {
|
79
|
+
return callback(null, list);
|
80
|
+
}
|
81
|
+
});
|
82
|
+
} else {
|
83
|
+
list.push(filePath);
|
84
|
+
pending -= 1;
|
85
|
+
if (!pending) {
|
86
|
+
return callback(null, list);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
});
|
90
|
+
});
|
91
|
+
});
|
92
|
+
}
|
93
|
+
|
94
|
+
module.exports = {
|
95
|
+
readDirectory: readdir
|
96
|
+
};
|