@leancodepl/folder-structure-cruiser 9.7.2 → 9.7.3
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/CHANGELOG.md +9 -0
- package/LICENSE +201 -0
- package/dist/bin.cjs +2 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +13 -0
- package/{src → dist}/commands/validateCrossFeatureImports.d.ts +4 -3
- package/dist/commands/validateCrossFeatureImports.d.ts.map +1 -0
- package/{src → dist}/commands/validateSharedComponent.d.ts +4 -3
- package/dist/commands/validateSharedComponent.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/{src → dist}/lib/checkCrossFeatureImports.d.ts +3 -2
- package/dist/lib/checkCrossFeatureImports.d.ts.map +1 -0
- package/{src → dist}/lib/checkSharedComponents.d.ts +3 -2
- package/dist/lib/checkSharedComponents.d.ts.map +1 -0
- package/{src → dist}/lib/findCommonPathsPrefix.d.ts +1 -0
- package/dist/lib/findCommonPathsPrefix.d.ts.map +1 -0
- package/{src → dist}/lib/formatMessages.d.ts +1 -0
- package/dist/lib/formatMessages.d.ts.map +1 -0
- package/{src → dist}/lib/getCruiseResult.d.ts +2 -1
- package/dist/lib/getCruiseResult.d.ts.map +1 -0
- package/dist/lib/logger.d.ts +9 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/validateSharedComponent-BqvIbK3d.cjs +3 -0
- package/dist/validateSharedComponent-YmSG2wR9.js +118 -0
- package/package.json +25 -12
- package/.dependency-cruiser.json +0 -30
- package/src/bin.d.ts +0 -2
- package/src/bin.js +0 -35
- package/src/bin.js.map +0 -1
- package/src/commands/validateCrossFeatureImports.js +0 -80
- package/src/commands/validateCrossFeatureImports.js.map +0 -1
- package/src/commands/validateSharedComponent.js +0 -78
- package/src/commands/validateSharedComponent.js.map +0 -1
- package/src/index.d.ts +0 -2
- package/src/index.js +0 -3
- package/src/index.js.map +0 -1
- package/src/lib/checkCrossFeatureImports.js +0 -31
- package/src/lib/checkCrossFeatureImports.js.map +0 -1
- package/src/lib/checkSharedComponents.js +0 -48
- package/src/lib/checkSharedComponents.js.map +0 -1
- package/src/lib/findCommonPathsPrefix.js +0 -22
- package/src/lib/findCommonPathsPrefix.js.map +0 -1
- package/src/lib/formatMessages.js +0 -7
- package/src/lib/formatMessages.js.map +0 -1
- package/src/lib/getCruiseResult.js +0 -14
- package/src/lib/getCruiseResult.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.7.3](https://github.com/leancodepl/js_corelibrary/compare/v9.7.2...v9.7.3) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @leancodepl/folder-structure-cruiser
|
|
9
|
+
|
|
10
|
+
# Change Log
|
|
11
|
+
|
|
12
|
+
All notable changes to this project will be documented in this file. See
|
|
13
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
14
|
+
|
|
6
15
|
## [9.7.2](https://github.com/leancodepl/js_corelibrary/compare/v9.7.1...v9.7.2) (2026-01-20)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @leancodepl/folder-structure-cruiser
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/bin.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";const o=require("commander"),r=require("./validateSharedComponent-BqvIbK3d.cjs");o.program.name("folder-structure-cruiser").description("CLI tool for validating folder structure rules");o.program.command("validate-shared-components").description("Validate if shared components are located at the first shared level").option("-d, --directory <dir>","Directory to analyze",".").option("-c, --config <path_to_config>","Path to config file").option("-t, --tsConfig <path_to_ts_config>","Path to ts config file").option("-w, --webpackConfig <path_to_webpack_config>","Path to webpack config file").action(async t=>{const e=t.directory?[t.directory]:[".*"],i=t.config??"",a=t.tsConfig,c=t.webpackConfig;await r.validateSharedComponent({directories:e,configPath:i,tsConfigPath:a,webpackConfigPath:c})});o.program.command("validate-cross-feature-imports").description("Validate if cross-feature nested imports are allowed").option("-d, --directory <dir>","Directory to analyze",".").option("-c, --config <path_to_config>","Path to config file").option("-t, --tsConfig <path_to_ts_config>","Path to ts config file").option("-w, --webpackConfig <path_to_webpack_config>","Path to webpack config file").action(async t=>{const e=t.directory?[t.directory]:[".*"],i=t.config??"",a=t.tsConfig,c=t.webpackConfig;await r.validateCrossFeatureImports({directories:e,configPath:i,tsConfigPath:a,webpackConfigPath:c})});o.program.parse();
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { program as o } from "commander";
|
|
3
|
+
import { a as n, v as r } from "./validateSharedComponent-YmSG2wR9.js";
|
|
4
|
+
o.name("folder-structure-cruiser").description("CLI tool for validating folder structure rules");
|
|
5
|
+
o.command("validate-shared-components").description("Validate if shared components are located at the first shared level").option("-d, --directory <dir>", "Directory to analyze", ".").option("-c, --config <path_to_config>", "Path to config file").option("-t, --tsConfig <path_to_ts_config>", "Path to ts config file").option("-w, --webpackConfig <path_to_webpack_config>", "Path to webpack config file").action(async (t) => {
|
|
6
|
+
const i = t.directory ? [t.directory] : [".*"], a = t.config ?? "", e = t.tsConfig, c = t.webpackConfig;
|
|
7
|
+
await n({ directories: i, configPath: a, tsConfigPath: e, webpackConfigPath: c });
|
|
8
|
+
});
|
|
9
|
+
o.command("validate-cross-feature-imports").description("Validate if cross-feature nested imports are allowed").option("-d, --directory <dir>", "Directory to analyze", ".").option("-c, --config <path_to_config>", "Path to config file").option("-t, --tsConfig <path_to_ts_config>", "Path to ts config file").option("-w, --webpackConfig <path_to_webpack_config>", "Path to webpack config file").action(async (t) => {
|
|
10
|
+
const i = t.directory ? [t.directory] : [".*"], a = t.config ?? "", e = t.tsConfig, c = t.webpackConfig;
|
|
11
|
+
await r({ directories: i, configPath: a, tsConfigPath: e, webpackConfigPath: c });
|
|
12
|
+
});
|
|
13
|
+
o.parse();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CruiseParams } from
|
|
1
|
+
import { CruiseParams } from '../lib/getCruiseResult.js';
|
|
2
2
|
/**
|
|
3
3
|
* Validates cross-feature nested imports according to folder structure rules.
|
|
4
4
|
*
|
|
@@ -49,11 +49,12 @@ import { CruiseParams } from "../lib/getCruiseResult.js";
|
|
|
49
49
|
* configPath: ".dependency-cruiser.js",
|
|
50
50
|
* tsConfigPath: "./tsconfig.base.json"
|
|
51
51
|
* });
|
|
52
|
-
*
|
|
52
|
+
* logger.info("Cross-feature import validation passed");
|
|
53
53
|
* } catch (error) {
|
|
54
|
-
*
|
|
54
|
+
* logger.error("Cross-feature import validation failed:", error);
|
|
55
55
|
* process.exit(1);
|
|
56
56
|
* }
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export declare function validateCrossFeatureImports(cruiseParams: CruiseParams): Promise<void>;
|
|
60
|
+
//# sourceMappingURL=validateCrossFeatureImports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateCrossFeatureImports.d.ts","sourceRoot":"","sources":["../../src/commands/validateCrossFeatureImports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAmB,MAAM,2BAA2B,CAAA;AAGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAsB,2BAA2B,CAAC,YAAY,EAAE,YAAY,iBAkB3E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CruiseParams } from
|
|
1
|
+
import { CruiseParams } from '../lib/getCruiseResult.js';
|
|
2
2
|
/**
|
|
3
3
|
* Validates if shared components are located at the first shared level.
|
|
4
4
|
*
|
|
@@ -49,11 +49,12 @@ import { CruiseParams } from "../lib/getCruiseResult.js";
|
|
|
49
49
|
* configPath: ".dependency-cruiser.js",
|
|
50
50
|
* tsConfigPath: "./tsconfig.base.json"
|
|
51
51
|
* });
|
|
52
|
-
*
|
|
52
|
+
* logger.info("Shared component validation passed");
|
|
53
53
|
* } catch (error) {
|
|
54
|
-
*
|
|
54
|
+
* logger.error("Shared component validation failed:", error);
|
|
55
55
|
* process.exit(1);
|
|
56
56
|
* }
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export declare function validateSharedComponent(cruiseParams: CruiseParams): Promise<void>;
|
|
60
|
+
//# sourceMappingURL=validateSharedComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSharedComponent.d.ts","sourceRoot":"","sources":["../../src/commands/validateSharedComponent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAmB,MAAM,2BAA2B,CAAA;AAGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAsB,uBAAuB,CAAC,YAAY,EAAE,YAAY,iBAkBvE"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./validateSharedComponent-BqvIbK3d.cjs");exports.validateCrossFeatureImports=e.validateCrossFeatureImports;exports.validateSharedComponent=e.validateSharedComponent;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAA;AACzD,cAAc,uCAAuC,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IReporterOutput } from
|
|
2
|
-
import { Message } from
|
|
1
|
+
import { IReporterOutput } from 'dependency-cruiser';
|
|
2
|
+
import { Message } from './formatMessages.js';
|
|
3
3
|
type CheckResult = {
|
|
4
4
|
messages: Message[];
|
|
5
5
|
totalCruised: number;
|
|
6
6
|
};
|
|
7
7
|
export declare function checkCrossFeatureImports(result: IReporterOutput): CheckResult;
|
|
8
8
|
export {};
|
|
9
|
+
//# sourceMappingURL=checkCrossFeatureImports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkCrossFeatureImports.d.ts","sourceRoot":"","sources":["../../src/lib/checkCrossFeatureImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,KAAK,WAAW,GAAG;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,CAqC7E"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IReporterOutput } from
|
|
2
|
-
import { Message } from
|
|
1
|
+
import { IReporterOutput } from 'dependency-cruiser';
|
|
2
|
+
import { Message } from './formatMessages.js';
|
|
3
3
|
type CheckResult = {
|
|
4
4
|
messages: Message[];
|
|
5
5
|
totalCruised: number;
|
|
6
6
|
};
|
|
7
7
|
export declare function checkSharedComponents(result: IReporterOutput): CheckResult;
|
|
8
8
|
export {};
|
|
9
|
+
//# sourceMappingURL=checkSharedComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkSharedComponents.d.ts","sourceRoot":"","sources":["../../src/lib/checkSharedComponents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,KAAK,WAAW,GAAG;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAA;AAmBhE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,CA8C1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findCommonPathsPrefix.d.ts","sourceRoot":"","sources":["../../src/lib/findCommonPathsPrefix.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CAiBjE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAErE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatMessages.d.ts","sourceRoot":"","sources":["../../src/lib/formatMessages.ts"],"names":[],"mappings":"AAIA,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAEhC,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,YAEjD"}
|
|
@@ -4,4 +4,5 @@ export type CruiseParams = {
|
|
|
4
4
|
tsConfigPath?: string;
|
|
5
5
|
webpackConfigPath?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare function getCruiseResult({ directories, configPath, tsConfigPath, webpackConfigPath, }: CruiseParams): Promise<import(
|
|
7
|
+
export declare function getCruiseResult({ directories, configPath, tsConfigPath, webpackConfigPath, }: CruiseParams): Promise<import('dependency-cruiser').IReporterOutput>;
|
|
8
|
+
//# sourceMappingURL=getCruiseResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCruiseResult.d.ts","sourceRoot":"","sources":["../../src/lib/getCruiseResult.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAoB,EACpB,UAAU,EACV,YAAY,EACZ,iBAAiB,GAClB,EAAE,YAAY,yDAUd"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const logger: import('packages/logger/dist/lib/logger').Logger<{}, {
|
|
2
|
+
error: import('packages/logger/dist/lib/logger').MethodHandler<unknown>;
|
|
3
|
+
warn: import('packages/logger/dist/lib/logger').MethodHandler<unknown>;
|
|
4
|
+
success: import('packages/logger/dist/lib/logger').MethodHandler<unknown>;
|
|
5
|
+
info: import('packages/logger/dist/lib/logger').MethodHandler<unknown>;
|
|
6
|
+
verbose: import('packages/logger/dist/lib/logger').MethodHandler<unknown>;
|
|
7
|
+
debug: import('packages/logger/dist/lib/logger').MethodHandler<unknown>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;;;;;;;EAAoB,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";const v=require("chalk"),x=require("dependency-cruiser"),y=require("dependency-cruiser/config-utl/extract-depcruise-options"),P=require("dependency-cruiser/config-utl/extract-ts-config"),F=require("dependency-cruiser/config-utl/extract-webpack-resolve-config"),M=require("@leancodepl/logger/cli");function m(e){if(e.length===0)return[];if(e.length===1)return e[0];const t=[],s=Math.min(...e.map(o=>o.length));for(let o=0;o<s;o++){const n=e[0][o];if(e.every(r=>r[o]===n))t.push(n);else break}return t}function g(e){return m(e).length}function $(e){const t=typeof e.output=="object"?e.output:void 0,s=t?.modules??[],o=[];for(const n of s){if(n.coreModule)continue;const r=n.dependencies||[],i=n.source.split("/");r.forEach(a=>{const l=a.resolved.split("/"),u=g([i,l]);(!u||u<i.length&&l.length>u+2)&&o.push({source:n.source,target:a.resolved,rule:"cross-feature-nested-imports",severity:"error"})})}return{messages:o,totalCruised:t?.summary.totalCruised??0}}const{bold:f}=v;function p(e){return e.map(t=>`${t.rule}: ${f(t.source)} → ${f(t.target)}`)}async function h({directories:e=[".*"],configPath:t,tsConfigPath:s,webpackConfigPath:o}){const n=await y(t),r=o?await F(o):void 0,i=s?P(s):void 0;return await x.cruise(e,{...n},r,{tsConfig:i})}const c=M.createCliLogger();async function j(e){try{const t=await h(e),{messages:s,totalCruised:o}=$(t);if(s.length===0&&c.success("✅ No issues found!"),s.length>0){const n=p(s);c.error(n.join(`
|
|
2
|
+
`)),c.error(`Found ${s.length} violations(s). ${o} modules cruised.`)}}catch(t){c.error(t)}}function q(e,t,s){const o=e.at(-1)??"";if(!/index\.(tsx?|jsx?|ts|js)$/.test(o))return!1;const n=e.at(-3)??"",r=t.at(-1);return n===r&&s===e.length-2}function L(e){const t=typeof e.output=="object"?e.output:void 0,s=t?.modules??[],o=[];for(const n of s){if(n.coreModule)continue;const r=n.dependents||[];if(r.length<=1)continue;const i=n.source.split("/"),a=i.length;if(a<=2)continue;const l=r.map(C=>C.split("/")),u=m(l),d=g([i,u]);q(i,u,d)||d<a-1&&o.push({source:n.source,target:u.join("/"),rule:"not-shared-level",severity:"info"})}return{messages:o,totalCruised:t?.summary.totalCruised??0}}async function R(e){try{const t=await h(e),{messages:s,totalCruised:o}=L(t);if(s.length===0&&c.success("✅ No issues found!"),s.length>0){const n=p(s);c.info(n.join(`
|
|
3
|
+
`)),c.info(`Found ${s.length} violations(s). ${o} modules cruised.`)}}catch(t){c.error(t)}}exports.validateCrossFeatureImports=j;exports.validateSharedComponent=R;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import C from "chalk";
|
|
2
|
+
import { cruise as x } from "dependency-cruiser";
|
|
3
|
+
import P from "dependency-cruiser/config-utl/extract-depcruise-options";
|
|
4
|
+
import y from "dependency-cruiser/config-utl/extract-ts-config";
|
|
5
|
+
import M from "dependency-cruiser/config-utl/extract-webpack-resolve-config";
|
|
6
|
+
import { createCliLogger as $ } from "@leancodepl/logger/cli";
|
|
7
|
+
function m(e) {
|
|
8
|
+
if (e.length === 0) return [];
|
|
9
|
+
if (e.length === 1) return e[0];
|
|
10
|
+
const t = [], s = Math.min(...e.map((o) => o.length));
|
|
11
|
+
for (let o = 0; o < s; o++) {
|
|
12
|
+
const n = e[0][o];
|
|
13
|
+
if (e.every((r) => r[o] === n))
|
|
14
|
+
t.push(n);
|
|
15
|
+
else
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
}
|
|
20
|
+
function p(e) {
|
|
21
|
+
return m(e).length;
|
|
22
|
+
}
|
|
23
|
+
function j(e) {
|
|
24
|
+
const t = typeof e.output == "object" ? e.output : void 0, s = t?.modules ?? [], o = [];
|
|
25
|
+
for (const n of s) {
|
|
26
|
+
if (n.coreModule)
|
|
27
|
+
continue;
|
|
28
|
+
const r = n.dependencies || [], i = n.source.split("/");
|
|
29
|
+
r.forEach((a) => {
|
|
30
|
+
const l = a.resolved.split("/"), u = p([i, l]);
|
|
31
|
+
(!u || u < i.length && l.length > u + 2) && o.push({
|
|
32
|
+
source: n.source,
|
|
33
|
+
target: a.resolved,
|
|
34
|
+
rule: "cross-feature-nested-imports",
|
|
35
|
+
severity: "error"
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
messages: o,
|
|
41
|
+
totalCruised: t?.summary.totalCruised ?? 0
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const { bold: d } = C;
|
|
45
|
+
function g(e) {
|
|
46
|
+
return e.map((t) => `${t.rule}: ${d(t.source)} → ${d(t.target)}`);
|
|
47
|
+
}
|
|
48
|
+
async function h({
|
|
49
|
+
directories: e = [".*"],
|
|
50
|
+
configPath: t,
|
|
51
|
+
tsConfigPath: s,
|
|
52
|
+
webpackConfigPath: o
|
|
53
|
+
}) {
|
|
54
|
+
const n = await P(t), r = o ? await M(o) : void 0, i = s ? y(s) : void 0;
|
|
55
|
+
return await x(e, { ...n }, r, {
|
|
56
|
+
tsConfig: i
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const c = $();
|
|
60
|
+
async function N(e) {
|
|
61
|
+
try {
|
|
62
|
+
const t = await h(e), { messages: s, totalCruised: o } = j(t);
|
|
63
|
+
if (s.length === 0 && c.success("✅ No issues found!"), s.length > 0) {
|
|
64
|
+
const n = g(s);
|
|
65
|
+
c.error(n.join(`
|
|
66
|
+
`)), c.error(`Found ${s.length} violations(s). ${o} modules cruised.`);
|
|
67
|
+
}
|
|
68
|
+
} catch (t) {
|
|
69
|
+
c.error(t);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function F(e, t, s) {
|
|
73
|
+
const o = e.at(-1) ?? "";
|
|
74
|
+
if (!/index\.(tsx?|jsx?|ts|js)$/.test(o))
|
|
75
|
+
return !1;
|
|
76
|
+
const n = e.at(-3) ?? "", r = t.at(-1);
|
|
77
|
+
return n === r && s === e.length - 2;
|
|
78
|
+
}
|
|
79
|
+
function L(e) {
|
|
80
|
+
const t = typeof e.output == "object" ? e.output : void 0, s = t?.modules ?? [], o = [];
|
|
81
|
+
for (const n of s) {
|
|
82
|
+
if (n.coreModule)
|
|
83
|
+
continue;
|
|
84
|
+
const r = n.dependents || [];
|
|
85
|
+
if (r.length <= 1)
|
|
86
|
+
continue;
|
|
87
|
+
const i = n.source.split("/"), a = i.length;
|
|
88
|
+
if (a <= 2)
|
|
89
|
+
continue;
|
|
90
|
+
const l = r.map((v) => v.split("/")), u = m(l), f = p([i, u]);
|
|
91
|
+
F(i, u, f) || f < a - 1 && o.push({
|
|
92
|
+
source: n.source,
|
|
93
|
+
target: u.join("/"),
|
|
94
|
+
rule: "not-shared-level",
|
|
95
|
+
severity: "info"
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
messages: o,
|
|
100
|
+
totalCruised: t?.summary.totalCruised ?? 0
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
async function S(e) {
|
|
104
|
+
try {
|
|
105
|
+
const t = await h(e), { messages: s, totalCruised: o } = L(t);
|
|
106
|
+
if (s.length === 0 && c.success("✅ No issues found!"), s.length > 0) {
|
|
107
|
+
const n = g(s);
|
|
108
|
+
c.info(n.join(`
|
|
109
|
+
`)), c.info(`Found ${s.length} violations(s). ${o} modules cruised.`);
|
|
110
|
+
}
|
|
111
|
+
} catch (t) {
|
|
112
|
+
c.error(t);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
S as a,
|
|
117
|
+
N as v
|
|
118
|
+
};
|
package/package.json
CHANGED
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/folder-structure-cruiser",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
6
17
|
"bin": {
|
|
7
|
-
"folder-structure-cruiser": "
|
|
18
|
+
"folder-structure-cruiser": "./dist/bin.js"
|
|
8
19
|
},
|
|
9
20
|
"dependencies": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
21
|
+
"@leancodepl/logger": "9.7.3",
|
|
22
|
+
"chalk": ">=5.0.0",
|
|
23
|
+
"commander": "^14.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"vitest": "*"
|
|
12
27
|
},
|
|
13
28
|
"peerDependencies": {
|
|
14
29
|
"dependency-cruiser": "^17.0.0"
|
|
15
30
|
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@jest/globals": "^30.0.5",
|
|
18
|
-
"jest": "^29.0.0"
|
|
19
|
-
},
|
|
20
31
|
"publishConfig": {
|
|
21
32
|
"access": "public",
|
|
22
33
|
"registry": "https://registry.npmjs.org/"
|
|
23
34
|
},
|
|
24
35
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
36
|
+
"node": ">=22.0.0"
|
|
26
37
|
},
|
|
27
38
|
"repository": {
|
|
28
39
|
"type": "git",
|
|
@@ -48,7 +59,9 @@
|
|
|
48
59
|
"url": "https://leancode.co"
|
|
49
60
|
},
|
|
50
61
|
"sideEffects": false,
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
"files": [
|
|
63
|
+
"dist",
|
|
64
|
+
"CHANGELOG.md",
|
|
65
|
+
"!**/*.tsbuildinfo"
|
|
66
|
+
]
|
|
54
67
|
}
|
package/.dependency-cruiser.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"forbidden": [
|
|
3
|
-
{
|
|
4
|
-
"name": "no-orphans",
|
|
5
|
-
"from": {
|
|
6
|
-
"orphan": true
|
|
7
|
-
},
|
|
8
|
-
"to": {}
|
|
9
|
-
}
|
|
10
|
-
],
|
|
11
|
-
"options": {
|
|
12
|
-
"doNotFollow": {
|
|
13
|
-
"path": [
|
|
14
|
-
"node_modules",
|
|
15
|
-
"(^|/)[.][^/]+[.](?:js|cjs|mjs|ts|cts|mts|json)$",
|
|
16
|
-
"[.]d[.]ts$",
|
|
17
|
-
"(^|/)tsconfig[.]json$"
|
|
18
|
-
],
|
|
19
|
-
"dependencyTypes": ["npm-no-pkg", "npm-unknown"]
|
|
20
|
-
},
|
|
21
|
-
"exclude": {
|
|
22
|
-
"path": ["node_modules", "(^|/)[.][^/]+[.](?:js|cjs|mjs|ts|cts|mts|json)$", "[.]d[.]ts$", "(^|/)tsconfig[.]json$"]
|
|
23
|
-
},
|
|
24
|
-
"tsPreCompilationDeps": true,
|
|
25
|
-
"enhancedResolveOptions": {
|
|
26
|
-
"exportsFields": ["exports"],
|
|
27
|
-
"conditionNames": ["import", "require", "node", "default"]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/bin.d.ts
DELETED
package/src/bin.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { program } from "commander";
|
|
3
|
-
import { validateCrossFeatureImports } from "./commands/validateCrossFeatureImports.js";
|
|
4
|
-
import { validateSharedComponent } from "./commands/validateSharedComponent.js";
|
|
5
|
-
program.name("folder-structure-cruiser").description("CLI tool for validating folder structure rules");
|
|
6
|
-
program
|
|
7
|
-
.command("validate-shared-components")
|
|
8
|
-
.description("Validate if shared components are located at the first shared level")
|
|
9
|
-
.option("-d, --directory <dir>", "Directory to analyze", ".")
|
|
10
|
-
.option("-c, --config <path_to_config>", "Path to config file")
|
|
11
|
-
.option("-t, --tsConfig <path_to_ts_config>", "Path to ts config file")
|
|
12
|
-
.option("-w, --webpackConfig <path_to_webpack_config>", "Path to webpack config file")
|
|
13
|
-
.action(async (options) => {
|
|
14
|
-
const directories = options.directory ? [options.directory] : [".*"];
|
|
15
|
-
const configPath = options.config ?? "";
|
|
16
|
-
const tsConfigPath = options.tsConfig;
|
|
17
|
-
const webpackConfigPath = options.webpackConfig;
|
|
18
|
-
await validateSharedComponent({ directories, configPath, tsConfigPath, webpackConfigPath });
|
|
19
|
-
});
|
|
20
|
-
program
|
|
21
|
-
.command("validate-cross-feature-imports")
|
|
22
|
-
.description("Validate if cross-feature nested imports are allowed")
|
|
23
|
-
.option("-d, --directory <dir>", "Directory to analyze", ".")
|
|
24
|
-
.option("-c, --config <path_to_config>", "Path to config file")
|
|
25
|
-
.option("-t, --tsConfig <path_to_ts_config>", "Path to ts config file")
|
|
26
|
-
.option("-w, --webpackConfig <path_to_webpack_config>", "Path to webpack config file")
|
|
27
|
-
.action(async (options) => {
|
|
28
|
-
const directories = options.directory ? [options.directory] : [".*"];
|
|
29
|
-
const configPath = options.config ?? "";
|
|
30
|
-
const tsConfigPath = options.tsConfig;
|
|
31
|
-
const webpackConfigPath = options.webpackConfig;
|
|
32
|
-
await validateCrossFeatureImports({ directories, configPath, tsConfigPath, webpackConfigPath });
|
|
33
|
-
});
|
|
34
|
-
program.parse();
|
|
35
|
-
//# sourceMappingURL=bin.js.map
|
package/src/bin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../../packages/folder-structure-cruiser/src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAA;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAE/E,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,WAAW,CAAC,gDAAgD,CAAC,CAAA;AAEtG,OAAO;KACJ,OAAO,CAAC,4BAA4B,CAAC;KACrC,WAAW,CAAC,qEAAqE,CAAC;KAClF,MAAM,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,GAAG,CAAC;KAC5D,MAAM,CAAC,+BAA+B,EAAE,qBAAqB,CAAC;KAC9D,MAAM,CAAC,oCAAoC,EAAE,wBAAwB,CAAC;KACtE,MAAM,CAAC,8CAA8C,EAAE,6BAA6B,CAAC;KAErF,MAAM,CAAC,KAAK,EAAC,OAAO,EAAC,EAAE;IACtB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACpE,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAA;IACvC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAA;IACrC,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAA;IAE/C,MAAM,uBAAuB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC,CAAA;AAC7F,CAAC,CAAC,CAAA;AAEJ,OAAO;KACJ,OAAO,CAAC,gCAAgC,CAAC;KACzC,WAAW,CAAC,sDAAsD,CAAC;KACnE,MAAM,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,GAAG,CAAC;KAC5D,MAAM,CAAC,+BAA+B,EAAE,qBAAqB,CAAC;KAC9D,MAAM,CAAC,oCAAoC,EAAE,wBAAwB,CAAC;KACtE,MAAM,CAAC,8CAA8C,EAAE,6BAA6B,CAAC;KACrF,MAAM,CAAC,KAAK,EAAC,OAAO,EAAC,EAAE;IACtB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACpE,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAA;IACvC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAA;IACrC,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAA;IAE/C,MAAM,2BAA2B,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC,CAAA;AACjG,CAAC,CAAC,CAAA;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAA"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import pc from "picocolors";
|
|
2
|
-
import { checkCrossFeatureImports } from "../lib/checkCrossFeatureImports.js";
|
|
3
|
-
import { formatMessages } from "../lib/formatMessages.js";
|
|
4
|
-
import { getCruiseResult } from "../lib/getCruiseResult.js";
|
|
5
|
-
const { red } = pc;
|
|
6
|
-
/**
|
|
7
|
-
* Validates cross-feature nested imports according to folder structure rules.
|
|
8
|
-
*
|
|
9
|
-
* This function analyzes the codebase using dependency-cruiser to identify violations
|
|
10
|
-
* of cross-feature import restrictions. It checks if modules with multiple dependents
|
|
11
|
-
* are properly structured to avoid cross-feature nested imports that violate the
|
|
12
|
-
* established folder structure rules.
|
|
13
|
-
*
|
|
14
|
-
* The function will output violations to the console, showing which modules have
|
|
15
|
-
* cross-feature import issues that need to be resolved.
|
|
16
|
-
*
|
|
17
|
-
* @param cruiseParams - Configuration parameters for the dependency analysis
|
|
18
|
-
* @param cruiseParams.directories - Array of directory paths to analyze. Defaults to [".*"] if not provided
|
|
19
|
-
* @param cruiseParams.configPath - Path to the dependency-cruiser configuration file (e.g., .dependency-cruiser.js)
|
|
20
|
-
* @param cruiseParams.tsConfigPath - Optional path to TypeScript configuration file for enhanced type resolution
|
|
21
|
-
* @param cruiseParams.webpackConfigPath - Optional path to webpack configuration file for webpack alias resolution
|
|
22
|
-
*
|
|
23
|
-
* @returns Promise<void> - The function doesn't return a value but outputs results to console
|
|
24
|
-
*
|
|
25
|
-
* @throws {Error} - Throws an error if the dependency analysis fails or configuration is invalid
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* // Basic usage with default settings
|
|
30
|
-
* await validateCrossFeatureImports({
|
|
31
|
-
* directories: ["src"],
|
|
32
|
-
* configPath: ".dependency-cruiser.js",
|
|
33
|
-
* tsConfigPath: "./tsconfig.base.json"
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* // Advanced usage with webpack support
|
|
37
|
-
* await validateCrossFeatureImports({
|
|
38
|
-
* directories: ["src", "packages"],
|
|
39
|
-
* configPath: ".dependency-cruiser.js",
|
|
40
|
-
* tsConfigPath: "./tsconfig.base.json",
|
|
41
|
-
* webpackConfigPath: "./webpack.config.js"
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```typescript
|
|
47
|
-
* // Using in a build script
|
|
48
|
-
* import { validateCrossFeatureImports } from "@leancodepl/folder-structure-cruiser";
|
|
49
|
-
*
|
|
50
|
-
* try {
|
|
51
|
-
* await validateCrossFeatureImports({
|
|
52
|
-
* directories: ["src"],
|
|
53
|
-
* configPath: ".dependency-cruiser.js",
|
|
54
|
-
* tsConfigPath: "./tsconfig.base.json"
|
|
55
|
-
* });
|
|
56
|
-
* console.log("✅ Cross-feature import validation passed");
|
|
57
|
-
* } catch (error) {
|
|
58
|
-
* console.error("❌ Cross-feature import validation failed:", error);
|
|
59
|
-
* process.exit(1);
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export async function validateCrossFeatureImports(cruiseParams) {
|
|
64
|
-
try {
|
|
65
|
-
const cruiseResult = await getCruiseResult(cruiseParams);
|
|
66
|
-
const { messages: errorMessages, totalCruised } = checkCrossFeatureImports(cruiseResult);
|
|
67
|
-
if (errorMessages.length === 0) {
|
|
68
|
-
console.info("\n✅ No issues found!");
|
|
69
|
-
}
|
|
70
|
-
if (errorMessages.length > 0) {
|
|
71
|
-
const messages = formatMessages(errorMessages);
|
|
72
|
-
console.error(messages.join("\n"));
|
|
73
|
-
console.error(`\n${red(`x Found ${errorMessages.length} violations(s). ${totalCruised} modules cruised.`)}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (pError) {
|
|
77
|
-
console.error(pError);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=validateCrossFeatureImports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateCrossFeatureImports.js","sourceRoot":"","sources":["../../../../../packages/folder-structure-cruiser/src/commands/validateCrossFeatureImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAgB,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEzE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,YAA0B;IAC1E,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC,CAAA;QAExD,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,wBAAwB,CAAC,YAAY,CAAC,CAAA;QAExF,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;QACtC,CAAC;QAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,cAAc,CAAC,aAAa,CAAC,CAAA;YAC9C,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YAClC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,WAAW,aAAa,CAAC,MAAM,mBAAmB,YAAY,mBAAmB,CAAC,EAAE,CAAC,CAAA;QAC9G,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { checkSharedComponents } from "../lib/checkSharedComponents.js";
|
|
2
|
-
import { formatMessages } from "../lib/formatMessages.js";
|
|
3
|
-
import { getCruiseResult } from "../lib/getCruiseResult.js";
|
|
4
|
-
/**
|
|
5
|
-
* Validates if shared components are located at the first shared level.
|
|
6
|
-
*
|
|
7
|
-
* This function analyzes the codebase using dependency-cruiser to identify components
|
|
8
|
-
* that should be moved to shared levels. It checks if components that are used across
|
|
9
|
-
* multiple features are properly placed at the appropriate shared level in the folder
|
|
10
|
-
* structure, following the established architectural patterns.
|
|
11
|
-
*
|
|
12
|
-
* The function will output recommendations to the console, showing which components
|
|
13
|
-
* should be moved to shared levels for better code organization and reusability.
|
|
14
|
-
*
|
|
15
|
-
* @param cruiseParams - Configuration parameters for the dependency analysis
|
|
16
|
-
* @param cruiseParams.directories - Array of directory paths to analyze. Defaults to [".*"] if not provided
|
|
17
|
-
* @param cruiseParams.configPath - Path to the dependency-cruiser configuration file (e.g., .dependency-cruiser.js)
|
|
18
|
-
* @param cruiseParams.tsConfigPath - Optional path to TypeScript configuration file for enhanced type resolution
|
|
19
|
-
* @param cruiseParams.webpackConfigPath - Optional path to webpack configuration file for webpack alias resolution
|
|
20
|
-
*
|
|
21
|
-
* @returns Promise<void> - The function doesn't return a value but outputs results to console
|
|
22
|
-
*
|
|
23
|
-
* @throws {Error} - Throws an error if the dependency analysis fails or configuration is invalid
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* // Basic usage with default settings
|
|
28
|
-
* await validateSharedComponent({
|
|
29
|
-
* directories: ["src"],
|
|
30
|
-
* configPath: ".dependency-cruiser.js",
|
|
31
|
-
* tsConfigPath: "./tsconfig.base.json"
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* // Advanced usage with webpack support
|
|
35
|
-
* await validateSharedComponent({
|
|
36
|
-
* directories: ["src", "packages"],
|
|
37
|
-
* configPath: ".dependency-cruiser.js",
|
|
38
|
-
* tsConfigPath: "./tsconfig.base.json",
|
|
39
|
-
* webpackConfigPath: "./webpack.config.js"
|
|
40
|
-
* });
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* // Using in a build script
|
|
46
|
-
* import { validateSharedComponent } from "@leancodepl/folder-structure-cruiser";
|
|
47
|
-
*
|
|
48
|
-
* try {
|
|
49
|
-
* await validateSharedComponent({
|
|
50
|
-
* directories: ["src"],
|
|
51
|
-
* configPath: ".dependency-cruiser.js",
|
|
52
|
-
* tsConfigPath: "./tsconfig.base.json"
|
|
53
|
-
* });
|
|
54
|
-
* console.log("✅ Shared component validation passed");
|
|
55
|
-
* } catch (error) {
|
|
56
|
-
* console.error("❌ Shared component validation failed:", error);
|
|
57
|
-
* process.exit(1);
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export async function validateSharedComponent(cruiseParams) {
|
|
62
|
-
try {
|
|
63
|
-
const cruiseResult = await getCruiseResult(cruiseParams);
|
|
64
|
-
const { messages: infoMessages, totalCruised } = checkSharedComponents(cruiseResult);
|
|
65
|
-
if (infoMessages.length === 0) {
|
|
66
|
-
console.info("\n✅ No issues found!");
|
|
67
|
-
}
|
|
68
|
-
if (infoMessages.length > 0) {
|
|
69
|
-
const messages = formatMessages(infoMessages);
|
|
70
|
-
console.info(messages.join("\n"));
|
|
71
|
-
console.info(`\nx Found ${infoMessages.length} violations(s). ${totalCruised} modules cruised.`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (pError) {
|
|
75
|
-
console.error(pError);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=validateSharedComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateSharedComponent.js","sourceRoot":"","sources":["../../../../../packages/folder-structure-cruiser/src/commands/validateSharedComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAgB,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,YAA0B;IACtE,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC,CAAA;QAExD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAA;QAEpF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;QACtC,CAAC;QAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,QAAQ,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;YAC7C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YACjC,OAAO,CAAC,IAAI,CAAC,aAAa,YAAY,CAAC,MAAM,mBAAmB,YAAY,mBAAmB,CAAC,CAAA;QAClG,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACvB,CAAC;AACH,CAAC"}
|
package/src/index.d.ts
DELETED
package/src/index.js
DELETED
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/folder-structure-cruiser/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAA;AACzD,cAAc,uCAAuC,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { findCommonPathsPrefixLength } from "./findCommonPathsPrefix.js";
|
|
2
|
-
export function checkCrossFeatureImports(result) {
|
|
3
|
-
const output = typeof result.output === "object" ? result.output : undefined;
|
|
4
|
-
const modules = output?.modules ?? [];
|
|
5
|
-
const errorMessages = [];
|
|
6
|
-
for (const module of modules) {
|
|
7
|
-
if (module.coreModule) {
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
const dependencies = module.dependencies || [];
|
|
11
|
-
const modulePath = module.source.split("/");
|
|
12
|
-
dependencies.forEach(dependency => {
|
|
13
|
-
const dependencyPath = dependency.resolved.split("/");
|
|
14
|
-
const commonPrefixPathLength = findCommonPathsPrefixLength([modulePath, dependencyPath]);
|
|
15
|
-
if (!commonPrefixPathLength ||
|
|
16
|
-
(commonPrefixPathLength < modulePath.length && dependencyPath.length > commonPrefixPathLength + 2)) {
|
|
17
|
-
errorMessages.push({
|
|
18
|
-
source: module.source,
|
|
19
|
-
target: dependency.resolved,
|
|
20
|
-
rule: "cross-feature-nested-imports",
|
|
21
|
-
severity: "error",
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
messages: errorMessages,
|
|
28
|
-
totalCruised: output?.summary.totalCruised ?? 0,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=checkCrossFeatureImports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkCrossFeatureImports.js","sourceRoot":"","sources":["../../../../../packages/folder-structure-cruiser/src/lib/checkCrossFeatureImports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAKxE,MAAM,UAAU,wBAAwB,CAAC,MAAuB;IAC9D,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5E,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI,EAAE,CAAA;IAErC,MAAM,aAAa,GAAc,EAAE,CAAA;IAEnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,SAAQ;QACV,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,EAAE,CAAA;QAE9C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAE3C,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAChC,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACrD,MAAM,sBAAsB,GAAG,2BAA2B,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAA;YAExF,IACE,CAAC,sBAAsB;gBACvB,CAAC,sBAAsB,GAAG,UAAU,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,GAAG,sBAAsB,GAAG,CAAC,CAAC,EAClG,CAAC;gBACD,aAAa,CAAC,IAAI,CAAC;oBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,MAAM,EAAE,UAAU,CAAC,QAAQ;oBAC3B,IAAI,EAAE,8BAA8B;oBACpC,QAAQ,EAAE,OAAO;iBAClB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,aAAa;QACvB,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,IAAI,CAAC;KAChD,CAAA;AACH,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { findCommonPathsPrefix, findCommonPathsPrefixLength } from "./findCommonPathsPrefix.js";
|
|
2
|
-
function isIndexFileProperlyPositioned(pathParts, commonDependentPrefix, commonPrefixLength) {
|
|
3
|
-
const fileName = pathParts.at(-1) ?? "";
|
|
4
|
-
if (!/index\.(tsx?|jsx?|ts|js)$/.test(fileName)) {
|
|
5
|
-
return false;
|
|
6
|
-
}
|
|
7
|
-
const parentFolder = pathParts.at(-3) ?? "";
|
|
8
|
-
const expectedParentFolder = commonDependentPrefix.at(-1);
|
|
9
|
-
return parentFolder === expectedParentFolder && commonPrefixLength === pathParts.length - 2;
|
|
10
|
-
}
|
|
11
|
-
export function checkSharedComponents(result) {
|
|
12
|
-
const output = typeof result.output === "object" ? result.output : undefined;
|
|
13
|
-
const modules = output?.modules ?? [];
|
|
14
|
-
const infoMessages = [];
|
|
15
|
-
for (const module of modules) {
|
|
16
|
-
if (module.coreModule) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
const dependents = module.dependents || [];
|
|
20
|
-
if (dependents.length <= 1) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const pathParts = module.source.split("/");
|
|
24
|
-
const pathPartsLength = pathParts.length;
|
|
25
|
-
if (pathPartsLength <= 2) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
const dependentPathParts = dependents.map(dep => dep.split("/"));
|
|
29
|
-
const commonDependentPrefix = findCommonPathsPrefix(dependentPathParts);
|
|
30
|
-
const commonPrefixLength = findCommonPathsPrefixLength([pathParts, commonDependentPrefix]);
|
|
31
|
-
if (isIndexFileProperlyPositioned(pathParts, commonDependentPrefix, commonPrefixLength)) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (commonPrefixLength < pathPartsLength - 1) {
|
|
35
|
-
infoMessages.push({
|
|
36
|
-
source: module.source,
|
|
37
|
-
target: commonDependentPrefix.join("/"),
|
|
38
|
-
rule: "not-shared-level",
|
|
39
|
-
severity: "info",
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
messages: infoMessages,
|
|
45
|
-
totalCruised: output?.summary.totalCruised ?? 0,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=checkSharedComponents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkSharedComponents.js","sourceRoot":"","sources":["../../../../../packages/folder-structure-cruiser/src/lib/checkSharedComponents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAK/F,SAAS,6BAA6B,CACpC,SAAmB,EACnB,qBAA+B,EAC/B,kBAA0B;IAE1B,MAAM,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAEvC,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAC3C,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAEzD,OAAO,YAAY,KAAK,oBAAoB,IAAI,kBAAkB,KAAK,SAAS,CAAC,MAAM,GAAG,CAAC,CAAA;AAC7F,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAuB;IAC3D,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5E,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI,EAAE,CAAA;IACrC,MAAM,YAAY,GAAc,EAAE,CAAA;IAElC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,SAAQ;QACV,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAA;QAE1C,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC3B,SAAQ;QACV,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC1C,MAAM,eAAe,GAAG,SAAS,CAAC,MAAM,CAAA;QAExC,IAAI,eAAe,IAAI,CAAC,EAAE,CAAC;YACzB,SAAQ;QACV,CAAC;QAED,MAAM,kBAAkB,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;QAChE,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAA;QAEvE,MAAM,kBAAkB,GAAG,2BAA2B,CAAC,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAA;QAE1F,IAAI,6BAA6B,CAAC,SAAS,EAAE,qBAAqB,EAAE,kBAAkB,CAAC,EAAE,CAAC;YACxF,SAAQ;QACV,CAAC;QAED,IAAI,kBAAkB,GAAG,eAAe,GAAG,CAAC,EAAE,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC;gBAChB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,MAAM,EAAE,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC;gBACvC,IAAI,EAAE,kBAAkB;gBACxB,QAAQ,EAAE,MAAM;aACjB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,YAAY;QACtB,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,IAAI,CAAC;KAChD,CAAA;AACH,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function findCommonPathsPrefix(paths) {
|
|
2
|
-
if (paths.length === 0)
|
|
3
|
-
return [];
|
|
4
|
-
if (paths.length === 1)
|
|
5
|
-
return paths[0];
|
|
6
|
-
const commonPrefix = [];
|
|
7
|
-
const minLength = Math.min(...paths.map(path => path.length));
|
|
8
|
-
for (let i = 0; i < minLength; i++) {
|
|
9
|
-
const segment = paths[0][i];
|
|
10
|
-
if (paths.every(path => path[i] === segment)) {
|
|
11
|
-
commonPrefix.push(segment);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
break;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return commonPrefix;
|
|
18
|
-
}
|
|
19
|
-
export function findCommonPathsPrefixLength(paths) {
|
|
20
|
-
return findCommonPathsPrefix(paths).length;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=findCommonPathsPrefix.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findCommonPathsPrefix.js","sourceRoot":"","sources":["../../../../../packages/folder-structure-cruiser/src/lib/findCommonPathsPrefix.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBAAqB,CAAC,KAAiB;IACrD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACjC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAA;IAEvC,MAAM,YAAY,GAAa,EAAE,CAAA;IACjC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAE7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3B,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,MAAK;QACP,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,KAAiB;IAC3D,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAA;AAC5C,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import pc from "picocolors";
|
|
2
|
-
const { blue, bold, red } = pc;
|
|
3
|
-
const colorSeverity = (type) => (type === "info" ? blue(type) : red(type));
|
|
4
|
-
export function formatMessages(messages) {
|
|
5
|
-
return messages.map(message => ` ${colorSeverity(message.severity)} ${message.rule}: ${bold(message.source)} → ${bold(message.target)}`);
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=formatMessages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatMessages.js","sourceRoot":"","sources":["../../../../../packages/folder-structure-cruiser/src/lib/formatMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;AAI9B,MAAM,aAAa,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;AASpF,MAAM,UAAU,cAAc,CAAC,QAAmB;IAChD,OAAO,QAAQ,CAAC,GAAG,CACjB,OAAO,CAAC,EAAE,CACR,KAAK,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAC5G,CAAA;AACH,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { cruise } from "dependency-cruiser";
|
|
2
|
-
import extractDepcruiseOptions from "dependency-cruiser/config-utl/extract-depcruise-options";
|
|
3
|
-
import extractTSConfig from "dependency-cruiser/config-utl/extract-ts-config";
|
|
4
|
-
import extractWebpackResolveConfig from "dependency-cruiser/config-utl/extract-webpack-resolve-config";
|
|
5
|
-
export async function getCruiseResult({ directories = [".*"], configPath, tsConfigPath, webpackConfigPath, }) {
|
|
6
|
-
const depcruiseOptions = await extractDepcruiseOptions(configPath);
|
|
7
|
-
const webpackConfig = webpackConfigPath ? await extractWebpackResolveConfig(webpackConfigPath) : undefined;
|
|
8
|
-
const tsConfig = tsConfigPath ? extractTSConfig(tsConfigPath) : undefined;
|
|
9
|
-
const cruiseResult = await cruise(directories, { ...depcruiseOptions }, webpackConfig, {
|
|
10
|
-
tsConfig,
|
|
11
|
-
});
|
|
12
|
-
return cruiseResult;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=getCruiseResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCruiseResult.js","sourceRoot":"","sources":["../../../../../packages/folder-structure-cruiser/src/lib/getCruiseResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmC,MAAM,oBAAoB,CAAA;AAC5E,OAAO,uBAAuB,MAAM,yDAAyD,CAAA;AAC7F,OAAO,eAAe,MAAM,iDAAiD,CAAA;AAC7E,OAAO,2BAA2B,MAAM,8DAA8D,CAAA;AAStG,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,WAAW,GAAG,CAAC,IAAI,CAAC,EACpB,UAAU,EACV,YAAY,EACZ,iBAAiB,GACJ;IACb,MAAM,gBAAgB,GAAmB,MAAM,uBAAuB,CAAC,UAAU,CAAC,CAAA;IAClF,MAAM,aAAa,GAAG,iBAAiB,CAAC,CAAC,CAAC,MAAM,2BAA2B,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1G,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAEzE,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,EAAE,GAAG,gBAAgB,EAAE,EAAE,aAAgC,EAAE;QACxG,QAAQ;KACT,CAAC,CAAA;IAEF,OAAO,YAAY,CAAA;AACrB,CAAC"}
|