@naturalcycles/dev-lib 19.9.0 → 19.11.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.
@@ -366,6 +366,7 @@ export default {
366
366
  'unicorn/prefer-single-call': 0,
367
367
  'unicorn/no-abusive-eslint-disable': 0,
368
368
  'unicorn/no-negated-condition': 0,
369
+ 'unicorn/no-unnecessary-polyfills': 0, // little value, bottleneck performance
369
370
  'unicorn/no-array-method-this-argument': 0, // bug: wrongly removes`readable.flatMap` concurrency option
370
371
  'unicorn/prefer-array-flat': 0, // bug: messes up with `readable.flatMap`
371
372
  'unicorn/number-literal-case': 0, // conflicts with prettier
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  import { BaseSequencer } from 'vitest/node'
2
- import { _sortBy } from '@naturalcycles/js-lib'
2
+ import { _sortBy } from '@naturalcycles/js-lib/array/array.util.js'
3
3
 
4
4
  export class VitestAlphabeticSequencer extends BaseSequencer {
5
5
  async sort(files) {
@@ -1,9 +1,9 @@
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';
5
- import { runScript } from '@naturalcycles/nodejs-lib';
3
+ import { _by } from '@naturalcycles/js-lib/array/array.util.js';
4
+ import { _assert } from '@naturalcycles/js-lib/error/assert.js';
6
5
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
6
+ import { runScript } from '@naturalcycles/nodejs-lib/runScript';
7
7
  import { buildCopy, buildProd, runTSCInFolders } from '../build.util.js';
8
8
  import { eslintAll, lintAllCommand, lintStagedCommand, runBiome, runCommitlintCommand, runPrettier, stylelintAll, } from '../lint.util.js';
9
9
  import { runTest } from '../test.util.js';
@@ -14,24 +14,12 @@ const commands = [
14
14
  fn: typecheck,
15
15
  desc: 'Run typecheck (tsc) in folders (src, scripts, e2e) if there is tsconfig.json present',
16
16
  },
17
- {
18
- name: 'tsc',
19
- fn: tscAll,
20
- desc: 'Run tsc in folders (src, scripts, e2e) if there is tsconfig.json present',
21
- deprecated: true,
22
- },
23
17
  { name: 'bt', fn: bt, desc: 'Build & Test: run "typecheck" (tsc) and then "test".' },
24
18
  { name: 'check', fn: lbt, desc: '"Run all possible checks": lint, typecheck, then test.' },
25
- {
26
- name: 'lbt',
27
- fn: lbtDeprecated,
28
- desc: 'Lint/Build/Test: run "lint", then "tsc", then "test".',
29
- deprecated: true,
30
- },
31
19
  {
32
20
  name: 'build',
33
21
  fn: buildProd,
34
- desc: 'Clean ./dist, run "build-copy" then tsc with --emit and --noCheck, using tsconfig.prod.json',
22
+ desc: 'Run "build-copy" then tsc with --emit and --noCheck, using tsconfig.prod.json',
35
23
  },
36
24
  {
37
25
  name: 'build-copy',
@@ -43,6 +31,11 @@ const commands = [
43
31
  fn: cleanDist,
44
32
  desc: 'Clean ./dist',
45
33
  },
34
+ {
35
+ name: 'clean-build',
36
+ fn: cleanBuild,
37
+ desc: 'Cleans ./dist, then runs the build.',
38
+ },
46
39
  new Separator(), // test
47
40
  { name: 'test', fn: runTest, desc: 'Run vitest for *.test.ts files.' },
48
41
  {
@@ -147,14 +140,10 @@ async function bt() {
147
140
  async function typecheck() {
148
141
  await runTSCInFolders(['tsconfig.json', 'scripts/tsconfig.json', 'e2e/tsconfig.json'], ['--noEmit']);
149
142
  }
150
- async function tscAll() {
151
- console.log(`"dev-lib tsc" is deprecated, use "dev-lib typecheck" instead`);
152
- await typecheck();
153
- }
154
- async function lbtDeprecated() {
155
- console.log(`"dev-lib lbt" is deprecated, use "dev-lib check" instead`);
156
- await lbt();
157
- }
158
143
  async function cleanDist() {
159
144
  fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
160
145
  }
146
+ async function cleanBuild() {
147
+ await cleanDist();
148
+ await buildProd();
149
+ }
@@ -3,7 +3,7 @@ import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
3
3
  import { kpySync } from '@naturalcycles/nodejs-lib/kpy';
4
4
  import { findPackageBinPath } from './lint.util.js';
5
5
  export async function buildProd() {
6
- fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
6
+ // fs2.emptyDir('./dist') // it doesn't delete the dir itself, to prevent IDE jumping
7
7
  buildCopy();
8
8
  await runTSCProd();
9
9
  }
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';
@@ -1,4 +1,4 @@
1
- import { AppError } from '@naturalcycles/js-lib/error';
1
+ import { AppError } from '@naturalcycles/js-lib/error/error.util.js';
2
2
  export const mockAllKindsOfThings = () => {
3
3
  const errorWithCode = new Error('Error with code');
4
4
  Object.assign(errorWithCode, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "19.9.0",
4
+ "version": "19.11.0",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "@commitlint/cli": "^19",