@naturalcycles/dev-lib 19.6.0 → 19.7.0
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 +30 -0
- package/cfg/lint-staged.config.js +1 -1
- package/cfg/vitest.config.d.ts +2 -0
- package/cfg/vitest.config.js +1 -0
- package/dist/bin/dev-lib.js +1 -1
- package/dist/build.util.js +3 -2
- package/dist/init-from-dev-lib.command.js +1 -1
- package/dist/lint.util.js +4 -2
- package/dist/test.util.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class CollectReporter {
|
|
2
|
+
onTestModuleEnd(testModule) {
|
|
3
|
+
const shortModuleId = testModule.moduleId.split('/').at(-1)
|
|
4
|
+
|
|
5
|
+
console.log(shortModuleId, Math.round(testModule.diagnostic().collectDuration))
|
|
6
|
+
|
|
7
|
+
const selfTimeMap = {}
|
|
8
|
+
const totalTimeMap = {}
|
|
9
|
+
|
|
10
|
+
Object.entries(testModule.diagnostic().importDurations).forEach(([k, v]) => {
|
|
11
|
+
const short = k.split('/').at(-3) + '/' + k.split('/').at(-2) + '/' + k.split('/').at(-1)
|
|
12
|
+
// if (Math.round(v.totalTime) < 5) return // skip <0.5ms imports
|
|
13
|
+
selfTimeMap[short] = Math.round(v.selfTime)
|
|
14
|
+
totalTimeMap[short] = Math.round(v.totalTime)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const sortedSelfTimeMap = Object.fromEntries(
|
|
18
|
+
Object.entries(selfTimeMap).sort((a, b) => b[1] - a[1]),
|
|
19
|
+
)
|
|
20
|
+
const sortedTotalTimeMap = Object.fromEntries(
|
|
21
|
+
Object.entries(totalTimeMap).sort((a, b) => b[1] - a[1]),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
console.log({ sortedSelfTimeMap })
|
|
25
|
+
console.log({ sortedTotalTimeMap })
|
|
26
|
+
}
|
|
27
|
+
// onTestRunEnd() {
|
|
28
|
+
// console.log('Test run ended')
|
|
29
|
+
// }
|
|
30
|
+
}
|
|
@@ -16,7 +16,7 @@ import fs from 'node:fs'
|
|
|
16
16
|
import micromatch from 'micromatch'
|
|
17
17
|
import { execSync } from 'node:child_process'
|
|
18
18
|
import { _assert, semver2 } from '@naturalcycles/js-lib'
|
|
19
|
-
import { exec2 } from '@naturalcycles/nodejs-lib'
|
|
19
|
+
import { exec2 } from '@naturalcycles/nodejs-lib/exec2'
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
prettierDirs,
|
package/cfg/vitest.config.d.ts
CHANGED
package/cfg/vitest.config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import { VitestAlphabeticSequencer } from './vitestAlphabeticSequencer.js'
|
|
3
3
|
import { defineConfig } from 'vitest/config'
|
|
4
|
+
export { CollectReporter } from './collectReporter.js'
|
|
4
5
|
|
|
5
6
|
const runsInIDE = doesItRunInIDE()
|
|
6
7
|
const testType = getTestType(runsInIDE)
|
package/dist/bin/dev-lib.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { select, Separator } from '@inquirer/prompts';
|
|
3
3
|
import { _assert, _by } from '@naturalcycles/js-lib';
|
|
4
4
|
import { runScript } from '@naturalcycles/nodejs-lib';
|
|
5
|
-
import { fs2 } from '@naturalcycles/nodejs-lib/
|
|
5
|
+
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|
|
6
6
|
import { buildCopy, buildProd, runTSCInFolders } from '../build.util.js';
|
|
7
7
|
import { eslintAll, lintAllCommand, lintStagedCommand, runBiome, runCommitlintCommand, runPrettier, stylelintAll, } from '../lint.util.js';
|
|
8
8
|
import { runTest } from '../test.util.js';
|
package/dist/build.util.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { exec2 } from '@naturalcycles/nodejs-lib';
|
|
2
|
-
import { fs2
|
|
1
|
+
import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
|
|
2
|
+
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|
|
3
|
+
import { kpySync } from '@naturalcycles/nodejs-lib/kpy';
|
|
3
4
|
import { findPackageBinPath } from './lint.util.js';
|
|
4
5
|
export async function buildProd() {
|
|
5
6
|
fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
|
package/dist/lint.util.js
CHANGED
|
@@ -3,8 +3,10 @@ import { existsSync } from 'node:fs';
|
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { _assert, _isTruthy, _since, _truncate, semver2 } from '@naturalcycles/js-lib';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { git2 } from '@naturalcycles/nodejs-lib';
|
|
7
|
+
import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib/colors';
|
|
8
|
+
import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
|
|
9
|
+
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|
|
8
10
|
import { _yargs } from '@naturalcycles/nodejs-lib/yargs';
|
|
9
11
|
import { eslintExtensions, lintExclude, minActionlintVersion, prettierDirs, prettierExtensionsAll, stylelintExtensions, } from '../cfg/_cnst.js';
|
|
10
12
|
import { cfgDir, scriptsDir } from './paths.js';
|
package/dist/test.util.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _uniq } from '@naturalcycles/js-lib';
|
|
2
|
-
import { dimGrey
|
|
3
|
-
import {
|
|
2
|
+
import { dimGrey } from '@naturalcycles/nodejs-lib/colors';
|
|
3
|
+
import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
|
|
4
|
+
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|
|
4
5
|
import { findPackageBinPath } from './lint.util.js';
|
|
5
6
|
export function runTest(opt = {}) {
|
|
6
7
|
// if (nodeModuleExists('vitest')) {
|