@itwin/build-tools 4.1.0-dev.6 → 4.1.0-dev.62

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 CHANGED
@@ -1,6 +1,57 @@
1
1
  # Change Log - @itwin/build-tools
2
2
 
3
- This log was last generated on Tue, 25 Apr 2023 17:50:35 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 03 Jul 2023 15:28:41 GMT and should not be manually modified.
4
+
5
+ ## 4.0.3
6
+ Mon, 03 Jul 2023 15:28:41 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.0.2
11
+ Wed, 21 Jun 2023 22:04:43 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 4.0.1
16
+ Wed, 21 Jun 2023 20:29:13 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 4.0.0
21
+ Mon, 22 May 2023 15:34:14 GMT
22
+
23
+ ### Updates
24
+
25
+ - typescript 5 compatibility
26
+ - Support non-rush repositories by allowing to specify output file locations.
27
+ - Update to eslint@8
28
+ - Fixed 'betools docs' script to set 'packageRoot' to correct relative path from root to package source.
29
+ - Upgrade TypeScript compile target to es2021.
30
+
31
+ ## 3.7.9
32
+ Tue, 20 Jun 2023 12:51:02 GMT
33
+
34
+ _Version update only_
35
+
36
+ ## 3.7.8
37
+ Thu, 01 Jun 2023 17:00:39 GMT
38
+
39
+ _Version update only_
40
+
41
+ ## 3.7.7
42
+ Wed, 24 May 2023 17:27:09 GMT
43
+
44
+ _Version update only_
45
+
46
+ ## 3.7.6
47
+ Mon, 15 May 2023 18:23:40 GMT
48
+
49
+ _Version update only_
50
+
51
+ ## 3.7.5
52
+ Thu, 04 May 2023 19:43:18 GMT
53
+
54
+ _Version update only_
4
55
 
5
56
  ## 3.7.4
6
57
  Tue, 25 Apr 2023 17:50:35 GMT
package/bin/betools.js CHANGED
@@ -128,7 +128,7 @@ function testCommand(options) {
128
128
  }
129
129
 
130
130
  function getScriptPath(name) {
131
- return `"${path.resolve(__dirname, path.join("..", "scripts", name))}"`;
131
+ return path.resolve(__dirname, path.join("..", "scripts", name));
132
132
  }
133
133
 
134
134
  function docsCommand(options) {
@@ -142,9 +142,9 @@ function docsCommand(options) {
142
142
  const testExcludeGlobOpt = options.testExcludeGlob ? ["--testExcludeGlob", options.testExcludeGlob] : [];
143
143
  const indexFileOpt = options.tsIndexFile ? ["--tsIndexFile", options.tsIndexFile] : [];
144
144
  const onlyJsonOpt = options.onlyJson ? ["--onlyJson"] : [];
145
- exec(["node", getScriptPath("docs.js"),
146
- ...sourceOpt, ...outOpt, ...jsonOpt, ...baseUrlOpt, ...includesOpt,
147
- ...excludesOpt, ...excludesGlobOpt, ...testExcludeGlobOpt, ...indexFileOpt, ...onlyJsonOpt]);
145
+ exec("node", [getScriptPath("docs.js"),
146
+ ...sourceOpt, ...outOpt, ...jsonOpt, ...baseUrlOpt, ...includesOpt,
147
+ ...excludesOpt, ...excludesGlobOpt, ...testExcludeGlobOpt, ...indexFileOpt, ...onlyJsonOpt]);
148
148
  }
149
149
 
150
150
  function extractCommand(options) {
@@ -152,7 +152,7 @@ function extractCommand(options) {
152
152
  const outOpt = options.out ? ["--out", options.out] : [];
153
153
  const fileExt = options.fileExt ? ["--fileExt", options.fileExt] : [];
154
154
  const recursive = options.recursive ? ["--recursive"] : [];
155
- exec(["node", getScriptPath("extract.js"), ...extractOpt, ...outOpt, ...fileExt, ...recursive]);
155
+ exec("node", [getScriptPath("extract.js"), ...extractOpt, ...outOpt, ...fileExt, ...recursive]);
156
156
  }
157
157
 
158
158
  function extractApiCommand(options) {
@@ -161,27 +161,27 @@ function extractApiCommand(options) {
161
161
  const apiReportFolderOpt = options.apiReportFolder ? ["--apiReportFolder", options.apiReportFolder] : [];
162
162
  const apiReportTempFolderOpt = options.apiReportTempFolder ? ["--apiReportTempFolder", options.apiReportTempFolder] : [];
163
163
  const apiSummaryFolderOpt = options.apiSummaryFolder ? ["--apiSummaryFolder", options.apiSummaryFolder] : [];
164
- exec(["node", getScriptPath("extract-api.js"), ...entryOpt, ...ignoreTagsOpt, ...apiReportFolderOpt, ...apiReportTempFolderOpt, ...apiSummaryFolderOpt]);
164
+ exec("node", [getScriptPath("extract-api.js"), ...entryOpt, ...ignoreTagsOpt, ...apiReportFolderOpt, ...apiReportTempFolderOpt, ...apiSummaryFolderOpt]);
165
165
  }
166
166
 
167
167
  function pseudolocalizeCommand(options) {
168
168
  const englishDir = options.englishDir ? ["--englishDir", options.englishDir] : [];
169
169
  const outOpt = options.out ? ["--out", options.out] : [];
170
- exec(["node", getScriptPath("pseudolocalize"), ...englishDir, ...outOpt]);
170
+ exec("node", [getScriptPath("pseudolocalize"), ...englishDir, ...outOpt]);
171
171
  }
172
172
 
173
173
  function copyAssetsCommand(options) {
174
174
  const packageJsonDir = options.packageJsonDir ? ["--packageJsonDir", options.packageJsonDir] : [];
175
175
  const nodeModulesDir = options.nodeModulesDir ? ["--nodeModulesDir", options.nodeModulesDir] : [];
176
176
  const destinationDir = options.destinationDir ? ["--destinationDir", options.destinationDir] : [];
177
- exec(["node", path.resolve(__dirname, "../scripts/copy-assets.js"), ...packageJsonDir, ...nodeModulesDir, ...destinationDir]);
177
+ exec("node", [path.resolve(__dirname, "../scripts/copy-assets.js"), ...packageJsonDir, ...nodeModulesDir, ...destinationDir]);
178
178
  }
179
179
 
180
- function exec(cmd) {
180
+ function exec(cmd, args) {
181
181
  console.log("Running command:");
182
- console.log(cmd.join(" "));
182
+ console.log(`${cmd} ${args.join(' ')}`);
183
183
  try {
184
- return child_process.execSync(cmd.join(" "), { encoding: "utf8", stdio: 'inherit' });
184
+ return child_process.execFileSync(cmd, args, { encoding: "utf8", stdio: 'inherit' });
185
185
  } catch (error) {
186
186
  if (error.status)
187
187
  process.exit(error.status);
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /*---------------------------------------------------------------------------------------------
4
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
5
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -8,10 +7,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
7
  /* eslint-disable @typescript-eslint/no-var-requires */
9
8
  /* eslint-disable no-console */
10
9
  const debugLeaks = process.env.DEBUG_LEAKS;
11
- if (debugLeaks)
10
+ let asyncResourceStats;
11
+ if (debugLeaks) {
12
12
  require("wtfnode");
13
- const path = require("path");
13
+ asyncResourceStats = new Map();
14
+ setupAsyncHooks();
15
+ }
16
+ function setupAsyncHooks() {
17
+ const async_hooks = require("node:async_hooks");
18
+ const init = (asyncId, type, triggerAsyncId, _resource) => {
19
+ const eid = async_hooks.executionAsyncId(); // (An executionAsyncId() of 0 means that it is being executed from C++ with no JavaScript stack above it.)
20
+ const stack = new Error().stack;
21
+ asyncResourceStats.set(asyncId, { type, eid, triggerAsyncId, initStack: stack });
22
+ };
23
+ const destroy = (asyncId) => {
24
+ if (asyncResourceStats.get(asyncId) === undefined) {
25
+ return;
26
+ }
27
+ asyncResourceStats.delete(asyncId);
28
+ };
29
+ const asyncHook = async_hooks.createHook({ init, destroy });
30
+ asyncHook.enable();
31
+ }
14
32
  const fs = require("fs-extra");
33
+ const path = require("path");
15
34
  const { logBuildWarning, logBuildError, failBuild } = require("../scripts/utils/utils");
16
35
  const Base = require("mocha/lib/reporters/base");
17
36
  const Spec = require("mocha/lib/reporters/spec");
@@ -66,6 +85,15 @@ class BentleyMochaReporter extends Spec {
66
85
  const wtf = require("wtfnode");
67
86
  wtf.setLogger("info", console.error);
68
87
  wtf.dump();
88
+ let activeResourcesInfo = process.getActiveResourcesInfo(); // https://nodejs.dev/en/api/v18/process#processgetactiveresourcesinfo (Not added to @types/node yet I suppose)
89
+ console.error(activeResourcesInfo);
90
+ activeResourcesInfo = activeResourcesInfo.map((value) => value.toLowerCase());
91
+ // asyncResourceStats.set(asyncId, {before: 0, after: 0, type, eid, triggerAsyncId, initStack: stack});
92
+ asyncResourceStats.forEach((value, key) => {
93
+ if (activeResourcesInfo.includes(value.type.toLowerCase())) {
94
+ console.error(`asyncId: ${key}: type: ${value.type}, eid: ${value.eid},triggerAsyncId: ${value.triggerAsyncId}, initStack: ${value.initStack}`);
95
+ }
96
+ });
69
97
  }
70
98
  else {
71
99
  console.error("Try running with the DEBUG_LEAKS env var set to see open handles.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/build-tools",
3
- "version": "4.1.0-dev.6",
3
+ "version": "4.1.0-dev.62",
4
4
  "description": "Bentley build tools",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "yargs": "^17.4.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@itwin/eslint-plugin": "^4.0.0-dev.33",
42
- "@types/node": "^18.11.5",
41
+ "@itwin/eslint-plugin": "4.0.0-dev.36",
42
+ "@types/node": "18.16.1",
43
43
  "eslint": "^8.36.0"
44
44
  },
45
45
  "eslintConfig": {