@naturalcycles/dev-lib 14.2.0 → 15.0.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.
Files changed (87) hide show
  1. package/dist/bin/dev-lib.d.ts +1 -0
  2. package/dist/bin/dev-lib.js +136 -0
  3. package/dist/bin/up.js +2 -8
  4. package/dist/bin/upnc.js +2 -3
  5. package/dist/build.util.d.ts +11 -0
  6. package/dist/build.util.js +103 -0
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.js +3 -2
  9. package/dist/{cmd/init-from-dev-lib.command.js → init-from-dev-lib.command.js} +2 -2
  10. package/dist/lint.util.d.ts +17 -0
  11. package/dist/lint.util.js +255 -0
  12. package/dist/{cnst/paths.cnst.js → paths.js} +1 -1
  13. package/dist/test.util.d.ts +10 -0
  14. package/dist/{util/jest.util.js → test.util.js} +31 -30
  15. package/dist/yarn.util.d.ts +2 -0
  16. package/dist/yarn.util.js +20 -0
  17. package/package.json +15 -47
  18. package/readme.md +33 -29
  19. package/dist/bin/bt.d.ts +0 -2
  20. package/dist/bin/bt.js +0 -12
  21. package/dist/bin/btl.d.ts +0 -2
  22. package/dist/bin/btl.js +0 -14
  23. package/dist/bin/build-copy.d.ts +0 -2
  24. package/dist/bin/build-copy.js +0 -6
  25. package/dist/bin/build-prod-esm-cjs.d.ts +0 -2
  26. package/dist/bin/build-prod-esm-cjs.js +0 -6
  27. package/dist/bin/build-prod.d.ts +0 -2
  28. package/dist/bin/build-prod.js +0 -6
  29. package/dist/bin/build.d.ts +0 -2
  30. package/dist/bin/build.js +0 -10
  31. package/dist/bin/commitlint-def.d.ts +0 -2
  32. package/dist/bin/commitlint-def.js +0 -34
  33. package/dist/bin/eslint-all.d.ts +0 -2
  34. package/dist/bin/eslint-all.js +0 -6
  35. package/dist/bin/init-from-dev-lib.d.ts +0 -2
  36. package/dist/bin/init-from-dev-lib.js +0 -6
  37. package/dist/bin/lint-all.d.ts +0 -2
  38. package/dist/bin/lint-all.js +0 -6
  39. package/dist/bin/lint-staged-def.d.ts +0 -2
  40. package/dist/bin/lint-staged-def.js +0 -28
  41. package/dist/bin/prettier-all.d.ts +0 -2
  42. package/dist/bin/prettier-all.js +0 -8
  43. package/dist/bin/stylelint-all.d.ts +0 -2
  44. package/dist/bin/stylelint-all.js +0 -8
  45. package/dist/bin/test-ci.d.ts +0 -2
  46. package/dist/bin/test-ci.js +0 -9
  47. package/dist/bin/test-integration-ci.d.ts +0 -2
  48. package/dist/bin/test-integration-ci.js +0 -9
  49. package/dist/bin/test-integration.d.ts +0 -2
  50. package/dist/bin/test-integration.js +0 -8
  51. package/dist/bin/test-leaks.d.ts +0 -2
  52. package/dist/bin/test-leaks.js +0 -8
  53. package/dist/bin/test-manual.d.ts +0 -2
  54. package/dist/bin/test-manual.js +0 -8
  55. package/dist/bin/test.d.ts +0 -2
  56. package/dist/bin/test.js +0 -8
  57. package/dist/bin/tsc-prod.d.ts +0 -2
  58. package/dist/bin/tsc-prod.js +0 -6
  59. package/dist/bin/tsc-scripts.d.ts +0 -2
  60. package/dist/bin/tsc-scripts.js +0 -6
  61. package/dist/bin/update-from-dev-lib.d.ts +0 -2
  62. package/dist/bin/update-from-dev-lib.js +0 -13
  63. package/dist/cmd/build-copy.command.d.ts +0 -1
  64. package/dist/cmd/build-copy.command.js +0 -22
  65. package/dist/cmd/build-prod-esm-cjs.command.d.ts +0 -1
  66. package/dist/cmd/build-prod-esm-cjs.command.js +0 -41
  67. package/dist/cmd/build-prod.command.d.ts +0 -1
  68. package/dist/cmd/build-prod.command.js +0 -12
  69. package/dist/cmd/eslint-all.command.d.ts +0 -4
  70. package/dist/cmd/eslint-all.command.js +0 -59
  71. package/dist/cmd/lint-all.command.d.ts +0 -4
  72. package/dist/cmd/lint-all.command.js +0 -97
  73. package/dist/cmd/tsc-prod.command.d.ts +0 -1
  74. package/dist/cmd/tsc-prod.command.js +0 -13
  75. package/dist/util/jest.util.d.ts +0 -17
  76. package/dist/util/lint.util.d.ts +0 -4
  77. package/dist/util/lint.util.js +0 -39
  78. package/dist/util/prettier.util.d.ts +0 -1
  79. package/dist/util/prettier.util.js +0 -23
  80. package/dist/util/stylelint.util.d.ts +0 -2
  81. package/dist/util/stylelint.util.js +0 -34
  82. package/dist/util/test.util.d.ts +0 -4
  83. package/dist/util/test.util.js +0 -11
  84. package/dist/util/tsc.util.d.ts +0 -9
  85. package/dist/util/tsc.util.js +0 -67
  86. /package/dist/{cmd/init-from-dev-lib.command.d.ts → init-from-dev-lib.command.d.ts} +0 -0
  87. /package/dist/{cnst/paths.cnst.d.ts → paths.d.ts} +0 -0
@@ -1,44 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getJestConfigPath = getJestConfigPath;
4
- exports.getJestIntegrationConfigPath = getJestIntegrationConfigPath;
5
- exports.getJestManualConfigPath = getJestManualConfigPath;
6
- exports.isRunningAllTests = isRunningAllTests;
7
3
  exports.runJest = runJest;
8
4
  const tslib_1 = require("tslib");
9
5
  const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
10
6
  const node_os_1 = tslib_1.__importDefault(require("node:os"));
11
7
  const js_lib_1 = require("@naturalcycles/js-lib");
12
8
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
13
- const paths_cnst_1 = require("../cnst/paths.cnst");
14
- const test_util_1 = require("./test.util");
15
- function getJestConfigPath() {
16
- return node_fs_1.default.existsSync(`./jest.config.js`) ? './jest.config.js' : undefined;
17
- }
18
- function getJestIntegrationConfigPath() {
19
- return node_fs_1.default.existsSync(`./jest.integration-test.config.js`)
20
- ? `./jest.integration-test.config.js`
21
- : `${paths_cnst_1.cfgDir}/jest.integration-test.config.js`;
22
- }
23
- function getJestManualConfigPath() {
24
- return node_fs_1.default.existsSync(`./jest.manual-test.config.js`)
25
- ? `./jest.manual-test.config.js`
26
- : `${paths_cnst_1.cfgDir}/jest.manual-test.config.js`;
27
- }
28
- /**
29
- * Detects if jest is run with all tests, or with specific tests.
30
- */
31
- function isRunningAllTests() {
32
- const args = process.argv.slice(2);
33
- const positionalArgs = args.filter(a => !a.startsWith('-'));
34
- // console.log(process.argv, positionalArgs)
35
- return !positionalArgs.length;
36
- }
9
+ const paths_1 = require("./paths");
37
10
  /**
38
11
  * 1. Adds `--silent` if running all tests at once.
39
12
  */
40
13
  function runJest(opt = {}) {
41
- if (!(0, test_util_1.nodeModuleExists)('jest')) {
14
+ if (!nodeModuleExists('jest')) {
42
15
  console.log((0, nodejs_lib_1.dimGrey)(`node_modules/${(0, nodejs_lib_1.white)('jest')} not found, skipping tests`));
43
16
  return;
44
17
  }
@@ -105,7 +78,7 @@ function runJest(opt = {}) {
105
78
  });
106
79
  }
107
80
  if (!JEST_NO_ALPHABETIC) {
108
- args.push(`--testSequencer=${paths_cnst_1.cfgDir}/jest.alphabetic.sequencer.js`);
81
+ args.push(`--testSequencer=${paths_1.cfgDir}/jest.alphabetic.sequencer.js`);
109
82
  }
110
83
  const availableParallelism = node_os_1.default.availableParallelism?.();
111
84
  const cpus = node_os_1.default.cpus().length;
@@ -133,3 +106,31 @@ function runJest(opt = {}) {
133
106
  });
134
107
  }
135
108
  }
109
+ /**
110
+ * Returns true if module with given name exists in _target project's_ node_modules.
111
+ */
112
+ function nodeModuleExists(moduleName) {
113
+ return node_fs_1.default.existsSync(`./node_modules/${moduleName}`);
114
+ }
115
+ function getJestConfigPath() {
116
+ return node_fs_1.default.existsSync(`./jest.config.js`) ? './jest.config.js' : undefined;
117
+ }
118
+ function getJestIntegrationConfigPath() {
119
+ return node_fs_1.default.existsSync(`./jest.integration-test.config.js`)
120
+ ? `./jest.integration-test.config.js`
121
+ : `${paths_1.cfgDir}/jest.integration-test.config.js`;
122
+ }
123
+ function getJestManualConfigPath() {
124
+ return node_fs_1.default.existsSync(`./jest.manual-test.config.js`)
125
+ ? `./jest.manual-test.config.js`
126
+ : `${paths_1.cfgDir}/jest.manual-test.config.js`;
127
+ }
128
+ /**
129
+ * Detects if jest is run with all tests, or with specific tests.
130
+ */
131
+ function isRunningAllTests() {
132
+ const args = process.argv.slice(2);
133
+ const positionalArgs = args.filter(a => !a.startsWith('-'));
134
+ // console.log(process.argv, positionalArgs)
135
+ return !positionalArgs.length;
136
+ }
@@ -0,0 +1,2 @@
1
+ export declare function up(): void;
2
+ export declare function upnc(): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.up = up;
4
+ exports.upnc = upnc;
5
+ const tslib_1 = require("tslib");
6
+ const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
7
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
8
+ function up() {
9
+ (0, nodejs_lib_1.execVoidCommandSync)('yarn', ['upgrade']);
10
+ (0, nodejs_lib_1.execVoidCommandSync)('yarn-deduplicate');
11
+ (0, nodejs_lib_1.execVoidCommandSync)('yarn');
12
+ if (node_fs_1.default.existsSync(`node_modules/patch-package`)) {
13
+ (0, nodejs_lib_1.execVoidCommandSync)('patch-package');
14
+ }
15
+ }
16
+ function upnc() {
17
+ (0, nodejs_lib_1.execVoidCommandSync)('yarn', ['upgrade', '--pattern', `@naturalcycles`]);
18
+ (0, nodejs_lib_1.execVoidCommandSync)('yarn-deduplicate');
19
+ (0, nodejs_lib_1.execVoidCommandSync)('yarn');
20
+ }
package/package.json CHANGED
@@ -1,37 +1,26 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "14.2.0",
3
+ "version": "15.0.0",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "tsn-debug": "tsn testScript.ts",
7
- "bt": "tsn ./src/bin/bt.ts && tsn eslintPrintConfig",
8
- "btl": "tsn ./src/bin/btl.ts",
9
- "build": "tsn ./src/bin/build.ts",
10
- "tsc-prod": "tsn ./src/bin/tsc-prod.ts",
11
- "tsc-scripts": "tsn ./src/bin/tsc-scripts.ts",
12
- "build-copy": "tsn ./src/bin/build-copy.ts",
13
- "build-prod": "tsn ./src/bin/build-prod.ts",
14
- "build-prod-esm-cjs": "tsn ./src/bin/build-prod-esm-cjs.ts",
15
- "test": "tsn ./src/bin/test.ts",
16
- "test-ci": "tsn ./src/bin/test-ci.ts",
17
- "test-leaks": "tsn ./src/bin/test-leaks.ts",
18
- "test-integration": "tsn ./src/bin/test-integration.ts",
19
- "test-integration-ci": "tsn ./src/bin/test-integration-ci.ts",
20
- "test-manual": "tsn ./src/bin/test-manual.ts",
21
- "lint-staged-def": "tsn ./src/bin/lint-staged-def.ts",
22
- "commitlint-def": "tsn ./src/bin/commitlint-def.ts",
23
- "prettier-all": "tsn ./src/bin/prettier-all.ts",
24
- "stylelint-all": "tsn ./src/bin/stylelint-all.ts",
25
- "lint-all": "tsn ./src/bin/lint-all.ts",
26
- "eslint-all": "tsn ./src/bin/eslint-all.ts",
7
+ "dev-lib": "tsn ./src/bin/dev-lib.ts",
8
+ "bt": "tsn ./src/bin/dev-lib.ts bt && tsn eslintPrintConfig",
9
+ "lbt": "tsn ./src/bin/dev-lib.ts lbt",
10
+ "build": "tsn ./src/bin/dev-lib.ts build",
11
+ "build-prod-esm-cjs": "tsn ./src/bin/dev-lib.ts build-esm-cjs",
12
+ "test": "tsn ./src/bin/dev-lib.ts test",
13
+ "test-leaks": "tsn ./src/bin/dev-lib.ts test-leaks",
14
+ "test-integration": "tsn ./src/bin/dev-lib.ts test-integration",
15
+ "lint": "tsn ./src/bin/dev-lib.ts lint",
27
16
  "up": "tsn ./src/bin/up.ts",
28
- "upnc": "tsn ./src/bin/upnc.ts",
29
- "update-from-dev-lib": "tsn ./src/bin/update-from-dev-lib.ts"
17
+ "upnc": "tsn ./src/bin/upnc.ts"
30
18
  },
31
19
  "dependencies": {
32
20
  "@commitlint/cli": "^19.0.0",
33
21
  "@commitlint/config-conventional": "^19.0.0",
34
22
  "@eslint/js": "^9.7.0",
23
+ "@inquirer/prompts": "^5.3.2",
35
24
  "@naturalcycles/cli": "^1.0.0",
36
25
  "@naturalcycles/js-lib": "^14.0.0",
37
26
  "@naturalcycles/nodejs-lib": "^13.0.1",
@@ -75,33 +64,12 @@
75
64
  "main": "dist/index.js",
76
65
  "types": "dist/index.d.ts",
77
66
  "bin": {
78
- "bt": "dist/bin/bt.js",
79
- "btl": "dist/bin/btl.js",
80
- "build": "dist/bin/build.js",
81
- "build-copy": "dist/bin/build-copy.js",
82
- "build-prod": "dist/bin/build-prod.js",
83
- "build-prod-esm-cjs": "dist/bin/build-prod-esm-cjs.js",
84
- "commitlint-def": "dist/bin/commitlint-def.js",
85
- "eslint-all": "dist/bin/eslint-all.js",
86
- "init-from-dev-lib": "dist/bin/init-from-dev-lib.js",
87
- "lint-all": "dist/bin/lint-all.js",
88
- "lint-staged-def": "dist/bin/lint-staged-def.js",
89
- "prettier-all": "dist/bin/prettier-all.js",
90
- "stylelint-all": "dist/bin/stylelint-all.js",
91
- "test": "dist/bin/test.js",
92
- "test-ci": "dist/bin/test-ci.js",
93
- "test-leaks": "dist/bin/test-leaks.js",
94
- "test-integration": "dist/bin/test-integration.js",
95
- "test-integration-ci": "dist/bin/test-integration-ci.js",
96
- "test-manual": "dist/bin/test-manual.js",
97
- "tsc-prod": "dist/bin/tsc-prod.js",
98
- "tsc-scripts": "dist/bin/tsc-scripts.js",
67
+ "dev-lib": "dist/bin/dev-lib.js",
99
68
  "up": "dist/bin/up.js",
100
- "upnc": "dist/bin/upnc.js",
101
- "update-from-dev-lib": "dist/bin/update-from-dev-lib.js"
69
+ "upnc": "dist/bin/upnc.js"
102
70
  },
103
71
  "engines": {
104
- "node": ">=18.12.0"
72
+ "node": ">=20.12.0"
105
73
  },
106
74
  "publishConfig": {
107
75
  "provenance": true,
package/readme.md CHANGED
@@ -19,12 +19,26 @@ Install it:
19
19
 
20
20
  This unlocks all commands listed below, e.g:
21
21
 
22
- yarn test
23
- yarn lint-all
22
+ yarn dev-lib test
23
+ yarn dev-lib lint-all
24
+
25
+ `yarn dev-lib` runs "interactive mode" that lets you explore available commands.
24
26
 
25
27
  By default, it uses default configs for Prettier, ESLint, Stylelint, that are included in this
26
28
  package (for convenience). You can override them by putting your own `prettier.config.js`,
27
- `eslint.config.js`, `stylelint.config.json` in the root folder of your project.
29
+ `eslint.config.js`, `stylelint.config.js` in the root folder of your project.
30
+
31
+ UPD: these tools/linters would use default configs if absent:
32
+
33
+ - commitlint
34
+ - lint-staged
35
+
36
+ These tools require a respective config to run, otherwise they're not run. List of configs:
37
+
38
+ - `jest.config.js`
39
+ - `prettier.config.js`
40
+ - `eslint.config.js` (eslint FLAT config)
41
+ - `stylelint.config.js`
28
42
 
29
43
  ## Conventions
30
44
 
@@ -56,23 +70,15 @@ All files are linted and _prettified_ upon commit (using `husky`, `lint-staged`
56
70
 
57
71
  ### Yarn commands
58
72
 
59
- These commands are available to be called as `yarn <command>`, because they are exposed as
60
- `npm scripts` in `node_modules/.bin/`.
73
+ These commands are available to be called as `yarn dev-lib <command>`.
61
74
 
62
75
  #### Build commands
63
76
 
64
- - `tsc-prod`: does `tsc -p tsconfig.prod.ts`
65
- - `tsc-scripts`: does `tsc -p ./scripts/tsconfig.ts --noEmit` (type-checking for `./scripts`)
66
-
67
- - `build`: "Development build". Checks that "everything compiles". Does
68
- `del ./dist && tsc && tsc-scripts`
77
+ - `build`: "Production build". Does `del ./dist && build-copy && tsc-prod`
69
78
  - `bt`: "Build & Test". Does `del ./dist && tsc && tsc-scripts && test`
70
- - `btl`: "Build, Test & Lint". Does `lint-all && tsc && test`
71
-
72
- - `build-copy`: copies _additional files_ into `dist` folder (e.g `*.json`)
73
- - `build-prod`: "Production build". Does `del ./dist && build-copy && tsc-prod`
74
- - `build-prod-esm-cjs`: "Production build" for browser-lib, will produce CJS output in `./dist` and
75
- ESM output in `./dist-esm`. Will use `./tsconfig.{cjs|esm}.prod.json` if exists, otherwise
79
+ - `lbt`: "Lint, Build & Test". Does `lint && tsc && test`
80
+ - `build-esm-cjs`: "Production build" for browser-lib, will produce CJS output in `./dist` and ESM
81
+ output in `./dist-esm`. Will use `./tsconfig.{cjs|esm}.prod.json` if exists, otherwise
76
82
  `tsconfig.prod.json`, which allows to override e.g compilation target.
77
83
 
78
84
  #### Test commands
@@ -83,7 +89,7 @@ There are 3 categories of tests supported:
83
89
  - Integration tests `*.integration.test.ts`
84
90
  - Manual tests `*.manual.test.ts`
85
91
 
86
- Unit tests are default. All tests are run on `yarn test`.
92
+ Unit tests are default. All tests are run on `yarn dev-lib test`.
87
93
 
88
94
  Integration tests (optional) allow to have a setup file (`src/test/setupJest.integration.ts`) where
89
95
  you can define separate environment settings. You can use it to run so-called "integration tests" -
@@ -120,11 +126,11 @@ For manual tests:
120
126
  - `<rootDir>/src/test/setupJest.ts`
121
127
  - `<rootDir>/src/test/setupJest.manual.ts`
122
128
 
123
- `yarn test` runs tests in alphabetic order by default (internally it points `--testSequencer` to a
124
- pre-defined sequencer file that sorts all filenames alphabetically). Set `JEST_NO_ALPHABETIC` env
125
- variable to disable it.
129
+ `yarn dev-lib test` runs tests in alphabetic order by default (internally it points
130
+ `--testSequencer` to a pre-defined sequencer file that sorts all filenames alphabetically). Set
131
+ `JEST_NO_ALPHABETIC` env variable to disable it.
126
132
 
127
- ##### Shard support (experimental)
133
+ ##### Shard support
128
134
 
129
135
  Jest 28 introduced [--shard](https://jestjs.io/docs/cli#--shard) feature.
130
136
 
@@ -137,14 +143,14 @@ If you need to execute shards **in parallel**, you can follow e.g
137
143
 
138
144
  #### Lint commands
139
145
 
140
- - `lint-all`: runs ESLint, Stylelint, Prettier, actionlint, ktlint in the right order.
146
+ - `lint`: runs ESLint, Stylelint, Prettier, actionlint, ktlint in the right order.
141
147
 
142
148
  - `--commitOnChanges` will commit lint-modified changes and push them
143
149
  - `--failOnChanges` will exit with status 1 in the end (will fail the command)
144
150
 
145
- - `eslint-all`: runs `eslint` on needed paths
146
- - `stylelint-all`: runs `stylelint` on needed paths
147
- - `prettier-all`: runs just Prettier on needed paths
151
+ - `eslint`: runs `eslint` on needed paths
152
+ - `stylelint`: runs `stylelint` on needed paths
153
+ - `prettier`: runs just Prettier on needed paths
148
154
 
149
155
  Pass `--no-fix` (or `--fix=false`) to disable the default `--fix` flag on linters. Useful to debug a
150
156
  linter, or when linter behaves badly and corrupts your files (just happened to me with
@@ -170,8 +176,6 @@ Install it **locally** in you project by adding
170
176
 
171
177
  - `up`: shortcut for `yarn upgrade` && `yarn patch-package` (if `patch-package` exists in the
172
178
  project).
173
- - `init-from-dev-lib`: copy config files from `dev-lib/cfg/init` to the project
174
- - `update-from-dev-lib`: copy config files from `dev-lib/cfg/overwrite` to the project
175
179
 
176
180
  ## Non-extendable config files
177
181
 
@@ -193,7 +197,7 @@ These files are meant to be extended in target project, so act as _recommended d
193
197
  - `husky.config.js`
194
198
  - `lint-staged.config.js`
195
199
  - `prettier.config.js`
196
- - `eslint.config.json`
200
+ - `eslint.config.js`
197
201
  - `jest.config.js`
198
202
 
199
203
  ## eslint
@@ -201,4 +205,4 @@ These files are meant to be extended in target project, so act as _recommended d
201
205
  Presence of `jest` is detected by checking if `node_modules/jest` exists.
202
206
 
203
207
  If exists - `eslint-plugin-jest` recommended config (plus opinionated `dev-lib`'s rules) are
204
- enabled. Otherwise disabled ( to not cause "jest not found" errors)
208
+ enabled. Otherwise disabled ( to not cause "jest not found" errors).
package/dist/bin/bt.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin/bt.js DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const jest_util_1 = require("../util/jest.util");
6
- const tsc_util_1 = require("../util/tsc.util");
7
- (0, nodejs_lib_1.runScript)(async () => {
8
- nodejs_lib_1.fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
9
- // fs.rmSync('./dist', { recursive: true, force: true })
10
- await (0, tsc_util_1.tscMainAndScripts)(true);
11
- (0, jest_util_1.runJest)();
12
- });
package/dist/bin/btl.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin/btl.js DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const lint_all_command_1 = require("../cmd/lint-all.command");
6
- const jest_util_1 = require("../util/jest.util");
7
- const tsc_util_1 = require("../util/tsc.util");
8
- (0, nodejs_lib_1.runScript)(async () => {
9
- await (0, lint_all_command_1.lintAllCommand)();
10
- nodejs_lib_1.fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
11
- // fs.rmSync('./dist', { recursive: true, force: true })
12
- await (0, tsc_util_1.tscMainAndScripts)(true);
13
- (0, jest_util_1.runJest)();
14
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const build_copy_command_1 = require("../cmd/build-copy.command");
6
- (0, nodejs_lib_1.runScript)(build_copy_command_1.buildCopyCommand);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const build_prod_esm_cjs_command_1 = require("../cmd/build-prod-esm-cjs.command");
6
- (0, nodejs_lib_1.runScript)(build_prod_esm_cjs_command_1.buildProdESMCJSCommand);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const build_prod_command_1 = require("../cmd/build-prod.command");
6
- (0, nodejs_lib_1.runScript)(build_prod_command_1.buildProdCommand);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin/build.js DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const tsc_util_1 = require("../util/tsc.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- nodejs_lib_1.fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
8
- // fs.rmSync('./dist', { recursive: true, force: true })
9
- await (0, tsc_util_1.tscMainAndScripts)(true);
10
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
- const node_child_process_1 = tslib_1.__importDefault(require("node:child_process"));
6
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
7
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
8
- const paths_cnst_1 = require("../cnst/paths.cnst");
9
- const editMsg = process.argv[process.argv.length - 1] || '.git/COMMIT_EDITMSG';
10
- // console.log(editMsg)
11
- const cwd = process.cwd();
12
- const localConfig = `${cwd}/commitlint.config.js`;
13
- const sharedConfig = `${paths_cnst_1.cfgDir}/commitlint.config.js`;
14
- const config = node_fs_1.default.existsSync(localConfig) ? localConfig : sharedConfig;
15
- const env = {
16
- ...process.env, // important to pass it through, to preserve $PATH
17
- GIT_BRANCH: (0, nodejs_lib_1.gitCurrentBranchName)(),
18
- };
19
- // await execWithArgs(`commitlint`, [`--edit`, editMsg, `--config`, config], { env })
20
- execSync(`node ./node_modules/.bin/commitlint --edit ${editMsg} --config ${config}`, {
21
- env,
22
- });
23
- function execSync(cmd, opt) {
24
- try {
25
- node_child_process_1.default.execSync(cmd, {
26
- ...opt,
27
- encoding: 'utf8',
28
- stdio: 'inherit',
29
- });
30
- }
31
- catch {
32
- process.exit(1);
33
- }
34
- }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const eslint_all_command_1 = require("../cmd/eslint-all.command");
6
- (0, nodejs_lib_1.runScript)(eslint_all_command_1.eslintAllCommand);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const init_from_dev_lib_command_1 = require("../cmd/init-from-dev-lib.command");
6
- (0, nodejs_lib_1.runScript)(init_from_dev_lib_command_1.initFromDevLibCommand);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const lint_all_command_1 = require("../cmd/lint-all.command");
6
- (0, nodejs_lib_1.runScript)(lint_all_command_1.lintAllCommand);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
6
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
7
- const paths_cnst_1 = require("../cnst/paths.cnst");
8
- (0, nodejs_lib_1.runScript)(async () => {
9
- // const cwd = process.cwd()
10
- const localConfig = `./lint-staged.config.js`;
11
- const sharedConfig = `${paths_cnst_1.cfgDir}/lint-staged.config.js`;
12
- const config = node_fs_1.default.existsSync(localConfig) ? localConfig : sharedConfig;
13
- // if (!config) {
14
- // console.log(`lint-staged is skipped, because no ${localConfig} is found`)
15
- // return
16
- // }
17
- // await execWithArgs(`lint-staged`, [`--config`, config])
18
- // const lintStaged = require('lint-staged')
19
- // lint-staged is ESM since 12.0
20
- // const lintStaged = await import('lint-staged')
21
- // eslint-disable-next-line no-eval
22
- const { default: lintStaged } = await eval(`import('lint-staged')`);
23
- const success = await lintStaged({
24
- configPath: config,
25
- });
26
- if (!success)
27
- process.exit(3);
28
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const prettier_util_1 = require("../util/prettier.util");
6
- (0, nodejs_lib_1.runScript)(() => {
7
- (0, prettier_util_1.runPrettier)();
8
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const stylelint_util_1 = require("../util/stylelint.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- (0, stylelint_util_1.stylelintAll)();
8
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const jest_util_1 = require("../util/jest.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- console.log('! "yarn test-ci" is deprecated, use plain `yarn test` instead !');
8
- (0, jest_util_1.runJest)();
9
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const jest_util_1 = require("../util/jest.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- console.log('! "yarn test-integration-ci" is deprecated, use plain `yarn test-integration` instead !');
8
- (0, jest_util_1.runJest)({ integration: true });
9
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const jest_util_1 = require("../util/jest.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- (0, jest_util_1.runJest)({ integration: true });
8
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const jest_util_1 = require("../util/jest.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- (0, jest_util_1.runJest)({ leaks: true });
8
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const jest_util_1 = require("../util/jest.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- (0, jest_util_1.runJest)({ manual: true });
8
- });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin/test.js DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const jest_util_1 = require("../util/jest.util");
6
- (0, nodejs_lib_1.runScript)(async () => {
7
- (0, jest_util_1.runJest)();
8
- });