@naturalcycles/dev-lib 19.10.0 → 19.11.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/cfg/collectReporter.js +13 -3
- package/cfg/lint-staged.config.js +1 -1
- package/cfg/vitestAlphabeticSequencer.js +1 -1
- package/dist/bin/dev-lib.js +2 -2
- package/dist/lint.util.js +4 -4
- package/dist/test.util.js +1 -1
- package/dist/testing/mockAllKindsOfThings.js +1 -1
- package/package.json +1 -1
package/cfg/collectReporter.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
export class CollectReporter {
|
|
2
|
+
constructor(cfg = {}) { this.cfg = cfg }
|
|
3
|
+
|
|
2
4
|
onTestModuleEnd(testModule) {
|
|
5
|
+
const { threshold = 0 } = this.cfg
|
|
3
6
|
const shortModuleId = testModule.moduleId.split('/').at(-1)
|
|
4
7
|
|
|
5
|
-
console.log(shortModuleId, Math.round(testModule.diagnostic().collectDuration))
|
|
6
|
-
|
|
7
8
|
const selfTimeMap = {}
|
|
8
9
|
const totalTimeMap = {}
|
|
10
|
+
let moduleCount = 0
|
|
11
|
+
let selfSum = 0
|
|
9
12
|
|
|
10
13
|
Object.entries(testModule.diagnostic().importDurations).forEach(([k, v]) => {
|
|
14
|
+
moduleCount++
|
|
15
|
+
selfSum += v.selfTime
|
|
11
16
|
const short = k.split('/').at(-3) + '/' + k.split('/').at(-2) + '/' + k.split('/').at(-1)
|
|
12
|
-
|
|
17
|
+
if (Math.round(v.totalTime) < threshold) return // skip < ${threshold} ms imports
|
|
13
18
|
selfTimeMap[short] = Math.round(v.selfTime)
|
|
14
19
|
totalTimeMap[short] = Math.round(v.totalTime)
|
|
15
20
|
})
|
|
@@ -21,6 +26,11 @@ export class CollectReporter {
|
|
|
21
26
|
Object.entries(totalTimeMap).sort((a, b) => b[1] - a[1]),
|
|
22
27
|
)
|
|
23
28
|
|
|
29
|
+
console.log(shortModuleId, {
|
|
30
|
+
moduleCount,
|
|
31
|
+
selfSum: Math.round(selfSum),
|
|
32
|
+
collectDuration: Math.round(testModule.diagnostic().collectDuration),
|
|
33
|
+
})
|
|
24
34
|
console.log({ sortedSelfTimeMap })
|
|
25
35
|
console.log({ sortedTotalTimeMap })
|
|
26
36
|
}
|
|
@@ -15,7 +15,7 @@ console.log(`lint-staged.config.js runs on node ${node} ${platform} ${arch}`)
|
|
|
15
15
|
import fs from 'node:fs'
|
|
16
16
|
import micromatch from 'micromatch'
|
|
17
17
|
import { execSync } from 'node:child_process'
|
|
18
|
-
import { _assert } from '@naturalcycles/js-lib/error'
|
|
18
|
+
import { _assert } from '@naturalcycles/js-lib/error/assert.js'
|
|
19
19
|
import { semver2 } from '@naturalcycles/js-lib/semver'
|
|
20
20
|
import { exec2 } from '@naturalcycles/nodejs-lib/exec2'
|
|
21
21
|
|
package/dist/bin/dev-lib.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { select, Separator } from '@inquirer/prompts';
|
|
3
|
-
import { _by } from '@naturalcycles/js-lib';
|
|
4
|
-
import { _assert } from '@naturalcycles/js-lib/error';
|
|
3
|
+
import { _by } from '@naturalcycles/js-lib/array/array.util.js';
|
|
4
|
+
import { _assert } from '@naturalcycles/js-lib/error/assert.js';
|
|
5
5
|
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|
|
6
6
|
import { runScript } from '@naturalcycles/nodejs-lib/runScript';
|
|
7
7
|
import { buildCopy, buildProd, runTSCInFolders } from '../build.util.js';
|
package/dist/lint.util.js
CHANGED
|
@@ -3,11 +3,11 @@ import { existsSync } from 'node:fs';
|
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { _isTruthy } from '@naturalcycles/js-lib';
|
|
6
|
-
import { _since } from '@naturalcycles/js-lib/datetime';
|
|
7
|
-
import { _assert } from '@naturalcycles/js-lib/error';
|
|
8
|
-
import { _filterFalsyValues } from '@naturalcycles/js-lib/object';
|
|
6
|
+
import { _since } from '@naturalcycles/js-lib/datetime/time.util.js';
|
|
7
|
+
import { _assert } from '@naturalcycles/js-lib/error/assert.js';
|
|
8
|
+
import { _filterFalsyValues } from '@naturalcycles/js-lib/object/object.util.js';
|
|
9
9
|
import { semver2 } from '@naturalcycles/js-lib/semver';
|
|
10
|
-
import { _truncate } from '@naturalcycles/js-lib/string';
|
|
10
|
+
import { _truncate } from '@naturalcycles/js-lib/string/string.util.js';
|
|
11
11
|
import { git2 } from '@naturalcycles/nodejs-lib';
|
|
12
12
|
import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib/colors';
|
|
13
13
|
import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
|
package/dist/test.util.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _uniq } from '@naturalcycles/js-lib';
|
|
1
|
+
import { _uniq } from '@naturalcycles/js-lib/array/array.util.js';
|
|
2
2
|
import { dimGrey } from '@naturalcycles/nodejs-lib/colors';
|
|
3
3
|
import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
|
|
4
4
|
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|