@webpieces/code-rules 0.3.181 → 0.3.183
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 +2 -2
- package/src/resolve-mode.d.ts +2 -6
- package/src/resolve-mode.js +7 -38
- package/src/resolve-mode.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/code-rules",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.183",
|
|
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",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"directory": "packages/tooling/code-rules"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@webpieces/rules-config": "0.3.
|
|
23
|
+
"@webpieces/rules-config": "0.3.183"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|
package/src/resolve-mode.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
reason?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function getCurrentBranch(): string;
|
|
6
|
-
export declare function shouldSkipRule(epoch: number | undefined, branchPattern: string | undefined): SkipRuleResult;
|
|
1
|
+
export { shouldSkipRule, getCurrentBranch } from '@webpieces/rules-config';
|
|
2
|
+
export type { SkipRuleResult } from '@webpieces/rules-config';
|
package/src/resolve-mode.js
CHANGED
|
@@ -1,41 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrentBranch =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
process.env['GITHUB_HEAD_REF'] ||
|
|
11
|
-
process.env['GITHUB_REF_NAME'] ||
|
|
12
|
-
process.env['CI_COMMIT_BRANCH'] ||
|
|
13
|
-
process.env['CIRCLE_BRANCH'];
|
|
14
|
-
if (envBranch)
|
|
15
|
-
return envBranch;
|
|
16
|
-
// webpieces-disable no-unmanaged-exceptions -- rethrow as InformAiError so global catch surfaces readable message to AI
|
|
17
|
-
try {
|
|
18
|
-
return (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
const error = (0, rules_config_1.toError)(err);
|
|
22
|
-
throw new rules_config_1.InformAiError(`Failed to determine current git branch: ${error.message}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function shouldSkipRule(epoch, branchPattern) {
|
|
26
|
-
if (branchPattern) {
|
|
27
|
-
const current = getCurrentBranch();
|
|
28
|
-
if (current === branchPattern) {
|
|
29
|
-
return { skip: true, reason: `on branch "${branchPattern}"` };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (epoch !== undefined) {
|
|
33
|
-
const nowSeconds = Date.now() / 1000;
|
|
34
|
-
if (nowSeconds < epoch) {
|
|
35
|
-
const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
|
|
36
|
-
return { skip: true, reason: `ignoreModifiedUntilEpoch active, expires: ${expiresDate}` };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return { skip: false };
|
|
40
|
-
}
|
|
3
|
+
exports.getCurrentBranch = exports.shouldSkipRule = void 0;
|
|
4
|
+
// shouldSkipRule / getCurrentBranch / SkipRuleResult moved to @webpieces/rules-config
|
|
5
|
+
// so ai-hook-rules and the Nx executors share one implementation. Re-exported here
|
|
6
|
+
// for back-compat with the many code-rules validators that import from './resolve-mode'.
|
|
7
|
+
var rules_config_1 = require("@webpieces/rules-config");
|
|
8
|
+
Object.defineProperty(exports, "shouldSkipRule", { enumerable: true, get: function () { return rules_config_1.shouldSkipRule; } });
|
|
9
|
+
Object.defineProperty(exports, "getCurrentBranch", { enumerable: true, get: function () { return rules_config_1.getCurrentBranch; } });
|
|
41
10
|
//# sourceMappingURL=resolve-mode.js.map
|
package/src/resolve-mode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-mode.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/resolve-mode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-mode.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/resolve-mode.ts"],"names":[],"mappings":";;;AAAA,sFAAsF;AACtF,mFAAmF;AACnF,yFAAyF;AACzF,wDAA2E;AAAlE,8GAAA,cAAc,OAAA;AAAE,gHAAA,gBAAgB,OAAA","sourcesContent":["// shouldSkipRule / getCurrentBranch / SkipRuleResult moved to @webpieces/rules-config\n// so ai-hook-rules and the Nx executors share one implementation. Re-exported here\n// for back-compat with the many code-rules validators that import from './resolve-mode'.\nexport { shouldSkipRule, getCurrentBranch } from '@webpieces/rules-config';\nexport type { SkipRuleResult } from '@webpieces/rules-config';\n"]}
|