repopo 0.4.0 → 0.5.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +37 -18
  3. package/THIRD-PARTY-LICENSES.txt +21 -11
  4. package/esm/api.d.ts +2 -0
  5. package/esm/api.d.ts.map +1 -0
  6. package/esm/api.js +2 -0
  7. package/esm/api.js.map +1 -0
  8. package/esm/baseCommand.d.ts +13 -43
  9. package/esm/baseCommand.d.ts.map +1 -1
  10. package/esm/baseCommand.js +27 -62
  11. package/esm/baseCommand.js.map +1 -1
  12. package/esm/commands/check.d.ts +2 -8
  13. package/esm/commands/check.d.ts.map +1 -1
  14. package/esm/commands/check.js +79 -87
  15. package/esm/commands/check.js.map +1 -1
  16. package/esm/commands/list.d.ts +1 -2
  17. package/esm/commands/list.d.ts.map +1 -1
  18. package/esm/commands/list.js +5 -6
  19. package/esm/commands/list.js.map +1 -1
  20. package/esm/config.d.ts +10 -5
  21. package/esm/config.d.ts.map +1 -1
  22. package/esm/config.js.map +1 -1
  23. package/esm/context.d.ts +29 -0
  24. package/esm/context.d.ts.map +1 -0
  25. package/esm/context.js +2 -0
  26. package/esm/context.js.map +1 -0
  27. package/esm/index.d.ts +11 -4
  28. package/esm/index.d.ts.map +1 -1
  29. package/esm/index.js +8 -0
  30. package/esm/index.js.map +1 -1
  31. package/esm/perf.d.ts.map +1 -1
  32. package/esm/perf.js +1 -5
  33. package/esm/perf.js.map +1 -1
  34. package/esm/policies/HtmlFileHeaders.d.ts +8 -0
  35. package/esm/policies/HtmlFileHeaders.d.ts.map +1 -0
  36. package/esm/policies/HtmlFileHeaders.js +17 -0
  37. package/esm/policies/HtmlFileHeaders.js.map +1 -0
  38. package/esm/policies/JsTsFileHeaders.d.ts +8 -0
  39. package/esm/policies/JsTsFileHeaders.d.ts.map +1 -0
  40. package/esm/policies/JsTsFileHeaders.js +24 -0
  41. package/esm/policies/JsTsFileHeaders.js.map +1 -0
  42. package/esm/policies/NoJsFileExtensions.d.ts +2 -0
  43. package/esm/policies/NoJsFileExtensions.d.ts.map +1 -1
  44. package/esm/policies/NoJsFileExtensions.js +2 -0
  45. package/esm/policies/NoJsFileExtensions.js.map +1 -1
  46. package/esm/policies/PackageJsonProperties.d.ts +6 -8
  47. package/esm/policies/PackageJsonProperties.d.ts.map +1 -1
  48. package/esm/policies/PackageJsonProperties.js +37 -40
  49. package/esm/policies/PackageJsonProperties.js.map +1 -1
  50. package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts +3 -2
  51. package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts.map +1 -1
  52. package/esm/policies/PackageJsonRepoDirectoryProperty.js +40 -37
  53. package/esm/policies/PackageJsonRepoDirectoryProperty.js.map +1 -1
  54. package/esm/policies/PackageJsonSorted.d.ts +7 -0
  55. package/esm/policies/PackageJsonSorted.d.ts.map +1 -0
  56. package/esm/policies/PackageJsonSorted.js +45 -0
  57. package/esm/policies/PackageJsonSorted.js.map +1 -0
  58. package/esm/policies/PackageScripts.d.ts +7 -0
  59. package/esm/policies/PackageScripts.d.ts.map +1 -0
  60. package/esm/policies/PackageScripts.js +25 -0
  61. package/esm/policies/PackageScripts.js.map +1 -0
  62. package/esm/policies/constants.d.ts +5 -0
  63. package/esm/policies/constants.d.ts.map +1 -0
  64. package/esm/policies/constants.js +5 -0
  65. package/esm/policies/constants.js.map +1 -0
  66. package/esm/policies.d.ts +7 -0
  67. package/esm/policies.d.ts.map +1 -0
  68. package/esm/policies.js +7 -0
  69. package/esm/policies.js.map +1 -0
  70. package/esm/policy.d.ts +31 -13
  71. package/esm/policy.d.ts.map +1 -1
  72. package/esm/policy.js +8 -20
  73. package/esm/policy.js.map +1 -1
  74. package/esm/policyGenerators/generateFileHeaderPolicy.d.ts +45 -0
  75. package/esm/policyGenerators/generateFileHeaderPolicy.d.ts.map +1 -0
  76. package/esm/policyGenerators/generateFileHeaderPolicy.js +61 -0
  77. package/esm/policyGenerators/generateFileHeaderPolicy.js.map +1 -0
  78. package/esm/policyGenerators/generatePackagePolicy.d.ts +9 -0
  79. package/esm/policyGenerators/generatePackagePolicy.d.ts.map +1 -0
  80. package/esm/policyGenerators/generatePackagePolicy.js +20 -0
  81. package/esm/policyGenerators/generatePackagePolicy.js.map +1 -0
  82. package/esm/tsdoc-metadata.json +1 -1
  83. package/oclif.manifest.json +45 -53
  84. package/package.json +39 -21
  85. package/esm/policies/PackageJsonSortedPolicy.d.ts +0 -6
  86. package/esm/policies/PackageJsonSortedPolicy.d.ts.map +0 -1
  87. package/esm/policies/PackageJsonSortedPolicy.js +0 -49
  88. package/esm/policies/PackageJsonSortedPolicy.js.map +0 -1
  89. package/esm/policies/SortTsconfigs.d.ts +0 -10
  90. package/esm/policies/SortTsconfigs.d.ts.map +0 -1
  91. package/esm/policies/SortTsconfigs.js +0 -33
  92. package/esm/policies/SortTsconfigs.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # repopo
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Export all default policies _[`#213`](https://github.com/tylerbutler/tools-monorepo/pull/213) [`3fc530b`](https://github.com/tylerbutler/tools-monorepo/commit/3fc530bad66259339547b3d8ec12b9265daea9a5) [@tylerbutler](https://github.com/tylerbutler)_
8
+
9
+ repopo now exports all included policies individually so users can opt in and out of them in their config.
10
+
11
+ - New policies _[`#31`](https://github.com/tylerbutler/tools-monorepo/pull/31) [`c97a565`](https://github.com/tylerbutler/tools-monorepo/commit/c97a56518d9726667531aa71de9445fed8d56b96) [@tylerbutler](https://github.com/tylerbutler)_
12
+
13
+ - JsTsFileHeaders
14
+ - HtmlFileHeaders
15
+ - PackageScripts
16
+
17
+ - API changes: _[`#120`](https://github.com/tylerbutler/tools-monorepo/pull/120) [`1108950`](https://github.com/tylerbutler/tools-monorepo/commit/1108950a7732dcc3ac9b8da10bd014bfec6c45b7) [@tylerbutler](https://github.com/tylerbutler)_
18
+
19
+ - **Breaking change**: `PolicyConfig` was renamed to `RepopoConfig`.
20
+ - **Breaking change**: Removed several flags from the check command.
21
+
22
+ Other changes:
23
+
24
+ - Refactor check command for clarity (more to do)
25
+
26
+ - Functions to more easily create package.json handlers _[`#190`](https://github.com/tylerbutler/tools-monorepo/pull/190) [`84c4185`](https://github.com/tylerbutler/tools-monorepo/commit/84c4185e76186c3489a4b70e3a3015ba289df139) [@tylerbutler](https://github.com/tylerbutler)_
27
+
28
+ repopo now provides functions that can be used to generate policies for common files like package.json.
29
+
30
+ ### Patch Changes
31
+
32
+ - Update dependencies _[`#217`](https://github.com/tylerbutler/tools-monorepo/pull/217) [`dcec014`](https://github.com/tylerbutler/tools-monorepo/commit/dcec014dfb70e5804a7535b5b8b9a3406f3e623d) [@tylerbutler](https://github.com/tylerbutler)_
33
+
34
+ <details><summary>Updated 2 dependencies</summary>
35
+
36
+ <small>
37
+
38
+ [`dcec014`](https://github.com/tylerbutler/tools-monorepo/commit/dcec014dfb70e5804a7535b5b8b9a3406f3e623d)
39
+
40
+ </small>
41
+
42
+ - `@tylerbu/fundamentals@0.2.1`
43
+ - `@tylerbu/cli-api@0.7.1`
44
+
45
+ </details>
46
+
3
47
  ## 0.4.0
4
48
 
5
49
  ### Minor Changes
package/README.md CHANGED
@@ -7,12 +7,13 @@ file in your git repo, with a straightforward way to write your own policies.
7
7
  * [repopo - police the files in your git repo with extensible policies](#repopo---police-the-files-in-your-git-repo-with-extensible-policies)
8
8
  * [Configuring policies](#configuring-policies)
9
9
  * [Included policies](#included-policies)
10
- * [Usage](#usage)
10
+ * [Policy generators](#policy-generators)
11
+ * [CLI Usage](#cli-usage)
11
12
  <!-- tocstop -->
12
13
 
13
14
  # Configuring policies
14
15
 
15
- Repopo and its policies can be configured in a repopo.config.ts (or .cjs, or .mjs) file in the root of the repo. Using a
16
+ Repopo and its policies can be configured in a `repopo.config.ts` (or `.cjs`, or `.mjs`) file in the root of the repo. Using a
16
17
  TypeScript configuration file is recommended.
17
18
 
18
19
  The policy config must export a default object of the type `PolicyConfig`.
@@ -36,6 +37,14 @@ policy settings as the value.
36
37
 
37
38
  repopo includes the following policies. All of the included policies are enabled by default.
38
39
 
40
+ ## HtmlFileHeaders and JsTsFileHeaders
41
+
42
+ These policies set a common file header for JavaScript/TypeScript and HTML files.
43
+
44
+ ### Configuration
45
+
46
+ TODO
47
+
39
48
  ## NoJsFileExtensions
40
49
 
41
50
  The NoJsFileExtensions policy checks for JavaScript source files that just use the .js file extension. Such files may be
@@ -61,6 +70,10 @@ const config: PolicyConfig = {
61
70
  license: "MIT",
62
71
  author: "Tyler Butler <tyler@tylerbutler.com>",
63
72
  bugs: "https://github.com/tylerbutler/tools-monorepo/issues",
73
+ repository: {
74
+ type: "git",
75
+ url: "git+https://github.com/tylerbutler/tools-monorepo.git",
76
+ }
64
77
  }
65
78
  }
66
79
  }
@@ -72,7 +85,17 @@ const config: PolicyConfig = {
72
85
  A RepoPolicy that checks that the `repository.directory` property in package.json is set correctly. If the repository
73
86
  field is a string instead of an object the package will be ignored.
74
87
 
75
- # Usage
88
+ # Policy generators
89
+
90
+ There are some filetypes that often have policies applied to them, like package.json. You can use the policy generator
91
+ functions to generate policies for those filetypes. Using the generators is not required; they simply reduce the amount
92
+ of boilerplate code you have to write for a policy.
93
+
94
+ ## generatePackagePolicy
95
+
96
+ Use `generatePackagePolicy` to generate policies for package.json files.
97
+
98
+ # CLI Usage
76
99
 
77
100
  <!-- commands -->
78
101
  * [`repopo check`](#repopo-check)
@@ -84,16 +107,15 @@ Checks and applies policies to the files in the repository.
84
107
 
85
108
  ```
86
109
  USAGE
87
- $ repopo check [-f] [--stdin] [-D <value>... | -d <value>] [-p <value>]
110
+ $ repopo check [-v | --quiet] [-f] [--stdin]
88
111
 
89
112
  FLAGS
90
- -D, --excludePolicy=<value>... Exclude policies by name. Can be specified multiple times to exclude multiple
91
- policies.
92
- -d, --policy=<value> Filter policies to apply by <regex>. Only policies with a name matching the regex will
93
- be applied.
94
- -f, --fix Fix errors if possible.
95
- -p, --path=<value> Filter file paths by <regex>.
96
- --stdin Read list of files from stdin.
113
+ -f, --fix Fix errors if possible.
114
+ --stdin Read list of files from stdin.
115
+
116
+ LOGGING FLAGS
117
+ -v, --verbose Enable verbose logging.
118
+ --quiet Disable all logging.
97
119
  ```
98
120
 
99
121
  _See code: [src/commands/check.ts](https://github.com/tylerbutler/tools-monorepo/blob/main/packages/repopo/src/commands/check.ts)_
@@ -104,14 +126,11 @@ Lists the policies configured to run.
104
126
 
105
127
  ```
106
128
  USAGE
107
- $ repopo list [-D <value>... | -d <value>] [-p <value>]
129
+ $ repopo list [-v | --quiet]
108
130
 
109
- FLAGS
110
- -D, --excludePolicy=<value>... Exclude policies by name. Can be specified multiple times to exclude multiple
111
- policies.
112
- -d, --policy=<value> Filter policies to apply by <regex>. Only policies with a name matching the regex will
113
- be applied.
114
- -p, --path=<value> Filter file paths by <regex>.
131
+ LOGGING FLAGS
132
+ -v, --verbose Enable verbose logging.
133
+ --quiet Disable all logging.
115
134
  ```
116
135
 
117
136
  _See code: [src/commands/list.ts](https://github.com/tylerbutler/tools-monorepo/blob/main/packages/repopo/src/commands/list.ts)_
@@ -27,7 +27,7 @@ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE
27
27
 
28
28
  The following npm package may be included in this product:
29
29
 
30
- - @rushstack/node-core-library@5.9.0
30
+ - @rushstack/node-core-library@5.13.0
31
31
 
32
32
  This package contains the following license:
33
33
 
@@ -60,7 +60,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
60
60
 
61
61
  The following npm package may be included in this product:
62
62
 
63
- - @fluid-tools/build-infrastructure@0.52.0
63
+ - @fluid-tools/build-infrastructure@0.56.0
64
64
 
65
65
  This package contains the following license:
66
66
 
@@ -114,13 +114,24 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
114
114
 
115
115
  The following npm package may be included in this product:
116
116
 
117
- - sort-package-json@2.14.0
117
+ - simple-git@3.27.0
118
118
 
119
119
  This package contains the following license:
120
120
 
121
+ MIT
122
+
123
+ -----------
124
+
125
+ The following npm packages may be included in this product:
126
+
127
+ - @oclif/core@4.2.10
128
+ - @oclif/plugin-help@6.2.27
129
+
130
+ These packages each contain the following license:
131
+
121
132
  MIT License
122
133
 
123
- Copyright (c) 2015 Keith Cirkel
134
+ Copyright (c) 2018 Salesforce.com
124
135
 
125
136
  Permission is hereby granted, free of charge, to any person obtaining a copy
126
137
  of this software and associated documentation files (the "Software"), to deal
@@ -142,16 +153,15 @@ SOFTWARE.
142
153
 
143
154
  -----------
144
155
 
145
- The following npm packages may be included in this product:
156
+ The following npm package may be included in this product:
146
157
 
147
- - @oclif/core@4.2.3
148
- - @oclif/plugin-help@6.2.21
158
+ - microdiff@1.5.0
149
159
 
150
- These packages each contain the following license:
160
+ This package contains the following license:
151
161
 
152
162
  MIT License
153
163
 
154
- Copyright (c) 2018 Salesforce.com
164
+ Copyright (c) 2021 AsyncBanana
155
165
 
156
166
  Permission is hereby granted, free of charge, to any person obtaining a copy
157
167
  of this software and associated documentation files (the "Software"), to deal
@@ -175,13 +185,13 @@ SOFTWARE.
175
185
 
176
186
  The following npm package may be included in this product:
177
187
 
178
- - sort-tsconfig@0.2.0
188
+ - defu@6.1.4
179
189
 
180
190
  This package contains the following license:
181
191
 
182
192
  MIT License
183
193
 
184
- Copyright (c) 2023 Tyler Butler <tyler@tylerbutler.com>
194
+ Copyright (c) Pooya Parsa <pooya@pi0.io>
185
195
 
186
196
  Permission is hereby granted, free of charge, to any person obtaining a copy
187
197
  of this software and associated documentation files (the "Software"), to deal
package/esm/api.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":""}
package/esm/api.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=api.js.map
package/esm/api.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -1,52 +1,22 @@
1
- import { GitCommand } from "@tylerbu/cli-api";
2
- import type { PolicyConfig } from "./config.js";
3
- import { type PolicyHandlerPerfStats } from "./perf.js";
4
- import { type PolicyName, type RepoPolicy } from "./policy.js";
1
+ import { CommandWithConfig, type CommandWithContext, type RequiresGit } from "@tylerbu/cli-api";
2
+ import { type SimpleGit } from "simple-git";
3
+ import { type RepopoConfig } from "./config.js";
4
+ import type { RepopoCommandContext } from "./context.js";
5
5
  /**
6
- * A convenience interface used to pass commonly used parameters between functions.
7
- */
8
- export interface PolicyCommandContext {
9
- /**
10
- * A regular expression used to filter selected files.
11
- */
12
- pathRegex: RegExp;
13
- /**
14
- * A list of regular expressions used to exclude files from all handlers.
15
- */
16
- excludeFiles: RegExp[];
17
- /**
18
- * A list of handlers to apply to selected files.
19
- */
20
- policies: RepoPolicy[];
21
- /**
22
- * A per-handler list of regular expressions used to exclude files from specific handlers.
23
- */
24
- excludePoliciesForFiles: ExcludedPolicyFileMap;
25
- /**
26
- * Path to the root of the git repo.
27
- */
28
- gitRoot: string;
29
- /**
30
- * Performance information for each handler.
31
- */
32
- perfStats: PolicyHandlerPerfStats;
33
- }
34
- /**
35
- * This command lists all the policies configured to run.
6
+ * This class is the base for all repopo commands. It contains common flags and config loading.
36
7
  */
37
8
  export declare abstract class BaseRepopoCommand<T extends typeof BaseRepopoCommand & {
38
- args: typeof GitCommand.args;
39
- flags: typeof GitCommand.flags;
40
- }> extends GitCommand<T, PolicyConfig> {
9
+ args: typeof CommandWithConfig.args;
10
+ flags: typeof CommandWithConfig.flags;
11
+ }> extends CommandWithConfig<T, RepopoConfig> implements CommandWithContext<RepopoCommandContext>, RequiresGit {
12
+ protected defaultConfig: RepopoConfig;
41
13
  static readonly flags: {
42
14
  readonly config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
43
- readonly policy: import("@oclif/core/interfaces").OptionFlag<RegExp | undefined, import("@oclif/core/interfaces").CustomOptions>;
44
- readonly excludePolicy: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
45
- readonly path: import("@oclif/core/interfaces").OptionFlag<RegExp | undefined, import("@oclif/core/interfaces").CustomOptions>;
46
15
  };
47
- private context;
48
- protected getContext(): PolicyCommandContext;
16
+ private _git;
17
+ get git(): SimpleGit;
49
18
  init(): Promise<void>;
19
+ private _context;
20
+ getContext(): Promise<RepopoCommandContext>;
50
21
  }
51
- export type ExcludedPolicyFileMap = Map<PolicyName, RegExp[]>;
52
22
  //# sourceMappingURL=baseCommand.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"baseCommand.d.ts","sourceRoot":"","sources":["../src/baseCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAA2B,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,sBAAsB,EAAgB,MAAM,WAAW,CAAC;AACtE,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAIhF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,UAAU,EAAE,CAAC;IAEvB;;OAEG;IACH,uBAAuB,EAAE,qBAAqB,CAAC;IAE/C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,sBAAsB,CAAC;CAClC;AAED;;GAEG;AACH,8BAAsB,iBAAiB,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AI,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B3C,OAAO,CAAC,QAAQ,CAAmC;IAGtC,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAMxD"}
@@ -1,87 +1,52 @@
1
- import { Flags } from "@oclif/core";
2
- import { GitCommand, RegExpFlag, findGitRoot } from "@tylerbu/cli-api";
1
+ import { CommandWithConfig, } from "@tylerbu/cli-api";
2
+ import { findGitRootSync } from "@tylerbu/fundamentals/git";
3
+ import { simpleGit } from "simple-git";
4
+ import { DefaultPolicyConfig } from "./config.js";
3
5
  import { newPerfStats } from "./perf.js";
4
6
  import { DefaultPolicies } from "./policy.js";
5
- const DEFAULT_PATH_REGEX = /.?/;
6
7
  /**
7
- * This command lists all the policies configured to run.
8
+ * This class is the base for all repopo commands. It contains common flags and config loading.
8
9
  */
9
- export class BaseRepopoCommand extends GitCommand {
10
+ export class BaseRepopoCommand extends CommandWithConfig {
11
+ defaultConfig = DefaultPolicyConfig;
10
12
  static flags = {
11
- policy: RegExpFlag({
12
- description: "Filter policies to apply by <regex>. Only policies with a name matching the regex will be applied.",
13
- required: false,
14
- char: "d",
15
- }),
16
- excludePolicy: Flags.string({
17
- char: "D",
18
- description: "Exclude policies by name. Can be specified multiple times to exclude multiple policies.",
19
- exclusive: ["policy"],
20
- multiple: true,
21
- }),
22
- path: RegExpFlag({
23
- description: "Filter file paths by <regex>.",
24
- required: false,
25
- char: "p",
26
- }),
27
- ...GitCommand.flags,
13
+ ...CommandWithConfig.flags,
28
14
  };
29
- context;
30
- getContext() {
31
- if (this.context === undefined) {
32
- throw new Error("context undefined");
15
+ _git;
16
+ get git() {
17
+ if (this._git === undefined) {
18
+ throw new Error("git property is undefined");
33
19
  }
34
- return this.context;
20
+ return this._git;
35
21
  }
36
22
  async init() {
37
23
  await super.init();
38
- const { flags } = this;
39
- const config = this.commandConfig;
40
- let policies = config?.policies ?? DefaultPolicies;
41
- policies =
42
- policies.filter((h) => {
43
- if (flags.excludePolicy === undefined ||
44
- flags.excludePolicy.length === 0) {
45
- return true;
46
- }
47
- const shouldRun = flags.excludePolicy?.includes(h.name) === false;
48
- if (!shouldRun) {
49
- this.info(`Disabled policy: ${h.name}`);
50
- }
51
- return shouldRun;
52
- }) ?? [];
53
- if (flags.policy !== undefined) {
54
- this.info(`Filtering handlers by regex: ${flags.policy}`);
55
- policies = policies.filter((h) => flags.policy?.test(h.name));
56
- }
57
- const excludeFiles = config?.excludeFiles?.map((e) => toRegExp(e)) ?? [];
58
- const excludePoliciesForFilesRaw = config?.excludePoliciesForFiles;
24
+ const excludeFiles = this.commandConfig?.excludeFiles?.map((e) => new RegExp(e, "i")) ?? [];
25
+ const excludePoliciesForFilesRaw = this.commandConfig?.excludePoliciesForFiles;
59
26
  const excludePoliciesForFiles = new Map();
60
27
  if (excludePoliciesForFilesRaw) {
61
28
  for (const [policyName, filters] of Object.entries(excludePoliciesForFilesRaw)) {
62
- const regexes = filters.map((e) => toRegExp(e));
29
+ const regexes = filters.map((e) => new RegExp(e, "i"));
63
30
  excludePoliciesForFiles.set(policyName, regexes);
64
31
  }
65
32
  }
66
- const gitRoot = await findGitRoot();
67
- const pathRegex = this.flags.path ?? DEFAULT_PATH_REGEX;
68
- if (this.flags.path !== undefined) {
69
- this.info(`Filtering file paths by regex: ${pathRegex}`);
70
- }
71
- this.context = {
72
- pathRegex,
33
+ const gitRoot = findGitRootSync();
34
+ this._git = simpleGit({ baseDir: gitRoot });
35
+ this._context = {
73
36
  excludeFiles,
74
- policies,
37
+ policies: this.commandConfig?.policies ?? DefaultPolicies,
75
38
  excludePoliciesForFiles,
76
39
  gitRoot,
77
40
  perfStats: newPerfStats(),
78
41
  };
79
42
  }
80
- }
81
- function toRegExp(input) {
82
- if (typeof input === "string") {
83
- return new RegExp(input, "i");
43
+ _context;
44
+ // biome-ignore lint/suspicious/useAwait: interface defines this as async
45
+ async getContext() {
46
+ if (this._context === undefined) {
47
+ throw new Error("Context not initialized.");
48
+ }
49
+ return this._context;
84
50
  }
85
- return input;
86
51
  }
87
52
  //# sourceMappingURL=baseCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"baseCommand.js","sourceRoot":"","sources":["../src/baseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGvE,OAAO,EAA+B,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,eAAe,EAAoC,MAAM,aAAa,CAAC;AAEhF,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAqChC;;GAEG;AACH,MAAM,OAAgB,iBAKpB,SAAQ,UAA2B;IACpC,MAAM,CAAmB,KAAK,GAAG;QAChC,MAAM,EAAE,UAAU,CAAC;YAClB,WAAW,EACV,oGAAoG;YACrG,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,GAAG;SACT,CAAC;QACF,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC;YAC3B,IAAI,EAAE,GAAG;YACT,WAAW,EACV,yFAAyF;YAC1F,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,IAAI,EAAE,UAAU,CAAC;YAChB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,GAAG;SACT,CAAC;QACF,GAAG,UAAU,CAAC,KAAK;KACV,CAAC;IAEH,OAAO,CAAmC;IAExC,UAAU;QACnB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEe,KAAK,CAAC,IAAI;QACzB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QACvB,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,OAAO,CACjD,0BAA0B,CAC1B,EAAE,CAAC;gBACH,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChD,uBAAuB,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC;QAEpC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,kBAAkB,CAAC;QACxD,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,kCAAkC,SAAS,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC,OAAO,GAAG;YACd,SAAS;YACT,YAAY;YACZ,QAAQ;YACR,uBAAuB;YACvB,OAAO;YACP,SAAS,EAAE,YAAY,EAAE;SACzB,CAAC;IACH,CAAC;;AAKF,SAAS,QAAQ,CAAC,KAAsB;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { Flags } from \"@oclif/core\";\nimport { GitCommand, RegExpFlag, findGitRoot } from \"@tylerbu/cli-api\";\n\nimport type { PolicyConfig } from \"./config.js\";\nimport { type PolicyHandlerPerfStats, newPerfStats } from \"./perf.js\";\nimport { DefaultPolicies, type PolicyName, type RepoPolicy } from \"./policy.js\";\n\nconst DEFAULT_PATH_REGEX = /.?/;\n\n/**\n * A convenience interface used to pass commonly used parameters between functions.\n */\nexport interface PolicyCommandContext {\n\t/**\n\t * A regular expression used to filter selected files.\n\t */\n\tpathRegex: RegExp;\n\n\t/**\n\t * A list of regular expressions used to exclude files from all handlers.\n\t */\n\texcludeFiles: RegExp[];\n\n\t/**\n\t * A list of handlers to apply to selected files.\n\t */\n\tpolicies: RepoPolicy[];\n\n\t/**\n\t * A per-handler list of regular expressions used to exclude files from specific handlers.\n\t */\n\texcludePoliciesForFiles: ExcludedPolicyFileMap;\n\n\t/**\n\t * Path to the root of the git repo.\n\t */\n\tgitRoot: string;\n\n\t/**\n\t * Performance information for each handler.\n\t */\n\tperfStats: PolicyHandlerPerfStats;\n}\n\n/**\n * This command lists all the policies configured to run.\n */\nexport abstract class BaseRepopoCommand<\n\tT extends typeof BaseRepopoCommand & {\n\t\targs: typeof GitCommand.args;\n\t\tflags: typeof GitCommand.flags;\n\t},\n> extends GitCommand<T, PolicyConfig> {\n\tstatic override readonly flags = {\n\t\tpolicy: RegExpFlag({\n\t\t\tdescription:\n\t\t\t\t\"Filter policies to apply by <regex>. Only policies with a name matching the regex will be applied.\",\n\t\t\trequired: false,\n\t\t\tchar: \"d\",\n\t\t}),\n\t\texcludePolicy: Flags.string({\n\t\t\tchar: \"D\",\n\t\t\tdescription:\n\t\t\t\t\"Exclude policies by name. Can be specified multiple times to exclude multiple policies.\",\n\t\t\texclusive: [\"policy\"],\n\t\t\tmultiple: true,\n\t\t}),\n\t\tpath: RegExpFlag({\n\t\t\tdescription: \"Filter file paths by <regex>.\",\n\t\t\trequired: false,\n\t\t\tchar: \"p\",\n\t\t}),\n\t\t...GitCommand.flags,\n\t} as const;\n\n\tprivate context: PolicyCommandContext | undefined;\n\n\tprotected getContext(): PolicyCommandContext {\n\t\tif (this.context === undefined) {\n\t\t\tthrow new Error(\"context undefined\");\n\t\t}\n\t\treturn this.context;\n\t}\n\n\tpublic override async init(): Promise<void> {\n\t\tawait super.init();\n\t\tconst { flags } = this;\n\t\tconst config = this.commandConfig;\n\t\tlet policies = config?.policies ?? DefaultPolicies;\n\t\tpolicies =\n\t\t\tpolicies.filter((h) => {\n\t\t\t\tif (\n\t\t\t\t\tflags.excludePolicy === undefined ||\n\t\t\t\t\tflags.excludePolicy.length === 0\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tconst shouldRun = flags.excludePolicy?.includes(h.name) === false;\n\t\t\t\tif (!shouldRun) {\n\t\t\t\t\tthis.info(`Disabled policy: ${h.name}`);\n\t\t\t\t}\n\t\t\t\treturn shouldRun;\n\t\t\t}) ?? [];\n\t\tif (flags.policy !== undefined) {\n\t\t\tthis.info(`Filtering handlers by regex: ${flags.policy}`);\n\t\t\tpolicies = policies.filter((h) => flags.policy?.test(h.name));\n\t\t}\n\n\t\tconst excludeFiles: RegExp[] =\n\t\t\tconfig?.excludeFiles?.map((e) => toRegExp(e)) ?? [];\n\t\tconst excludePoliciesForFilesRaw = config?.excludePoliciesForFiles;\n\t\tconst excludePoliciesForFiles: ExcludedPolicyFileMap = new Map();\n\t\tif (excludePoliciesForFilesRaw) {\n\t\t\tfor (const [policyName, filters] of Object.entries(\n\t\t\t\texcludePoliciesForFilesRaw,\n\t\t\t)) {\n\t\t\t\tconst regexes = filters.map((e) => toRegExp(e));\n\t\t\t\texcludePoliciesForFiles.set(policyName, regexes);\n\t\t\t}\n\t\t}\n\t\tconst gitRoot = await findGitRoot();\n\n\t\tconst pathRegex = this.flags.path ?? DEFAULT_PATH_REGEX;\n\t\tif (this.flags.path !== undefined) {\n\t\t\tthis.info(`Filtering file paths by regex: ${pathRegex}`);\n\t\t}\n\n\t\tthis.context = {\n\t\t\tpathRegex,\n\t\t\texcludeFiles,\n\t\t\tpolicies,\n\t\t\texcludePoliciesForFiles,\n\t\t\tgitRoot,\n\t\t\tperfStats: newPerfStats(),\n\t\t};\n\t}\n}\n\nexport type ExcludedPolicyFileMap = Map<PolicyName, RegExp[]>;\n\nfunction toRegExp(input: string | RegExp): RegExp {\n\tif (typeof input === \"string\") {\n\t\treturn new RegExp(input, \"i\");\n\t}\n\treturn input;\n}\n"]}
1
+ {"version":3,"file":"baseCommand.js","sourceRoot":"","sources":["../src/baseCommand.ts"],"names":[],"m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AAE,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;gBACvD,uBAAuB,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;QAED,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG;YACf,YAAY;YACZ,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,IAAI,eAAe;YACzD,uBAAuB;YACvB,OAAO;YACP,SAAS,EAAE,YAAY,EAAE;SACzB,CAAC;IACH,CAAC;IAEO,QAAQ,CAAmC;IAEnD,yEAAyE;IAClE,KAAK,CAAC,UAAU;QACtB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC","sourcesContent":["import {\n\tCommandWithConfig,\n\ttype CommandWithContext,\n\ttype RequiresGit,\n} from \"@tylerbu/cli-api\";\nimport { findGitRootSync } from \"@tylerbu/fundamentals/git\";\nimport { type SimpleGit, simpleGit } from \"simple-git\";\nimport { DefaultPolicyConfig, type RepopoConfig } from \"./config.js\";\nimport type { ExcludedPolicyFileMap, RepopoCommandContext } from \"./context.js\";\nimport { newPerfStats } from \"./perf.js\";\nimport { DefaultPolicies } from \"./policy.js\";\n\n/**\n * This class is the base for all repopo commands. It contains common flags and config loading.\n */\nexport abstract class BaseRepopoCommand<\n\t\tT extends typeof BaseRepopoCommand & {\n\t\t\targs: typeof CommandWithConfig.args;\n\t\t\tflags: typeof CommandWithConfig.flags;\n\t\t},\n\t>\n\textends CommandWithConfig<T, RepopoConfig>\n\timplements CommandWithContext<RepopoCommandContext>, RequiresGit\n{\n\tprotected override defaultConfig = DefaultPolicyConfig;\n\n\tstatic override readonly flags = {\n\t\t...CommandWithConfig.flags,\n\t} as const;\n\n\tprivate _git: SimpleGit | undefined;\n\tpublic get git(): SimpleGit {\n\t\tif (this._git === undefined) {\n\t\t\tthrow new Error(\"git property is undefined\");\n\t\t}\n\t\treturn this._git;\n\t}\n\n\tpublic override async init(): Promise<void> {\n\t\tawait super.init();\n\n\t\tconst excludeFiles: RegExp[] =\n\t\t\tthis.commandConfig?.excludeFiles?.map((e) => new RegExp(e, \"i\")) ?? [];\n\n\t\tconst excludePoliciesForFilesRaw =\n\t\t\tthis.commandConfig?.excludePoliciesForFiles;\n\n\t\tconst excludePoliciesForFiles: ExcludedPolicyFileMap = new Map();\n\t\tif (excludePoliciesForFilesRaw) {\n\t\t\tfor (const [policyName, filters] of Object.entries(\n\t\t\t\texcludePoliciesForFilesRaw,\n\t\t\t)) {\n\t\t\t\tconst regexes = filters.map((e) => new RegExp(e, \"i\"));\n\t\t\t\texcludePoliciesForFiles.set(policyName, regexes);\n\t\t\t}\n\t\t}\n\n\t\tconst gitRoot = findGitRootSync();\n\t\tthis._git = simpleGit({ baseDir: gitRoot });\n\t\tthis._context = {\n\t\t\texcludeFiles,\n\t\t\tpolicies: this.commandConfig?.policies ?? DefaultPolicies,\n\t\t\texcludePoliciesForFiles,\n\t\t\tgitRoot,\n\t\t\tperfStats: newPerfStats(),\n\t\t};\n\t}\n\n\tprivate _context: RepopoCommandContext | undefined;\n\n\t// biome-ignore lint/suspicious/useAwait: interface defines this as async\n\tpublic async getContext(): Promise<RepopoCommandContext> {\n\t\tif (this._context === undefined) {\n\t\t\tthrow new Error(\"Context not initialized.\");\n\t\t}\n\t\treturn this._context;\n\t}\n}\n"]}
@@ -15,24 +15,18 @@ export declare class CheckPolicy<T extends typeof BaseRepopoCommand & {
15
15
  static readonly summary = "Checks and applies policies to the files in the repository.";
16
16
  static readonly flags: {
17
17
  readonly config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
- readonly policy: import("@oclif/core/interfaces").OptionFlag<RegExp | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
- readonly excludePolicy: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
- readonly path: import("@oclif/core/interfaces").OptionFlag<RegExp | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
18
  readonly fix: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
19
  readonly stdin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
23
20
  };
24
- private processed;
25
- private count;
26
- defaultConfig: import("../config.js").PolicyConfig;
27
- init(): Promise<void>;
28
21
  run(): Promise<void>;
29
- private executePolicy;
22
+ private executeAllPolicies;
30
23
  /**
31
24
  * Routes files to their handlers and resolvers by regex testing their full paths. If a file fails a policy that has a
32
25
  * resolver, the resolver will be invoked as well. Synchronizes the output, exit codes, and resolve
33
26
  * decision for all handlers.
34
27
  */
35
28
  private routeToHandlers;
29
+ private runPolicyOnFile;
36
30
  /**
37
31
  * Given a string that represents a path to a file in the repo, determines if the file should be checked, and if so,
38
32
  * routes the file to the appropriate handlers.
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAOA,OAAO,EACN,iBAAiB,EAEjB,MAAM,mBAAmB,CAAC;AAK3B;;;;;;;;GAQG;AACH,qBAAa,WAAW,CACvB,CAAC,SAAS,OAAO,iBAAiB,GAAG;IACpC,IAAI,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC;IAC9B,KAAK,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC;CAChC,CACA,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAC7B,gBAAyB,OAAO,iEAC+B;IAE/D,gBAAyB,KAAK;gCAhBf,wBAAwB,wCAAwC,wBAAwB;;;;;;MA4B5F;IAEX,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,KAAK,CAAK;IAEF,aAAa,sCAAuB;IAE9B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAuC5B,aAAa;IAc3B;;;;OAIG;YACW,eAAe;IA0G7B;;;OAGG;YACW,kBAAkB;CA0BhC"}
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKtD;;;;;;;;GAQG;AACH,qBAAa,WAAW,CACvB,CAAC,SAAS,OAAO,iBAAiB,GAAG;IACpC,IAAI,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC;IAC9B,KAAK,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC;CAChC,CACA,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAC7B,gBAAyB,OAAO,iEAC+B;IAE/D,gBAAyB,KAAK;gCAhBkB,wBAAuB,wCAAwC,wBAE/F;;;MA0BL;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAmC5B,kBAAkB;IAehC;;;;OAIG;YACW,eAAe;YAwBf,eAAe;IAkG7B;;;OAGG;YACW,kBAAkB;CAwBhC"}