@produtype/core 0.92.0 → 0.93.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.
- package/dist/analyzer/analyzeProject.js +26 -14
- package/package.json +1 -1
|
@@ -161,18 +161,29 @@ function parsePyprojectSections(text, runtimeOnly) {
|
|
|
161
161
|
* Everything after `src/main/java` is a package name, not a project layout.
|
|
162
162
|
*
|
|
163
163
|
* spring-petclinic lives in `org.springframework.samples.petclinic`, so every one of
|
|
164
|
-
* its thirty Java files
|
|
165
|
-
* removes sample code removed the whole application
|
|
166
|
-
*
|
|
167
|
-
* `client-app` at high confidence for a Spring Boot server.
|
|
164
|
+
* its thirty Java files sat under a path segment called `samples`, and the rule that
|
|
165
|
+
* removes sample code removed the whole application: twelve files, an HTML front end,
|
|
166
|
+
* no backend, and `client-app` at high confidence for a Spring Boot server.
|
|
168
167
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
168
|
+
* It was not only `samples`. `spring-test/src/main/java/org/springframework/mock/`
|
|
169
|
+
* holds forty-four files — `MockHttpServletRequest` and its neighbours, shipped in the
|
|
170
|
+
* jar and the whole point of that module — and the rule that removes `mocks/` removed
|
|
171
|
+
* every one of them. A package can be called anything: `vendor`, `testing`, `fixtures`
|
|
172
|
+
* are all ordinary domain words.
|
|
173
|
+
*
|
|
174
|
+
* Maven and Gradle fix the `src/main/<language>` prefix, so directory rules are
|
|
175
|
+
* applied to the path *up to* it and never to the package below.
|
|
176
|
+
*
|
|
177
|
+
* Only `main` is named, and that is a statement of intent rather than a rule doing
|
|
178
|
+
* work: `src/test/java/...` stays excluded either way, because the boundary itself
|
|
179
|
+
* contains `test` and the directory rule matches it. Writing `main|test` here fails
|
|
180
|
+
* no test, which is worth saying instead of implying a protection that is not there.
|
|
173
181
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
182
|
+
const JVM_MAIN_SOURCE_ROOT = /(^|\/)src\/main\/(java|kotlin|scala|groovy)\//;
|
|
183
|
+
/** The part of the path that describes layout rather than package. */
|
|
184
|
+
function layoutPartOf(file) {
|
|
185
|
+
const root = JVM_MAIN_SOURCE_ROOT.exec(file);
|
|
186
|
+
return root ? file.slice(0, root.index + root[0].length) : file;
|
|
176
187
|
}
|
|
177
188
|
function isTestOrExamplePath(file) {
|
|
178
189
|
// `__mocks__` was missing, and a mock is the most misleading file in a repository:
|
|
@@ -181,7 +192,8 @@ function isTestOrExamplePath(file) {
|
|
|
181
192
|
// `fixtures` was listed and `fixture` was not, so `extra/fixture/authsources.php`
|
|
182
193
|
// made PHP one of the languages of an Elixir analytics product — and of cal.com,
|
|
183
194
|
// which is TypeScript.
|
|
184
|
-
|
|
195
|
+
const layout = layoutPartOf(file);
|
|
196
|
+
return /(^|\/)(__tests__|__mocks__|mocks?|tests?|test-data|fixtures?|frontend-example)(\/|$)/i.test(layout)
|
|
185
197
|
/**
|
|
186
198
|
* The conventions other ecosystems use, which this list did not know.
|
|
187
199
|
*
|
|
@@ -192,7 +204,7 @@ function isTestOrExamplePath(file) {
|
|
|
192
204
|
* would have parsed the same files and reached the same wrong conclusion, which is
|
|
193
205
|
* the argument for fixing what gets read before fixing how.
|
|
194
206
|
*/
|
|
195
|
-
|| /(^|\/)(spec|specs|e2e|integration-tests?|cypress|playwright|testing)(\/|$)/i.test(
|
|
207
|
+
|| /(^|\/)(spec|specs|e2e|integration-tests?|cypress|playwright|testing)(\/|$)/i.test(layout)
|
|
196
208
|
|| /\.(e2e|e2e-spec|cy|stories)\.(ts|tsx|js|jsx|mjs|cjs)$/i.test(file)
|
|
197
209
|
|| /_spec\.rb$/i.test(file)
|
|
198
210
|
|| /_test\.(go|py|rb|java|cs|php)$/i.test(file)
|
|
@@ -236,7 +248,7 @@ function isTestOrExamplePath(file) {
|
|
|
236
248
|
* spell it. A repository whose every source file is a sample now has no source
|
|
237
249
|
* files, and says so — which is the honest answer for one.
|
|
238
250
|
*/
|
|
239
|
-
||
|
|
251
|
+
|| /(^|\/)(samples?|snippets?|codesnippets)(\/|$)/i.test(layout)
|
|
240
252
|
/**
|
|
241
253
|
* Somebody else's code, vendored in.
|
|
242
254
|
*
|
|
@@ -245,7 +257,7 @@ function isTestOrExamplePath(file) {
|
|
|
245
257
|
* crate copied in whole. A manifest under a vendor directory is a statement about
|
|
246
258
|
* that library, not about this product.
|
|
247
259
|
*/
|
|
248
|
-
|| /(^|\/)(vendor|vendored|third[-_]?party|external[-_]crates)(\/|$)/i.test(
|
|
260
|
+
|| /(^|\/)(vendor|vendored|third[-_]?party|external[-_]crates)(\/|$)/i.test(layout);
|
|
249
261
|
}
|
|
250
262
|
/**
|
|
251
263
|
* Extensions the detectors can read.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@produtype/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"description": "Deterministic CLI and library that analyzes a web application repository and reports how far it is from production-ready for the kind of product it is meant to be.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|