@webpieces/code-rules 0.4.620 → 0.4.622
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/code-rules",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.622",
|
|
4
4
|
"description": "Standalone code validation rules extracted from architecture-validators, no Nx dependency required",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"directory": "packages/tooling/code-rules"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@webpieces/rules-config": "0.4.
|
|
19
|
+
"@webpieces/rules-config": "0.4.622",
|
|
20
20
|
"@inversifyjs/binding-decorators": "1.1.5",
|
|
21
21
|
"inversify": "7.10.4",
|
|
22
22
|
"reflect-metadata": "0.2.2"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"types": "./src/index.d.ts",
|
|
28
28
|
"bin": {
|
|
29
29
|
"wp-validate-code": "./src/cli.js",
|
|
30
|
-
"wp-ci": "./src/wp-ci.js"
|
|
30
|
+
"wp-ci": "./src/wp-ci.js",
|
|
31
|
+
"wp-prune-unknown-config": "./src/prune-unknown-config.js"
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
7
|
+
/**
|
|
8
|
+
* `wp-prune-unknown-config` — strip every key from webpieces.config.json that no running validator has a
|
|
9
|
+
* schema for, and say which ones went.
|
|
10
|
+
*
|
|
11
|
+
* This is the command the unknown-rule error and the validation banner both name. It exists because the
|
|
12
|
+
* moment that advice is read is the worst moment to act on it by hand: the hook guard denies every Bash
|
|
13
|
+
* call while the config is invalid, so the reader is editing JSON blind. One command makes cleanliness
|
|
14
|
+
* the default path instead of a judgement call taken under a total block.
|
|
15
|
+
*
|
|
16
|
+
* It lives in code-rules rather than rules-config because rules-config is a library with no bins, and
|
|
17
|
+
* code-rules already ships `wp-validate-code` — the command whose failure sends a reader here. All the
|
|
18
|
+
* logic is `ConfigPruner`; this file is the composition root and nothing else.
|
|
19
|
+
*/
|
|
20
|
+
(0, rules_config_1.runMain)(async () => {
|
|
21
|
+
const container = new inversify_1.Container({ autobind: true });
|
|
22
|
+
// Reject `--help`/bogus flags BEFORE anything rewrites a file — an ignored flag must never mutate config.
|
|
23
|
+
container.get(rules_config_1.CliArgs).assertNoArgs(new rules_config_1.CliUsage('wp-prune-unknown-config', 'Delete every rules/hookGuards key webpieces.config.json carries that no validator has a schema ' +
|
|
24
|
+
'for, naming each one. Leaves renames and in-file moves alone, and does nothing when rulesDir is set.'));
|
|
25
|
+
const result = container.get(rules_config_1.ConfigPruner).pruneFrom(process.cwd());
|
|
26
|
+
process.stdout.write(result.describeSelf() + '\n');
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=prune-unknown-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune-unknown-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/prune-unknown-config.ts"],"names":[],"mappings":";;;AACA,4BAA0B;AAC1B,yCAAsC;AACtC,0DAAgG;AAEhG;;;;;;;;;;;;GAYG;AACH,IAAA,sBAAO,EAAC,KAAK,IAAmB,EAAE;IAC9B,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,0GAA0G;IAC1G,SAAS,CAAC,GAAG,CAAC,sBAAO,CAAC,CAAC,YAAY,CAAC,IAAI,uBAAQ,CAC5C,yBAAyB,EACzB,iGAAiG;QACjG,sGAAsG,CAAC,CAAC,CAAC;IAC7G,MAAM,MAAM,GAAgB,SAAS,CAAC,GAAG,CAAC,2BAAY,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport 'reflect-metadata';\nimport { Container } from 'inversify';\nimport { runMain, CliArgs, CliUsage, ConfigPruner, PruneResult } from '@webpieces/rules-config';\n\n/**\n * `wp-prune-unknown-config` — strip every key from webpieces.config.json that no running validator has a\n * schema for, and say which ones went.\n *\n * This is the command the unknown-rule error and the validation banner both name. It exists because the\n * moment that advice is read is the worst moment to act on it by hand: the hook guard denies every Bash\n * call while the config is invalid, so the reader is editing JSON blind. One command makes cleanliness\n * the default path instead of a judgement call taken under a total block.\n *\n * It lives in code-rules rather than rules-config because rules-config is a library with no bins, and\n * code-rules already ships `wp-validate-code` — the command whose failure sends a reader here. All the\n * logic is `ConfigPruner`; this file is the composition root and nothing else.\n */\nrunMain(async (): Promise<void> => {\n const container = new Container({ autobind: true });\n // Reject `--help`/bogus flags BEFORE anything rewrites a file — an ignored flag must never mutate config.\n container.get(CliArgs).assertNoArgs(new CliUsage(\n 'wp-prune-unknown-config',\n 'Delete every rules/hookGuards key webpieces.config.json carries that no validator has a schema ' +\n 'for, naming each one. Leaves renames and in-file moves alone, and does nothing when rulesDir is set.'));\n const result: PruneResult = container.get(ConfigPruner).pruneFrom(process.cwd());\n process.stdout.write(result.describeSelf() + '\\n');\n});\n"]}
|