@naturalcycles/dev-lib 12.14.1 → 12.16.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/jest.config.js +8 -1
- package/cfg/jest.integration-test.config.js +15 -2
- package/cfg/jest.manual-test.config.js +1 -2
- package/cfg/lint-staged.config.js +8 -1
- package/cfg/overwrite/.editorconfig +15 -11
- package/dist/cmd/lint-all.command.js +7 -4
- package/package.json +4 -4
- package/readme.md +3 -4
package/cfg/jest.config.js
CHANGED
|
@@ -83,6 +83,11 @@ module.exports = {
|
|
|
83
83
|
},
|
|
84
84
|
testEnvironment: 'node',
|
|
85
85
|
errorOnDeprecated: true,
|
|
86
|
+
// this config would have the snapshot formatter not print a prefix for "Object" and "Array"
|
|
87
|
+
// snapshotFormat: {
|
|
88
|
+
// printBasicPrototype: false,
|
|
89
|
+
// },
|
|
90
|
+
restoreMocks: true,
|
|
86
91
|
unmockedModulePathPatterns: [],
|
|
87
92
|
setupFilesAfterEnv,
|
|
88
93
|
collectCoverageFrom: [
|
|
@@ -107,10 +112,12 @@ module.exports = {
|
|
|
107
112
|
'!**/*.component.ts',
|
|
108
113
|
'!**/*.modal.ts',
|
|
109
114
|
],
|
|
115
|
+
// default: ["clover", "json", "lcov", "text"]
|
|
116
|
+
coverageReporters: ['clover', 'json', 'lcov', !CI && 'text'].filter(Boolean),
|
|
110
117
|
// CI: only jest-junit reporter (no default)
|
|
111
118
|
// not-CI: only default reporter, but not jest-junit
|
|
112
119
|
reporters: [
|
|
113
|
-
|
|
120
|
+
'default',
|
|
114
121
|
CI && [
|
|
115
122
|
'jest-junit',
|
|
116
123
|
{
|
|
@@ -22,6 +22,19 @@ module.exports = {
|
|
|
22
22
|
testMatch: ['<rootDir>/src/**/*.integration.test.ts'],
|
|
23
23
|
testPathIgnorePatterns: ['<rootDir>/.*/__exclude/'],
|
|
24
24
|
setupFilesAfterEnv,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
reporters: [
|
|
26
|
+
'default',
|
|
27
|
+
CI && [
|
|
28
|
+
'jest-junit',
|
|
29
|
+
{
|
|
30
|
+
suiteName: 'jest tests',
|
|
31
|
+
outputDirectory: './tmp/jest',
|
|
32
|
+
outputName: 'integration.xml',
|
|
33
|
+
suiteNameTemplate: '{filepath}',
|
|
34
|
+
classNameTemplate: '{classname}',
|
|
35
|
+
titleTemplate: '{title}',
|
|
36
|
+
ancestorSeparator: ' ',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
].filter(Boolean),
|
|
27
40
|
}
|
|
@@ -79,7 +79,14 @@ const linters = {
|
|
|
79
79
|
'**/*.{kt,kts}': match => {
|
|
80
80
|
const filesList = micromatch.not(match, lintExclude).join(' ')
|
|
81
81
|
if (!filesList) return []
|
|
82
|
-
|
|
82
|
+
const dir = './node_modules/@naturalcycles/ktlint'
|
|
83
|
+
|
|
84
|
+
if (!fs.existsSync(dir)) {
|
|
85
|
+
console.log(`!!\n!! Please install @naturalcycles/ktlint to lint *.kt files\n!!\n`, filesList)
|
|
86
|
+
return []
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return [`${dir}/resources/ktlint -F ${filesList}`]
|
|
83
90
|
},
|
|
84
91
|
}
|
|
85
92
|
|
|
@@ -14,35 +14,39 @@ end_of_line = lf
|
|
|
14
14
|
trim_trailing_whitespace = true
|
|
15
15
|
insert_final_newline = true
|
|
16
16
|
|
|
17
|
-
[
|
|
17
|
+
[*.md]
|
|
18
18
|
trim_trailing_whitespace = false
|
|
19
19
|
indent_size = 4
|
|
20
20
|
|
|
21
|
-
[
|
|
21
|
+
[*.html]
|
|
22
22
|
indent_size = 2
|
|
23
23
|
|
|
24
|
-
[
|
|
24
|
+
[*.{css,scss}]
|
|
25
25
|
indent_size = 2
|
|
26
26
|
|
|
27
|
-
[
|
|
27
|
+
[*.{js,ts}]
|
|
28
28
|
indent_size = 2
|
|
29
29
|
|
|
30
|
-
[
|
|
30
|
+
[*.json]
|
|
31
31
|
indent_size = 2
|
|
32
32
|
|
|
33
|
-
[
|
|
34
|
-
indent_size = 2
|
|
35
|
-
|
|
36
|
-
[**.java]
|
|
33
|
+
[*.java]
|
|
37
34
|
indent_size = 4
|
|
38
35
|
|
|
39
|
-
[
|
|
36
|
+
[*.{kt,kts}]
|
|
37
|
+
disabled_rules=no-wildcard-imports
|
|
38
|
+
ij_kotlin_imports_layout=*,java.**,javax.**,kotlin.**,^ # default IntelliJ IDEA style, same as alphabetical, but with "java", "javax", "kotlin" and alias imports in the end of the imports list
|
|
39
|
+
|
|
40
|
+
[*.xml]
|
|
41
|
+
indent_size = 2
|
|
42
|
+
|
|
43
|
+
[*.sql]
|
|
40
44
|
indent_size = 2
|
|
41
45
|
|
|
42
46
|
[.eslintrc]
|
|
43
47
|
indent_size = 2
|
|
44
48
|
|
|
45
|
-
[
|
|
49
|
+
[*.min.*]
|
|
46
50
|
indent_style = ignore
|
|
47
51
|
trim_trailing_whitespace = false
|
|
48
52
|
insert_final_newline = ignore
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lintAllCommand = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
4
5
|
const yargs = require("yargs");
|
|
5
6
|
const git_util_1 = require("../util/git.util");
|
|
6
7
|
const prettier_util_1 = require("../util/prettier.util");
|
|
@@ -21,10 +22,14 @@ async function lintAllCommand() {
|
|
|
21
22
|
},
|
|
22
23
|
}).argv;
|
|
23
24
|
const hadChangesBefore = await (0, git_util_1.gitHasUncommittedChanges)();
|
|
24
|
-
// Currently we position ESLint before TSLint, but let's monitor if it's ok
|
|
25
25
|
await (0, eslint_all_command_1.eslintAllCommand)();
|
|
26
26
|
await (0, stylelint_util_1.stylelintAll)();
|
|
27
27
|
await (0, prettier_util_1.runPrettier)();
|
|
28
|
+
// Running ktlintAll (experimental!)
|
|
29
|
+
if (fs.existsSync(`node_modules/@naturalcycles/ktlint`)) {
|
|
30
|
+
const ktlintLib = require('@naturalcycles/ktlint');
|
|
31
|
+
await ktlintLib.ktlintAll();
|
|
32
|
+
}
|
|
28
33
|
if (commitOnChanges || failOnChanges) {
|
|
29
34
|
// detect changes
|
|
30
35
|
const hasChanges = await (0, git_util_1.gitHasUncommittedChanges)();
|
|
@@ -33,9 +38,7 @@ async function lintAllCommand() {
|
|
|
33
38
|
console.log(`lint-all: there are changes before running lint-all, will not commit`);
|
|
34
39
|
}
|
|
35
40
|
else {
|
|
36
|
-
const msg = 'style(
|
|
37
|
-
(0, git_util_1.commitMessageToTitleMessage)(await (0, git_util_1.getLastGitCommitMsg)()) +
|
|
38
|
-
'\n\n[skip ci]';
|
|
41
|
+
const msg = 'style(ci): ' + (0, git_util_1.commitMessageToTitleMessage)(await (0, git_util_1.getLastGitCommitMsg)()) + '\n\n[skip ci]';
|
|
39
42
|
// pull, commit, push changes
|
|
40
43
|
await (0, git_util_1.gitPull)();
|
|
41
44
|
await (0, git_util_1.gitCommitAll)(msg);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.16.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"tsn-debug": "tsn testScript.ts",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"update-from-dev-lib": "tsn ./src/bin/update-from-dev-lib.ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@commitlint/cli": "^
|
|
34
|
-
"@commitlint/config-conventional": "^
|
|
33
|
+
"@commitlint/cli": "^16.0.1",
|
|
34
|
+
"@commitlint/config-conventional": "^16.0.0",
|
|
35
35
|
"@naturalcycles/cli": "^1.0.0",
|
|
36
36
|
"@naturalcycles/js-lib": "^14.0.0",
|
|
37
37
|
"@naturalcycles/nodejs-lib": "^12.0.0",
|
|
38
38
|
"@naturalcycles/time-lib": "^3.0.1",
|
|
39
39
|
"@types/fs-extra": "^9.0.0",
|
|
40
40
|
"@types/jest": "^27.0.0",
|
|
41
|
-
"@types/node": "^
|
|
41
|
+
"@types/node": "^17.0.0",
|
|
42
42
|
"@types/yargs": "^16.0.0",
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
44
44
|
"@typescript-eslint/parser": "^5.0.0",
|
package/readme.md
CHANGED
|
@@ -149,11 +149,10 @@ Pass `--ext` (e.g `--ext ts,html`) to override the list of ESLint extensions (de
|
|
|
149
149
|
|
|
150
150
|
`ktlint` will be used by lint-staged for all `**/*.{kt,kts}` files.
|
|
151
151
|
|
|
152
|
-
Please install it with `brew install ktlint
|
|
152
|
+
~~Please install it with `brew install ktlint`.~~
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
[
|
|
156
|
-
install a working version.
|
|
154
|
+
Install it **locally** in you project by adding
|
|
155
|
+
[`@naturalcycles/ktlint`](https://github.com/NaturalCycles/ktlint) to your **dev**Dependencies.
|
|
157
156
|
|
|
158
157
|
#### Other commands
|
|
159
158
|
|