@averay/codeformat 0.2.9 → 0.2.11
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/README.md +12 -2
- package/dist/bin/tools/knip.js +3 -2
- package/dist/bin/tools/knip.js.map +1 -1
- package/dist/rulesets/eslint/ruleset-shared.d.ts +1 -1
- package/dist/rulesets/eslint/ruleset-shared.js +1 -2
- package/dist/rulesets/eslint/ruleset-shared.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/makePrettierConfig.d.ts +12 -0
- package/dist/src/makePrettierConfig.js +24 -0
- package/dist/src/makePrettierConfig.js.map +1 -0
- package/package.json +13 -11
- package/.php-cs-fixer.cache +0 -1
- package/.php-cs-fixer.php +0 -9
- package/.prettierrc.json +0 -8
- package/.stylelintignore +0 -3
- package/CODE_OF_CONDUCT.md +0 -83
- package/bin/codeformat.ts +0 -27
- package/bin/tools/eslint.ts +0 -17
- package/bin/tools/index.ts +0 -6
- package/bin/tools/knip.ts +0 -21
- package/bin/tools/phpCsFixer.ts +0 -16
- package/bin/tools/prettier.ts +0 -20
- package/bin/tools/stylelint.ts +0 -16
- package/bin/tools/tsc.ts +0 -12
- package/bin/utils/Cli.ts +0 -80
- package/bin/utils/Output.ts +0 -30
- package/bin/utils/ToolRunner.ts +0 -64
- package/bin/utils/filesystem.ts +0 -22
- package/bin/utils/runners.ts +0 -10
- package/bin/utils/types.ts +0 -24
- package/composer.json +0 -6
- package/composer.lock +0 -3507
- package/eslint.config.js +0 -34
- package/knip.config.ts +0 -18
- package/lib/convertWarnsToErrors.ts +0 -43
- package/lib/cssPatterns.ts +0 -20
- package/rulesets/eslint/ruleset-shared.ts +0 -362
- package/rulesets/eslint/ruleset-typescript.ts +0 -239
- package/rulesets/php/ruleset-php-cs-fixer.php +0 -93
- package/rulesets/stylelint/ruleset-css.ts +0 -39
- package/rulesets/stylelint/ruleset-scss.ts +0 -47
- package/src/extensions.ts +0 -7
- package/src/index.ts +0 -4
- package/src/makeEslintConfig.ts +0 -97
- package/src/makeStylelintConfig.ts +0 -46
- package/stylelint.config.js +0 -7
- package/tsconfig.build.json +0 -13
- /package/{src → dist/src}/php/PhpCsFixerConfig.php +0 -0
package/README.md
CHANGED
|
@@ -16,6 +16,16 @@ A very opinionated collection of configurations for a number of code formatting
|
|
|
16
16
|
|
|
17
17
|
4. Lint the codebase with `bun x codeformat check`, or apply automatic fixes with `bun x codeformat fix`
|
|
18
18
|
|
|
19
|
+
### Prettier
|
|
20
|
+
|
|
21
|
+
Create a `prettier.config.mjs` file with the following configuration:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import makePrettierConfig from '@averay/codeformat';
|
|
25
|
+
|
|
26
|
+
export default makePrettierConfig(/* Customisations can be made here */);
|
|
27
|
+
```
|
|
28
|
+
|
|
19
29
|
### ESLint
|
|
20
30
|
|
|
21
31
|
Create an `eslint.config.js` file with the following configuration:
|
|
@@ -64,9 +74,9 @@ Create a `.php-cs-fixer.php` file with the following configuration:
|
|
|
64
74
|
declare(strict_types=1);
|
|
65
75
|
|
|
66
76
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
67
|
-
require_once __DIR__ . '/node_modules/@averay/codeformat/src/php/PhpCsFixerConfig.php';
|
|
77
|
+
require_once __DIR__ . '/node_modules/@averay/codeformat/dist/src/php/PhpCsFixerConfig.php';
|
|
68
78
|
|
|
69
|
-
$finder =
|
|
79
|
+
$finder = new PhpCsFixer\Finder()->in([__DIR__]);
|
|
70
80
|
|
|
71
81
|
return PhpCsFixerConfig::default($finder);
|
|
72
82
|
```
|
package/dist/bin/tools/knip.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { commonExts, withExts } from "../utils/filesystem.js";
|
|
2
2
|
import runners from "../utils/runners.js";
|
|
3
|
+
const commonArgs = ['--treat-config-hints-as-errors', '--isolate-workspaces'];
|
|
3
4
|
export default {
|
|
4
5
|
exec: runners.bun,
|
|
5
6
|
command: 'knip',
|
|
6
7
|
actions: (configPath) => ({
|
|
7
|
-
check: ['--config', configPath],
|
|
8
|
-
fix: ['--fix', '--config', configPath],
|
|
8
|
+
check: ['--config', configPath, ...commonArgs],
|
|
9
|
+
fix: ['--fix', '--config', configPath, ...commonArgs],
|
|
9
10
|
}),
|
|
10
11
|
args: {
|
|
11
12
|
debug: ['--debug'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip.js","sourceRoot":"","sources":["../../../bin/tools/knip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,eAAe;IACb,IAAI,EAAE,OAAO,CAAC,GAAG;IACjB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACxB,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"knip.js","sourceRoot":"","sources":["../../../bin/tools/knip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,MAAM,UAAU,GAAG,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC;AAC9E,eAAe;IACb,IAAI,EAAE,OAAO,CAAC,GAAG;IACjB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACxB,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;QAC9C,GAAG,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;KACtD,CAAC;IACF,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC,SAAS,CAAC;QAClB,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,CAAC;KAC/D;IACD,WAAW,EAAE;QACX,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QAC1E,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;KACjE;CACa,CAAC"}
|
|
@@ -117,7 +117,7 @@ declare const _default: {
|
|
|
117
117
|
'import-x/no-empty-named-blocks': "error";
|
|
118
118
|
'import-x/no-extraneous-dependencies': "error";
|
|
119
119
|
'import-x/no-mutable-exports': "error";
|
|
120
|
-
'import-x/no-named-as-default-member': "
|
|
120
|
+
'import-x/no-named-as-default-member': "off";
|
|
121
121
|
'import-x/no-named-default': "error";
|
|
122
122
|
'import-x/no-self-import': "error";
|
|
123
123
|
'import-x/no-unresolved': ["error", {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint import-x/no-named-as-default-member: "off" -- All plugins follow the same naming conventions. */
|
|
2
1
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
3
2
|
import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
|
|
4
3
|
import importPlugin from 'eslint-plugin-import-x';
|
|
@@ -238,7 +237,7 @@ export default {
|
|
|
238
237
|
'import-x/no-empty-named-blocks': 'error',
|
|
239
238
|
'import-x/no-extraneous-dependencies': 'error',
|
|
240
239
|
'import-x/no-mutable-exports': 'error',
|
|
241
|
-
'import-x/no-named-as-default-member': '
|
|
240
|
+
'import-x/no-named-as-default-member': 'off', // Overbearing
|
|
242
241
|
'import-x/no-named-default': 'error',
|
|
243
242
|
'import-x/no-self-import': 'error',
|
|
244
243
|
'import-x/no-unresolved': ['error', { caseSensitiveStrict: true }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruleset-shared.js","sourceRoot":"","sources":["../../../rulesets/eslint/ruleset-shared.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ruleset-shared.js","sourceRoot":"","sources":["../../../rulesets/eslint/ruleset-shared.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,0BAA0B,CAAC;AAEvD,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAElD,eAAe;IACb,GAAG;QACD,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QACpD,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,sBAAsB,EAAE;YACtB,OAAO;YACP,QAAQ;YACR;gBACE,yBAAyB,EAAE,IAAI;gBAC/B,aAAa,EAAE,YAAY,CAAC,MAAM,EAAE,yCAAyC;aAC9E;SACF;QACD,mBAAmB,EAAE,OAAO;QAC5B,iBAAiB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;QACrC,mBAAmB,EAAE,OAAO;QAC5B,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;QACvB,cAAc,EAAE,OAAO;QACvB,mBAAmB,EAAE,OAAO;QAC5B,oBAAoB,EAAE,OAAO;QAC7B,cAAc,EAAE,OAAO;QACvB,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC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AE,CAAC;IAEpE,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;IAC1C,qCAAqC,EAAE,CAAC,OAAO,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAChF,uBAAuB,EAAE,KAAK;IAC9B,iBAAiB,EAAE,KAAK;IACxB,8BAA8B,EAAE,KAAK,EAAE,sCAAsC;IAC7E,6BAA6B,EAAE,OAAO;IACtC,+BAA+B,EAAE,KAAK;IACtC,+BAA+B,EAAE,KAAK;IACtC,4CAA4C,EAAE,OAAO;IACrD,uCAAuC,EAAE,KAAK,EAAE,2BAA2B;CACxC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as globals } from 'globals';
|
|
2
2
|
export { default as extensions } from './extensions.ts';
|
|
3
3
|
export { default as makeEslintConfig } from './makeEslintConfig.ts';
|
|
4
|
+
export { default as makePrettierConfig } from './makePrettierConfig.ts';
|
|
4
5
|
export { default as makeStylelintConfig } from './makeStylelintConfig.ts';
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as globals } from 'globals';
|
|
2
2
|
export { default as extensions } from "./extensions.js";
|
|
3
3
|
export { default as makeEslintConfig } from "./makeEslintConfig.js";
|
|
4
|
+
export { default as makePrettierConfig } from "./makePrettierConfig.js";
|
|
4
5
|
export { default as makeStylelintConfig } from "./makeStylelintConfig.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Config } from 'prettier';
|
|
2
|
+
interface Plugins {
|
|
3
|
+
php?: boolean;
|
|
4
|
+
xml?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @param root1 Included plugins to enable.
|
|
8
|
+
* @param root2 Project-specific customisations.
|
|
9
|
+
* @returns The complete Prettier config.
|
|
10
|
+
*/
|
|
11
|
+
export default function makePrettierConfig({ php, xml }?: Plugins, { plugins, ...config }?: Config): Config;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint sort-keys: "error" -- Organise rules */
|
|
2
|
+
/**
|
|
3
|
+
* @param root1 Included plugins to enable.
|
|
4
|
+
* @param root2 Project-specific customisations.
|
|
5
|
+
* @returns The complete Prettier config.
|
|
6
|
+
*/
|
|
7
|
+
export default function makePrettierConfig({ php = false, xml = false } = {}, { plugins = [], ...config } = {}) {
|
|
8
|
+
if (php) {
|
|
9
|
+
plugins.push('@prettier/plugin-php');
|
|
10
|
+
}
|
|
11
|
+
if (xml) {
|
|
12
|
+
plugins.push('@prettier/plugin-xml');
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
arrowParens: 'always',
|
|
16
|
+
plugins,
|
|
17
|
+
proseWrap: 'never',
|
|
18
|
+
semi: true,
|
|
19
|
+
singleQuote: true,
|
|
20
|
+
trailingComma: 'all',
|
|
21
|
+
...config,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=makePrettierConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makePrettierConfig.js","sourceRoot":"","sources":["../../src/makePrettierConfig.ts"],"names":[],"mappings":"AAAA,iDAAiD;AASjD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,EAAE,GAAG,GAAG,KAAK,EAAE,GAAG,GAAG,KAAK,KAAc,EAAE,EAC1C,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,MAAM,KAAa,EAAE;IAExC,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC;IACD,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,OAAO;QACP,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE,KAAK;QACpB,GAAG,MAAM;KACV,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@averay/codeformat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"author": "Adam Averay (https://adamaveray.com.au/)",
|
|
5
5
|
"homepage": "https://github.com/adamaveray/codeformat",
|
|
6
6
|
"repository": {
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"main": "dist/src/index.js",
|
|
20
20
|
"types": "dist/src/index.d.ts",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "rm -rf dist && bun run build:tsc && chmod +x dist/bin/*.js",
|
|
22
|
+
"build": "rm -rf dist && bun run build:tsc && bun run build:php && chmod +x dist/bin/*.js",
|
|
23
23
|
"build:tsc": "bun --bun x tsc --project tsconfig.build.json --outDir dist",
|
|
24
|
+
"build:php": "cp -R src/php dist/src/",
|
|
24
25
|
"test": "bun test",
|
|
25
26
|
"format": "dist/bin/codeformat.js fix",
|
|
26
27
|
"lint": "dist/bin/codeformat.js check",
|
|
@@ -31,18 +32,18 @@
|
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@averay/css-properties-sort-order": "^1.0.3",
|
|
34
|
-
"@eslint/js": "^9.
|
|
35
|
-
"@prettier/plugin-php": "^0.
|
|
36
|
-
"@prettier/plugin-xml": "^3.4.
|
|
37
|
-
"@stylistic/eslint-plugin": "^
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
39
|
-
"@typescript-eslint/parser": "^8.
|
|
40
|
-
"@typescript-eslint/utils": "^8.
|
|
35
|
+
"@eslint/js": "^9.31.0",
|
|
36
|
+
"@prettier/plugin-php": "^0.24.0",
|
|
37
|
+
"@prettier/plugin-xml": "^3.4.2",
|
|
38
|
+
"@stylistic/eslint-plugin": "^5.2.0",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.37.0",
|
|
40
|
+
"@typescript-eslint/parser": "^8.37.0",
|
|
41
|
+
"@typescript-eslint/utils": "^8.37.0",
|
|
41
42
|
"eslint-config-prettier": "^10.1.5",
|
|
42
43
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
43
44
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
44
45
|
"eslint-plugin-import-x": "^4.16.1",
|
|
45
|
-
"eslint-plugin-jsdoc": "^51.
|
|
46
|
+
"eslint-plugin-jsdoc": "^51.4.1",
|
|
46
47
|
"eslint-plugin-promise": "^7.2.1",
|
|
47
48
|
"eslint-plugin-regexp": "^2.9.0",
|
|
48
49
|
"eslint-plugin-sonarjs": "^3.0.4",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"globals": "^16.3.0",
|
|
51
52
|
"knip": "^5.61.3",
|
|
52
53
|
"postcss-scss": "^4.0.9",
|
|
54
|
+
"prettier": "^3.6.2",
|
|
53
55
|
"stylelint": "^16.21.1",
|
|
54
56
|
"stylelint-config-recommended": "^16.0.0",
|
|
55
57
|
"stylelint-config-recommended-scss": "^15.0.1",
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
"stylelint-order": "^7.0.0",
|
|
59
61
|
"stylelint-scss": "^6.12.1",
|
|
60
62
|
"stylelint-use-logical": "^2.1.2",
|
|
61
|
-
"typescript-eslint": "^8.
|
|
63
|
+
"typescript-eslint": "^8.37.0"
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
64
66
|
"@types/bun": "latest",
|
package/.php-cs-fixer.cache
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"php":"8.4.10","version":"3.82.0:v3.82.0#db2a44dc899d40f20609f0ea53e952c64c028968","indent":" ","lineEnding":"\n","rules":{"empty_loop_body":{"style":"braces"},"explicit_indirect_variable":true,"explicit_string_variable":true,"fully_qualified_strict_types":{"leading_backslash_in_global_namespace":true},"heredoc_to_nowdoc":true,"method_argument_space":{"on_multiline":"ignore"},"multiline_comment_opening_closing":true,"no_superfluous_elseif":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","return","switch_case","yield","yield_from"]},"no_useless_return":true,"ordered_class_elements":{"order":["use_trait","case","constant_public","constant_protected","constant_private","property_static","property","construct","destruct"]},"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"php_unit_data_provider_method_order":true,"php_unit_internal_class":true,"php_unit_test_class_requires_covers":true,"phpdoc_add_missing_param_annotation":true,"phpdoc_no_empty_return":true,"phpdoc_order_by_value":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_annotation_correct_order":true,"protected_to_private":true,"self_static_accessor":true,"single_line_comment_style":{"comment_types":["hash"]},"string_implicit_backslashes":{"single_quoted":"escape","double_quoted":"escape","heredoc":"escape"},"trailing_comma_in_multiline":{"after_heredoc":true,"elements":["array_destructuring","arrays","match","parameters"]},"function_declaration":{"closure_fn_spacing":"none"},"binary_operator_spaces":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"declare_equal_normalize":true,"no_leading_import_slash":true,"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"elseif":true,"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace_in_comment":true,"single_class_element_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"align_multiline_comment":true,"backtick_to_shell_exec":true,"class_attributes_separation":{"elements":{"method":"one"}},"class_reference_name_casing":true,"clean_namespace":true,"echo_tag_syntax":true,"empty_loop_condition":true,"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":{"style":"post"},"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_method_casing":true,"native_function_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"normalize_index_brace":true,"nullable_type_declaration":true,"nullable_type_declaration_for_default_null_value":true,"object_operator_without_whitespace":true,"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]]},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_to_comment":{"ignored_tags":["lang","noinspection","psalm-suppress","psalm-type","var"]},"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_line_comment_spacing":true,"single_quote":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"switch_continue_to_break":true,"yoda_style":{"equal":false,"identical":false,"less_and_greater":false},"heredoc_indentation":{"indentation":"same_as_start"},"native_function_invocation":{"include":["@internal"]},"phpdoc_tag_casing":true},"hashes":{"node_modules\/flatted\/php\/flatted.php":"f14b68ad8e8fbb323f1f10b4d1aae9d6","node_modules\/eslint\/node_modules\/file-entry-cache\/node_modules\/flat-cache\/node_modules\/flatted\/php\/flatted.php":"f14b68ad8e8fbb323f1f10b4d1aae9d6","rulesets\/php\/ruleset-php-cs-fixer.php":"54d87c5d50f8f595effd97e98ea08e2e","src\/php\/PhpCsFixerConfig.php":"9f68e454702a74221862e8424dbf4c3e"}}
|
package/.php-cs-fixer.php
DELETED
package/.prettierrc.json
DELETED
package/.stylelintignore
DELETED
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
-
|
|
9
|
-
## Our Standards
|
|
10
|
-
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
-
|
|
13
|
-
- Demonstrating empathy and kindness toward other people
|
|
14
|
-
- Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
-
- Giving and gracefully accepting constructive feedback
|
|
16
|
-
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
-
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
-
|
|
19
|
-
Examples of unacceptable behavior include:
|
|
20
|
-
|
|
21
|
-
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
-
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
-
- Public or private harassment
|
|
24
|
-
- Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
-
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
-
|
|
27
|
-
## Enforcement Responsibilities
|
|
28
|
-
|
|
29
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
-
|
|
31
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
-
|
|
33
|
-
## Scope
|
|
34
|
-
|
|
35
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
-
|
|
37
|
-
## Enforcement
|
|
38
|
-
|
|
39
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
-
|
|
41
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
-
|
|
43
|
-
## Enforcement Guidelines
|
|
44
|
-
|
|
45
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
-
|
|
47
|
-
### 1. Correction
|
|
48
|
-
|
|
49
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
-
|
|
51
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
|
-
|
|
53
|
-
### 2. Warning
|
|
54
|
-
|
|
55
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
|
56
|
-
|
|
57
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
-
|
|
59
|
-
### 3. Temporary Ban
|
|
60
|
-
|
|
61
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
-
|
|
63
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
64
|
-
|
|
65
|
-
### 4. Permanent Ban
|
|
66
|
-
|
|
67
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
68
|
-
|
|
69
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
70
|
-
|
|
71
|
-
## Attribution
|
|
72
|
-
|
|
73
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
74
|
-
|
|
75
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][mozilla coc].
|
|
76
|
-
|
|
77
|
-
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][faq]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
78
|
-
|
|
79
|
-
[homepage]: https://www.contributor-covenant.org
|
|
80
|
-
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
81
|
-
[mozilla coc]: https://github.com/mozilla/diversity
|
|
82
|
-
[faq]: https://www.contributor-covenant.org/faq
|
|
83
|
-
[translations]: https://www.contributor-covenant.org/translations
|
package/bin/codeformat.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import { eslint, knip, phpCsFixer, prettier, stylelint, tsc } from './tools/index.ts';
|
|
4
|
-
import Cli from './utils/Cli.ts';
|
|
5
|
-
import ToolRunner from './utils/ToolRunner.ts';
|
|
6
|
-
|
|
7
|
-
const { cli, selectedAction, selectedTool } = Cli.createFromArgs(Bun.argv);
|
|
8
|
-
|
|
9
|
-
const runner = new ToolRunner(cli, {
|
|
10
|
-
// Common
|
|
11
|
-
prettier,
|
|
12
|
-
knip,
|
|
13
|
-
|
|
14
|
-
// JavaScript/TypeScript
|
|
15
|
-
tsc,
|
|
16
|
-
eslint,
|
|
17
|
-
|
|
18
|
-
// Other languages
|
|
19
|
-
stylelint,
|
|
20
|
-
phpCsFixer,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
await runner.run(selectedAction, selectedTool);
|
|
25
|
-
} catch (error) {
|
|
26
|
-
cli.output.error('Error:', [error]);
|
|
27
|
-
}
|
package/bin/tools/eslint.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { commonExts, withExts } from '../utils/filesystem.ts';
|
|
2
|
-
import runners from '../utils/runners.ts';
|
|
3
|
-
import type { Tool } from '../utils/types.ts';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
exec: runners.bun,
|
|
7
|
-
command: 'eslint',
|
|
8
|
-
actions: (configPath) => ({
|
|
9
|
-
check: ['--config', configPath, '.'],
|
|
10
|
-
fix: ['--fix', '--config', configPath, '.'],
|
|
11
|
-
}),
|
|
12
|
-
args: {
|
|
13
|
-
debug: ['-vvv'],
|
|
14
|
-
cache: (cacheDir) => ['--cache', '--cache-location', cacheDir],
|
|
15
|
-
},
|
|
16
|
-
configFiles: withExts('eslint.config', [...commonExts.js, ...commonExts.ts]),
|
|
17
|
-
} satisfies Tool;
|
package/bin/tools/index.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as eslint } from './eslint.ts';
|
|
2
|
-
export { default as knip } from './knip.ts';
|
|
3
|
-
export { default as phpCsFixer } from './phpCsFixer.ts';
|
|
4
|
-
export { default as prettier } from './prettier.ts';
|
|
5
|
-
export { default as stylelint } from './stylelint.ts';
|
|
6
|
-
export { default as tsc } from './tsc.ts';
|
package/bin/tools/knip.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { commonExts, withExts } from '../utils/filesystem.ts';
|
|
2
|
-
import runners from '../utils/runners.ts';
|
|
3
|
-
import type { Tool } from '../utils/types.ts';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
exec: runners.bun,
|
|
7
|
-
command: 'knip',
|
|
8
|
-
actions: (configPath) => ({
|
|
9
|
-
check: ['--config', configPath],
|
|
10
|
-
fix: ['--fix', '--config', configPath],
|
|
11
|
-
}),
|
|
12
|
-
args: {
|
|
13
|
-
debug: ['--debug'],
|
|
14
|
-
cache: (cacheDir) => ['--cache', '--cache-location', cacheDir],
|
|
15
|
-
},
|
|
16
|
-
configFiles: [
|
|
17
|
-
...withExts('knip', ['json', 'jsonc', ...commonExts.js, ...commonExts.ts]),
|
|
18
|
-
...withExts('.knip', ['json', 'jsonc']),
|
|
19
|
-
...withExts('knip.config', [...commonExts.js, ...commonExts.ts]),
|
|
20
|
-
],
|
|
21
|
-
} satisfies Tool;
|
package/bin/tools/phpCsFixer.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { withExts } from '../utils/filesystem.ts';
|
|
2
|
-
import runners from '../utils/runners.ts';
|
|
3
|
-
import type { Tool } from '../utils/types.ts';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
exec: runners.composer,
|
|
7
|
-
command: 'php-cs-fixer',
|
|
8
|
-
actions: (configPath) => ({
|
|
9
|
-
check: ['check', '--config', configPath, '-vv'],
|
|
10
|
-
fix: ['fix', '--config', configPath, '-vv'],
|
|
11
|
-
}),
|
|
12
|
-
args: {
|
|
13
|
-
debug: ['--verbose'],
|
|
14
|
-
},
|
|
15
|
-
configFiles: withExts('.php-cs-fixer', ['dist.php', 'php']),
|
|
16
|
-
} satisfies Tool;
|
package/bin/tools/prettier.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { commonExts, withExts } from '../utils/filesystem.ts';
|
|
2
|
-
import runners from '../utils/runners.ts';
|
|
3
|
-
import type { Tool } from '../utils/types.ts';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
exec: runners.bun,
|
|
7
|
-
command: 'prettier',
|
|
8
|
-
actions: (configPath) => ({
|
|
9
|
-
check: ['--check', '--config', configPath, '.'],
|
|
10
|
-
fix: ['--write', '--config', configPath, '.'],
|
|
11
|
-
}),
|
|
12
|
-
args: {
|
|
13
|
-
debug: ['--log-level', 'debug'],
|
|
14
|
-
},
|
|
15
|
-
configFiles: [
|
|
16
|
-
'.prettierrc',
|
|
17
|
-
...withExts('prettier.config', [...commonExts.js, ...commonExts.ts]),
|
|
18
|
-
...withExts('.prettierrc', ['json', 'json5', 'toml', ...commonExts.yaml, ...commonExts.js, ...commonExts.ts]),
|
|
19
|
-
],
|
|
20
|
-
} satisfies Tool;
|
package/bin/tools/stylelint.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { commonExts, withExts } from '../utils/filesystem.ts';
|
|
2
|
-
import runners from '../utils/runners.ts';
|
|
3
|
-
import type { Tool } from '../utils/types.ts';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
exec: runners.bun,
|
|
7
|
-
command: 'stylelint',
|
|
8
|
-
actions: (configPath) => ({
|
|
9
|
-
check: ['--allow-empty-input', '--config', configPath, `**/*.{css,sass,scss}`],
|
|
10
|
-
fix: ['--fix', '--allow-empty-input', '--config', configPath, `**/*.{css,sass,scss}`],
|
|
11
|
-
}),
|
|
12
|
-
args: {
|
|
13
|
-
debug: ['--formatter', 'verbose'],
|
|
14
|
-
},
|
|
15
|
-
configFiles: withExts('stylelint.config', [...commonExts.js]),
|
|
16
|
-
} satisfies Tool;
|
package/bin/tools/tsc.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import runners from '../utils/runners.ts';
|
|
2
|
-
import type { Tool } from '../utils/types.ts';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
exec: runners.bun,
|
|
6
|
-
command: 'tsc',
|
|
7
|
-
actions: (configPath) => ({
|
|
8
|
-
check: ['--noEmit', '--project', configPath],
|
|
9
|
-
fix: ['--project', configPath],
|
|
10
|
-
}),
|
|
11
|
-
configFiles: ['tsconfig.json'],
|
|
12
|
-
} satisfies Tool;
|
package/bin/utils/Cli.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'bun';
|
|
2
|
-
import { parseArgs } from 'node:util';
|
|
3
|
-
|
|
4
|
-
import Output from './Output.ts';
|
|
5
|
-
import type { ToolAction } from './types.ts';
|
|
6
|
-
|
|
7
|
-
interface Options {
|
|
8
|
-
verbose: boolean;
|
|
9
|
-
debug: boolean;
|
|
10
|
-
help: boolean;
|
|
11
|
-
cache: boolean;
|
|
12
|
-
cacheDir: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default class Cli {
|
|
16
|
-
public readonly output: Output;
|
|
17
|
-
|
|
18
|
-
constructor(
|
|
19
|
-
scriptName: string,
|
|
20
|
-
public readonly directory: string,
|
|
21
|
-
public readonly options: Options,
|
|
22
|
-
) {
|
|
23
|
-
this.output = new Output(scriptName, options);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public async runSubprocess(args: string[], env: Record<string, string> = {}): Promise<void> {
|
|
27
|
-
this.output.verbose('Running command:', args);
|
|
28
|
-
|
|
29
|
-
const proc = spawn(args, {
|
|
30
|
-
env: { ...process.env, ...env },
|
|
31
|
-
cwd: this.directory,
|
|
32
|
-
stdio: ['inherit', 'inherit', 'inherit'],
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const exitCode = await proc.exited;
|
|
36
|
-
if (exitCode !== 0) {
|
|
37
|
-
process.exit(exitCode);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public static createFromArgs(argv: string[]): { cli: Cli; selectedAction: ToolAction; selectedTool?: string } {
|
|
42
|
-
// Parse input
|
|
43
|
-
const { values: options, positionals } = parseArgs({
|
|
44
|
-
args: argv,
|
|
45
|
-
options: {
|
|
46
|
-
dir: { type: 'string', short: 'd', default: process.cwd() },
|
|
47
|
-
tool: { type: 'string', short: 't', default: undefined },
|
|
48
|
-
|
|
49
|
-
'no-cache': { type: 'boolean', default: false },
|
|
50
|
-
'cache-dir': { type: 'string', default: '.cache' },
|
|
51
|
-
verbose: { type: 'boolean', default: false },
|
|
52
|
-
debug: { type: 'boolean', default: false },
|
|
53
|
-
help: { type: 'boolean', default: false },
|
|
54
|
-
},
|
|
55
|
-
strict: true,
|
|
56
|
-
allowPositionals: true,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const { dir, tool, 'cache-dir': cacheDir, 'no-cache': noCache, ...additionalOptions } = options;
|
|
60
|
-
const [, scriptName, selectedAction, ...undefinedArgs] = positionals as [string, string, ...string[]];
|
|
61
|
-
|
|
62
|
-
const cli = new Cli(scriptName, dir, { cacheDir, cache: !noCache, ...additionalOptions });
|
|
63
|
-
if (options.help || selectedAction == null) {
|
|
64
|
-
cli.output.usage();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (undefinedArgs.length > 0) {
|
|
68
|
-
cli.output.error('Unexpected additional arguments.', [undefinedArgs]);
|
|
69
|
-
}
|
|
70
|
-
if (!(['check', 'fix'] satisfies ToolAction[] as unknown[]).includes(selectedAction)) {
|
|
71
|
-
cli.output.error(`Unknown action "${selectedAction}".`, [undefinedArgs]);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
cli,
|
|
76
|
-
selectedAction: selectedAction as ToolAction, // Validated above
|
|
77
|
-
selectedTool: tool,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
package/bin/utils/Output.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default class Output {
|
|
2
|
-
constructor(
|
|
3
|
-
private readonly scriptName: string,
|
|
4
|
-
private readonly options: Record<'debug' | 'verbose', boolean>,
|
|
5
|
-
) {}
|
|
6
|
-
|
|
7
|
-
public usage(exitCode: number = 0): never {
|
|
8
|
-
console.error(`Usage:
|
|
9
|
-
${this.scriptName} check [root-path]
|
|
10
|
-
${this.scriptName} fix [root-path]`);
|
|
11
|
-
process.exit(exitCode);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public debug(message: string, additionalValues: unknown[] = []): void {
|
|
15
|
-
if (this.options.debug) {
|
|
16
|
-
console.debug(message, ...additionalValues);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public verbose(message: string, additionalValues: unknown[] = []): void {
|
|
21
|
-
if (this.options.verbose) {
|
|
22
|
-
console.debug(message, ...additionalValues);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public error(message: string, additionalValues: unknown[] = [], exitCode: number = 1): never {
|
|
27
|
-
console.error(message, ...additionalValues);
|
|
28
|
-
process.exit(exitCode);
|
|
29
|
-
}
|
|
30
|
-
}
|