@naturalcycles/dev-lib 19.1.0 → 19.2.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.
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { select, Separator } from '@inquirer/prompts';
3
3
  import { _assert, _by } from '@naturalcycles/js-lib';
4
- import { runScript } from '@naturalcycles/nodejs-lib';
4
+ import { fs2, runScript } from '@naturalcycles/nodejs-lib';
5
5
  import { buildCopy, buildProd, runTSCInFolders } from '../build.util.js';
6
6
  import { eslintAll, lintAllCommand, lintStagedCommand, runBiome, runCommitlintCommand, runPrettier, stylelintAll, } from '../lint.util.js';
7
7
  import { runTest } from '../test.util.js';
8
- import { up, upnc } from '../yarn.util.js';
9
8
  const commands = [
10
9
  new Separator(), // build
11
10
  {
@@ -37,6 +36,11 @@ const commands = [
37
36
  fn: buildCopy,
38
37
  desc: 'Copy the non-ts files from ./src to ./dist',
39
38
  },
39
+ {
40
+ name: 'clean',
41
+ fn: cleanDist,
42
+ desc: 'Clean ./dist',
43
+ },
40
44
  new Separator(), // test
41
45
  { name: 'test', fn: runTest, desc: 'Run vitest for *.test.ts files.' },
42
46
  {
@@ -86,13 +90,6 @@ const commands = [
86
90
  { name: 'prettier', fn: runPrettier, desc: 'Run prettier on all files.' },
87
91
  { name: 'stylelint', fn: stylelintAll, desc: 'Run stylelint on all files.' },
88
92
  { name: 'commitlint', fn: runCommitlintCommand, desc: 'Run commitlint.', cliOnly: true },
89
- new Separator(), // yarn
90
- { name: 'up', fn: up, desc: 'Shortcut for "yarn upgrade". Also runs yarn-deduplicate.' },
91
- {
92
- name: 'upnc',
93
- fn: upnc,
94
- desc: 'Shortcut for "yarn upgrade --pattern @naturalcycles". Also runs yarn-deduplicate.',
95
- },
96
93
  new Separator(), // interactive-only
97
94
  {
98
95
  name: 'exit',
@@ -146,7 +143,7 @@ async function bt() {
146
143
  runTest();
147
144
  }
148
145
  async function typecheck() {
149
- await runTSCInFolders(['.', 'scripts', 'e2e'], ['--noEmit']);
146
+ await runTSCInFolders(['tsconfig.json', 'scripts/tsconfig.json', 'e2e/tsconfig.json'], ['--noEmit']);
150
147
  }
151
148
  async function tscAll() {
152
149
  console.log(`"dev-lib tsc" is deprecated, use "dev-lib typecheck" instead`);
@@ -156,3 +153,6 @@ async function lbtDeprecated() {
156
153
  console.log(`"dev-lib lbt" is deprecated, use "dev-lib check" instead`);
157
154
  await lbt();
158
155
  }
156
+ async function cleanDist() {
157
+ fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
158
+ }
@@ -1,10 +1,10 @@
1
1
  export declare function buildProd(): Promise<void>;
2
2
  /**
3
- * Use '.' to indicate root.
3
+ * Use 'tsconfig.json' to indicate root.
4
4
  */
5
5
  export declare function runTSCInFolders(tsconfigPaths: string[], args?: string[], parallel?: boolean): Promise<void>;
6
6
  /**
7
- * Pass '.' to run in root.
7
+ * Pass 'tsconfig.json' to run in root.
8
8
  */
9
9
  export declare function runTSCInFolder(tsconfigPath: string, args?: string[]): Promise<void>;
10
10
  export declare function runTSCProd(args?: string[]): Promise<void>;
@@ -6,7 +6,7 @@ export async function buildProd() {
6
6
  await runTSCProd();
7
7
  }
8
8
  /**
9
- * Use '.' to indicate root.
9
+ * Use 'tsconfig.json' to indicate root.
10
10
  */
11
11
  export async function runTSCInFolders(tsconfigPaths, args = [], parallel = true) {
12
12
  if (parallel) {
@@ -19,7 +19,7 @@ export async function runTSCInFolders(tsconfigPaths, args = [], parallel = true)
19
19
  }
20
20
  }
21
21
  /**
22
- * Pass '.' to run in root.
22
+ * Pass 'tsconfig.json' to run in root.
23
23
  */
24
24
  export async function runTSCInFolder(tsconfigPath, args = []) {
25
25
  if (!fs2.pathExists(tsconfigPath)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "19.1.0",
4
+ "version": "19.2.1",
5
5
  "dependencies": {
6
6
  "@commitlint/cli": "^19",
7
7
  "@commitlint/config-conventional": "^19",
@@ -55,9 +55,7 @@
55
55
  "main": "dist/index.js",
56
56
  "types": "dist/index.d.ts",
57
57
  "bin": {
58
- "dev-lib": "dist/bin/dev-lib.js",
59
- "up": "dist/bin/up.js",
60
- "upnc": "dist/bin/upnc.js"
58
+ "dev-lib": "dist/bin/dev-lib.js"
61
59
  },
62
60
  "engines": {
63
61
  "node": ">=22.12.0"
@@ -80,14 +78,13 @@
80
78
  "bt": "tsx ./src/bin/dev-lib.ts bt && tsx scripts/eslintPrintConfig.script.ts",
81
79
  "check": "tsx ./src/bin/dev-lib.ts check && tsx scripts/eslintPrintConfig.script.ts",
82
80
  "typecheck": "tsx ./src/bin/dev-lib.ts typecheck",
81
+ "clean": "tsx ./src/bin/dev-lib.ts clean",
83
82
  "build": "tsx ./src/bin/dev-lib.ts build",
84
83
  "test": "tsx ./src/bin/dev-lib.ts test",
85
84
  "test-leaks": "tsx ./src/bin/dev-lib.ts test-leaks",
86
85
  "test-integration": "tsx ./src/bin/dev-lib.ts test-integration",
87
86
  "test-manual": "tsx ./src/bin/dev-lib.ts test-manual",
88
87
  "lint": "tsx ./src/bin/dev-lib.ts lint",
89
- "lint-staged-debug": "tsx ./src/bin/dev-lib.ts lint-staged",
90
- "up": "tsx ./src/bin/up.ts",
91
- "upnc": "tsx ./src/bin/upnc.ts"
88
+ "lint-staged-debug": "tsx ./src/bin/dev-lib.ts lint-staged"
92
89
  }
93
90
  }
package/readme.md CHANGED
@@ -87,10 +87,8 @@ These commands are available to be called as `yarn dev-lib <command>`.
87
87
 
88
88
  - `build`: "Production build". Does `del ./dist && build-copy && tsc-prod`
89
89
  - `bt`: "Build & Test". Does `del ./dist && tsc && tsc-scripts && test`
90
- - `lbt`: "Lint, Build & Test". Does `lint && tsc && test`
91
- - `build-esm-cjs`: "Production build" for browser-lib, will produce CJS output in `./dist` and ESM
92
- output in `./dist-esm`. Will use `./tsconfig.{cjs|esm}.prod.json` if exists, otherwise
93
- `tsconfig.prod.json`, which allows to override e.g compilation target.
90
+ - `typecheck`: Runs `tsc` in all folders (src, scripts, e2e).
91
+ - `check`: "Lint, Build & Test". Does `lint && typecheck && test`
94
92
 
95
93
  #### Test commands
96
94
 
package/dist/bin/up.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin/up.js DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runScript } from '@naturalcycles/nodejs-lib';
3
- import { up } from '../yarn.util.js';
4
- runScript(async () => {
5
- up();
6
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin/upnc.js DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runScript } from '@naturalcycles/nodejs-lib';
3
- import { upnc } from '../yarn.util.js';
4
- runScript(async () => {
5
- upnc();
6
- });
@@ -1,2 +0,0 @@
1
- export declare function up(): void;
2
- export declare function upnc(): void;
package/dist/yarn.util.js DELETED
@@ -1,15 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import { exec2 } from '@naturalcycles/nodejs-lib';
3
- export function up() {
4
- exec2.spawn('yarn upgrade');
5
- exec2.spawn('yarn-deduplicate');
6
- exec2.spawn('yarn');
7
- if (existsSync(`node_modules/patch-package`)) {
8
- exec2.spawn('patch-package');
9
- }
10
- }
11
- export function upnc() {
12
- exec2.spawn('yarn upgrade --pattern @naturalcycles');
13
- exec2.spawn('yarn-deduplicate');
14
- exec2.spawn('yarn');
15
- }