@naturalcycles/dev-lib 13.39.1 → 13.39.2
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/dist/bin/update-from-dev-lib.js +3 -3
- package/dist/cmd/build-copy.command.js +2 -2
- package/dist/cmd/eslint-all.command.js +2 -2
- package/dist/cmd/init-from-dev-lib.command.js +2 -2
- package/dist/cmd/lint-all.command.js +9 -9
- package/dist/cmd/tsc-prod.command.js +2 -2
- package/dist/util/jest.util.js +3 -3
- package/dist/util/tsc.util.js +8 -8
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const fs_1 = require("@naturalcycles/nodejs-lib/dist/fs");
|
|
5
4
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
5
|
+
const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
|
|
6
6
|
const paths_cnst_1 = require("../cnst/paths.cnst");
|
|
7
|
-
(0,
|
|
8
|
-
(0,
|
|
7
|
+
(0, nodejs_lib_2.runScript)(() => {
|
|
8
|
+
(0, nodejs_lib_1.kpySync)({
|
|
9
9
|
baseDir: paths_cnst_1.cfgOverwriteDir,
|
|
10
10
|
outputDir: './',
|
|
11
11
|
dotfiles: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildCopyCommand = void 0;
|
|
4
|
-
const
|
|
4
|
+
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
5
5
|
function buildCopyCommand() {
|
|
6
6
|
const baseDir = 'src';
|
|
7
7
|
const inputPatterns = [
|
|
@@ -13,7 +13,7 @@ function buildCopyCommand() {
|
|
|
13
13
|
'!**/*.test.js',
|
|
14
14
|
];
|
|
15
15
|
const outputDir = 'dist';
|
|
16
|
-
(0,
|
|
16
|
+
(0, nodejs_lib_1.kpySync)({
|
|
17
17
|
baseDir,
|
|
18
18
|
inputPatterns,
|
|
19
19
|
outputDir,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.eslintAllCommand = void 0;
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
6
|
-
const
|
|
6
|
+
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
7
7
|
const yargs = require("yargs");
|
|
8
8
|
const paths_cnst_1 = require("../cnst/paths.cnst");
|
|
9
9
|
const lint_util_1 = require("../util/lint.util");
|
|
@@ -51,6 +51,6 @@ async function eslintAllCommand() {
|
|
|
51
51
|
// /e2e
|
|
52
52
|
await (0, lint_util_1.runESLintAsync)(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e, undefined, fix);
|
|
53
53
|
}
|
|
54
|
-
console.log(`${(0,
|
|
54
|
+
console.log(`${(0, nodejs_lib_1.boldGrey)('eslint-all')} ${(0, nodejs_lib_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
55
55
|
}
|
|
56
56
|
exports.eslintAllCommand = eslintAllCommand;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initFromDevLibCommand = void 0;
|
|
4
|
-
const
|
|
4
|
+
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
5
5
|
const paths_cnst_1 = require("../cnst/paths.cnst");
|
|
6
6
|
function initFromDevLibCommand() {
|
|
7
|
-
(0,
|
|
7
|
+
(0, nodejs_lib_1.kpySync)({
|
|
8
8
|
baseDir: paths_cnst_1.cfgOverwriteDir,
|
|
9
9
|
outputDir: './',
|
|
10
10
|
dotfiles: true,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lintAllCommand = void 0;
|
|
4
4
|
const fs = require("node:fs");
|
|
5
|
-
const
|
|
5
|
+
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
6
6
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
7
7
|
const yargs = require("yargs");
|
|
8
|
-
const
|
|
8
|
+
const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
|
|
9
9
|
const prettier_util_1 = require("../util/prettier.util");
|
|
10
10
|
const stylelint_util_1 = require("../util/stylelint.util");
|
|
11
11
|
const eslint_all_command_1 = require("./eslint-all.command");
|
|
@@ -24,7 +24,7 @@ async function lintAllCommand() {
|
|
|
24
24
|
default: false,
|
|
25
25
|
},
|
|
26
26
|
}).argv;
|
|
27
|
-
const hadChangesBefore = (0,
|
|
27
|
+
const hadChangesBefore = (0, nodejs_lib_2.gitHasUncommittedChanges)();
|
|
28
28
|
await (0, eslint_all_command_1.eslintAllCommand)();
|
|
29
29
|
if (fs.existsSync(`node_modules/stylelint`) &&
|
|
30
30
|
fs.existsSync(`node_modules/stylelint-config-standard-scss`)) {
|
|
@@ -35,20 +35,20 @@ async function lintAllCommand() {
|
|
|
35
35
|
const ktlintLib = require('@naturalcycles/ktlint');
|
|
36
36
|
await ktlintLib.ktlintAll();
|
|
37
37
|
}
|
|
38
|
-
console.log(`${(0,
|
|
38
|
+
console.log(`${(0, nodejs_lib_1.boldGrey)('lint-all')} ${(0, nodejs_lib_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
39
39
|
if (commitOnChanges || failOnChanges) {
|
|
40
40
|
// detect changes
|
|
41
|
-
const hasChanges = (0,
|
|
41
|
+
const hasChanges = (0, nodejs_lib_2.gitHasUncommittedChanges)();
|
|
42
42
|
if (hasChanges) {
|
|
43
43
|
if (hadChangesBefore) {
|
|
44
44
|
console.log(`lint-all: there are changes before running lint-all, will not commit`);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
const msg = 'style(ci): ' + (0, js_lib_1._truncate)((0,
|
|
47
|
+
const msg = 'style(ci): ' + (0, js_lib_1._truncate)((0, nodejs_lib_2.commitMessageToTitleMessage)((0, nodejs_lib_2.getLastGitCommitMsg)()), 60);
|
|
48
48
|
// pull, commit, push changes
|
|
49
|
-
(0,
|
|
50
|
-
(0,
|
|
51
|
-
(0,
|
|
49
|
+
(0, nodejs_lib_2.gitPull)();
|
|
50
|
+
(0, nodejs_lib_2.gitCommitAll)(msg);
|
|
51
|
+
(0, nodejs_lib_2.gitPush)();
|
|
52
52
|
}
|
|
53
53
|
// fail on changes
|
|
54
54
|
if (failOnChanges) {
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tscProdCommand = void 0;
|
|
4
4
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
5
5
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
6
|
-
const
|
|
6
|
+
const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
|
|
7
7
|
function tscProdCommand() {
|
|
8
8
|
// You cannot have a shared `tsconfig.prod.json` because of relative paths for `include`
|
|
9
9
|
const projectTsconfigPath = `./tsconfig.prod.json`;
|
|
10
10
|
const args = ['-P', projectTsconfigPath];
|
|
11
11
|
const started = Date.now();
|
|
12
12
|
(0, nodejs_lib_1.execVoidCommandSync)(`tsc`, args);
|
|
13
|
-
console.log(`${(0,
|
|
13
|
+
console.log(`${(0, nodejs_lib_2.boldGrey)('tsc prod')} ${(0, nodejs_lib_2.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
14
14
|
}
|
|
15
15
|
exports.tscProdCommand = tscProdCommand;
|
package/dist/util/jest.util.js
CHANGED
|
@@ -5,7 +5,7 @@ const fs = require("node:fs");
|
|
|
5
5
|
const os = require("node:os");
|
|
6
6
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
7
7
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
8
|
-
const
|
|
8
|
+
const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
|
|
9
9
|
const paths_cnst_1 = require("../cnst/paths.cnst");
|
|
10
10
|
const test_util_1 = require("./test.util");
|
|
11
11
|
function getJestConfigPath() {
|
|
@@ -39,7 +39,7 @@ exports.isRunningAllTests = isRunningAllTests;
|
|
|
39
39
|
*/
|
|
40
40
|
function runJest(opt = {}) {
|
|
41
41
|
if (!(0, test_util_1.nodeModuleExists)('jest')) {
|
|
42
|
-
console.log((0,
|
|
42
|
+
console.log((0, nodejs_lib_2.dimGrey)(`node_modules/${(0, nodejs_lib_2.white)('jest')} not found, skipping tests`));
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
const { CI, CIRCLECI, CPU_LIMIT, TZ = 'UTC', APP_ENV, JEST_NO_ALPHABETIC, JEST_SHARDS, NODE_OPTIONS = 'not defined', } = process.env;
|
|
@@ -115,7 +115,7 @@ function runJest(opt = {}) {
|
|
|
115
115
|
}
|
|
116
116
|
const availableParallelism = os.availableParallelism?.();
|
|
117
117
|
const cpus = os.cpus().length;
|
|
118
|
-
console.log(`${(0,
|
|
118
|
+
console.log(`${(0, nodejs_lib_2.dimGrey)(Object.entries({
|
|
119
119
|
node,
|
|
120
120
|
NODE_OPTIONS,
|
|
121
121
|
cpus,
|
package/dist/util/tsc.util.js
CHANGED
|
@@ -4,8 +4,8 @@ exports.ensureProjectTsconfigScripts = exports.tscScriptsAsync = exports.tscScri
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
6
6
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
|
|
8
|
+
const nodejs_lib_3 = require("@naturalcycles/nodejs-lib");
|
|
9
9
|
const paths_cnst_1 = require("../cnst/paths.cnst");
|
|
10
10
|
async function tscMainAndScripts(noEmit = false) {
|
|
11
11
|
await Promise.all([tscAsync(noEmit), tscScriptsAsync()]);
|
|
@@ -15,14 +15,14 @@ function tsc(noEmit = false) {
|
|
|
15
15
|
const started = Date.now();
|
|
16
16
|
const args = [noEmit && '--noEmit'].filter(js_lib_1._isTruthy);
|
|
17
17
|
(0, nodejs_lib_1.execVoidCommandSync)('tsc', args);
|
|
18
|
-
console.log(`${(0,
|
|
18
|
+
console.log(`${(0, nodejs_lib_2.boldGrey)('tsc')} ${(0, nodejs_lib_2.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
19
19
|
}
|
|
20
20
|
exports.tsc = tsc;
|
|
21
21
|
async function tscAsync(noEmit = false) {
|
|
22
22
|
const started = Date.now();
|
|
23
23
|
const args = [noEmit && '--noEmit'].filter(js_lib_1._isTruthy);
|
|
24
24
|
await (0, nodejs_lib_1.execVoidCommand)('tsc', args);
|
|
25
|
-
console.log(`${(0,
|
|
25
|
+
console.log(`${(0, nodejs_lib_2.boldGrey)('tsc')} ${(0, nodejs_lib_2.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
26
26
|
}
|
|
27
27
|
exports.tscAsync = tscAsync;
|
|
28
28
|
function tscScripts() {
|
|
@@ -34,7 +34,7 @@ function tscScripts() {
|
|
|
34
34
|
const args = ['-P', projectTsconfigPath, '--noEmit'];
|
|
35
35
|
const started = Date.now();
|
|
36
36
|
(0, nodejs_lib_1.execVoidCommandSync)(`tsc`, args);
|
|
37
|
-
console.log(`${(0,
|
|
37
|
+
console.log(`${(0, nodejs_lib_2.boldGrey)('tsc scripts')} ${(0, nodejs_lib_2.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
38
38
|
}
|
|
39
39
|
exports.tscScripts = tscScripts;
|
|
40
40
|
async function tscScriptsAsync() {
|
|
@@ -46,7 +46,7 @@ async function tscScriptsAsync() {
|
|
|
46
46
|
const args = ['-P', projectTsconfigPath, '--noEmit'];
|
|
47
47
|
const started = Date.now();
|
|
48
48
|
await (0, nodejs_lib_1.execVoidCommand)(`tsc`, args);
|
|
49
|
-
console.log(`${(0,
|
|
49
|
+
console.log(`${(0, nodejs_lib_2.boldGrey)('tsc scripts')} ${(0, nodejs_lib_2.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
50
50
|
}
|
|
51
51
|
exports.tscScriptsAsync = tscScriptsAsync;
|
|
52
52
|
/**
|
|
@@ -57,12 +57,12 @@ function ensureProjectTsconfigScripts() {
|
|
|
57
57
|
if (!fs.existsSync(projectTsconfigPath)) {
|
|
58
58
|
// You cannot just use a shared `tsconfig.scripts.json` because of relative paths for `include`
|
|
59
59
|
// So, it will be copied into the project
|
|
60
|
-
(0,
|
|
60
|
+
(0, nodejs_lib_3.kpySync)({
|
|
61
61
|
baseDir: `${paths_cnst_1.cfgDir}/init/scripts/`,
|
|
62
62
|
inputPatterns: ['tsconfig.json'],
|
|
63
63
|
outputDir: './scripts',
|
|
64
64
|
});
|
|
65
|
-
console.log(`${(0,
|
|
65
|
+
console.log(`${(0, nodejs_lib_2.boldGrey)('/scripts/tsconfig.json')} file is automatically added`);
|
|
66
66
|
}
|
|
67
67
|
return projectTsconfigPath;
|
|
68
68
|
}
|