virmator 9.0.2 → 9.1.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.
@@ -4,9 +4,11 @@ import {generateDepCruiserConfig} from 'virmator/dist/compiled-base-configs/base
4
4
  const depCruiserConfig: IConfiguration = generateDepCruiserConfig({
5
5
  fileExceptions: {
6
6
  // enter file exceptions by rule name here
7
- 'no-orphans': [
8
- 'src/index.ts',
9
- ],
7
+ 'no-orphans': {
8
+ from: [
9
+ 'src/index.ts',
10
+ ],
11
+ },
10
12
  },
11
13
  omitRules: [
12
14
  // enter rule names here to omit
@@ -1,6 +1,9 @@
1
1
  export declare function generateDepCruiserConfig({ fileExceptions, omitRules, }: {
2
- fileExceptions: Record<string, string[]>;
3
- omitRules: string[];
2
+ fileExceptions: Readonly<Record<string, Readonly<Partial<{
3
+ to: ReadonlyArray<string> | undefined;
4
+ from: ReadonlyArray<string> | undefined;
5
+ }>>>>;
6
+ omitRules: ReadonlyArray<string>;
4
7
  }): {
5
8
  forbidden: ({
6
9
  name: string;
@@ -154,10 +154,27 @@ function generateDepCruiserConfig({ fileExceptions, omitRules, }) {
154
154
  if (!rule) {
155
155
  throw new Error(`Rule name not used: '${ruleName}'`);
156
156
  }
157
- const pathNot = rule.from.pathNot ?? [];
158
- pathNot.push(...fileExceptions);
157
+ const fromPathNot = rule.from.pathNot
158
+ ? Array.isArray(rule.from.pathNot)
159
+ ? rule.from.pathNot
160
+ : [rule.from.pathNot]
161
+ : [];
162
+ const toPathNot = rule.to.pathNot
163
+ ? Array.isArray(rule.to.pathNot)
164
+ ? rule.to.pathNot
165
+ : [rule.to.pathNot]
166
+ : [];
167
+ if (fileExceptions.from?.length) {
168
+ fromPathNot.push(...fileExceptions.from);
169
+ }
170
+ if (fileExceptions.to?.length) {
171
+ toPathNot.push(...fileExceptions.to);
172
+ }
159
173
  if (!rule.from.pathNot) {
160
- rule.from.pathNot = pathNot;
174
+ rule.from.pathNot = fromPathNot;
175
+ }
176
+ if (!rule.to.pathNot) {
177
+ rule.to.pathNot = toPathNot;
161
178
  }
162
179
  });
163
180
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "9.0.2",
3
+ "version": "9.1.0",
4
4
  "description": "Handle common package configs, commands, and dependencies.",
5
5
  "keywords": [
6
6
  "automation",
@@ -1,16 +0,0 @@
1
- import type {IConfiguration} from 'dependency-cruiser';
2
- import {generateDepCruiserConfig} from 'virmator/dist/compiled-base-configs/base-dep-cruiser.config';
3
-
4
- const depCruiserConfig: IConfiguration = generateDepCruiserConfig({
5
- fileExceptions: {
6
- // enter file exceptions by rule name here
7
- 'no-orphans': [
8
- 'src/index.ts',
9
- ],
10
- },
11
- omitRules: [
12
- // enter rule names here to omit
13
- ],
14
- });
15
-
16
- module.exports = depCruiserConfig;