@wtdlee/repomap 0.3.1 → 0.3.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/dist/analyzers/index.js +1 -1
- package/dist/{chunk-M6YNU536.js → chunk-53ANJE42.js} +27 -714
- package/dist/chunk-6F4PWJZI.js +0 -1
- package/dist/{chunk-E4WRODSI.js → chunk-H4YGP3GL.js} +35 -108
- package/dist/chunk-J2CM7T7U.js +1 -0
- package/dist/{chunk-3YFXZAP7.js → chunk-MOEA75XK.js} +170 -359
- package/dist/chunk-PTR5IROV.js +36 -0
- package/dist/chunk-VV3A3UE3.js +1 -0
- package/dist/chunk-XWZH2RDG.js +19 -0
- package/dist/cli.js +29 -395
- package/dist/env-detector-BIWJ7OYF.js +1 -0
- package/dist/generators/assets/common.css +564 -23
- package/dist/generators/index.js +1 -2
- package/dist/index.js +1 -8
- package/dist/page-map-generator-XNZ4TDJT.js +1 -0
- package/dist/rails-FFISZ4AE.js +1 -0
- package/dist/rails-map-generator-UFLCMFAT.js +1 -0
- package/dist/server/index.js +1 -7
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3PWXDB7B.js +0 -153
- package/dist/chunk-GNBMJMET.js +0 -2519
- package/dist/chunk-OWM6WNLE.js +0 -2610
- package/dist/chunk-SSU6QFTX.js +0 -1058
- package/dist/env-detector-EEMVUEIA.js +0 -1
- package/dist/page-map-generator-6MJGPBVA.js +0 -1
- package/dist/rails-UWSDRS33.js +0 -1
- package/dist/rails-map-generator-D2URLMVJ.js +0 -2
package/dist/chunk-3PWXDB7B.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs/promises';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
|
|
4
|
-
// src/utils/env-detector.ts
|
|
5
|
-
async function detectEnvironments(rootPath) {
|
|
6
|
-
const environments = [];
|
|
7
|
-
const railsEnv = await detectRails(rootPath);
|
|
8
|
-
if (railsEnv.detected) {
|
|
9
|
-
environments.push(railsEnv);
|
|
10
|
-
}
|
|
11
|
-
const jsEnv = await detectJsEnvironment(rootPath);
|
|
12
|
-
if (jsEnv.detected) {
|
|
13
|
-
environments.push(jsEnv);
|
|
14
|
-
}
|
|
15
|
-
const hasNextjs = environments.some((e) => e.type === "nextjs");
|
|
16
|
-
const hasReact = environments.some((e) => e.type === "react" || e.type === "nextjs");
|
|
17
|
-
const hasRails = environments.some((e) => e.type === "rails");
|
|
18
|
-
let primary = "generic";
|
|
19
|
-
if (hasNextjs) {
|
|
20
|
-
primary = "nextjs";
|
|
21
|
-
} else if (hasReact) {
|
|
22
|
-
primary = "react";
|
|
23
|
-
} else if (hasRails) {
|
|
24
|
-
primary = "rails";
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
environments,
|
|
28
|
-
hasNextjs,
|
|
29
|
-
hasReact,
|
|
30
|
-
hasRails,
|
|
31
|
-
primary
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
async function detectRails(rootPath) {
|
|
35
|
-
const result = {
|
|
36
|
-
type: "rails",
|
|
37
|
-
detected: false,
|
|
38
|
-
path: rootPath,
|
|
39
|
-
features: []
|
|
40
|
-
};
|
|
41
|
-
try {
|
|
42
|
-
const gemfilePath = path.join(rootPath, "Gemfile");
|
|
43
|
-
const routesPath = path.join(rootPath, "config", "routes.rb");
|
|
44
|
-
await fs.access(gemfilePath);
|
|
45
|
-
await fs.access(routesPath);
|
|
46
|
-
const gemfile = await fs.readFile(gemfilePath, "utf-8");
|
|
47
|
-
const isRails = gemfile.includes("gem 'rails'") || gemfile.includes('gem "rails"');
|
|
48
|
-
if (!isRails) {
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
result.detected = true;
|
|
52
|
-
const versionMatch = gemfile.match(/gem ['"]rails['"],\s*['"]([^'"]+)['"]/);
|
|
53
|
-
if (versionMatch) {
|
|
54
|
-
result.version = versionMatch[1];
|
|
55
|
-
}
|
|
56
|
-
const features = [];
|
|
57
|
-
try {
|
|
58
|
-
await fs.access(path.join(rootPath, "app", "grpc_services"));
|
|
59
|
-
features.push("grpc");
|
|
60
|
-
} catch {
|
|
61
|
-
}
|
|
62
|
-
try {
|
|
63
|
-
const appConfig = await fs.readFile(path.join(rootPath, "config", "application.rb"), "utf-8");
|
|
64
|
-
if (appConfig.includes("config.api_only = true")) {
|
|
65
|
-
features.push("api-only");
|
|
66
|
-
}
|
|
67
|
-
} catch {
|
|
68
|
-
}
|
|
69
|
-
if (gemfile.includes("gem 'graphql'") || gemfile.includes('gem "graphql"')) {
|
|
70
|
-
features.push("graphql");
|
|
71
|
-
}
|
|
72
|
-
if (gemfile.includes("gem 'devise'") || gemfile.includes('gem "devise"')) {
|
|
73
|
-
features.push("devise");
|
|
74
|
-
}
|
|
75
|
-
result.features = features;
|
|
76
|
-
} catch {
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
async function detectJsEnvironment(rootPath) {
|
|
81
|
-
const result = {
|
|
82
|
-
type: "react",
|
|
83
|
-
detected: false,
|
|
84
|
-
path: rootPath,
|
|
85
|
-
features: []
|
|
86
|
-
};
|
|
87
|
-
try {
|
|
88
|
-
const packageJsonPath = path.join(rootPath, "package.json");
|
|
89
|
-
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
|
|
90
|
-
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
91
|
-
if (!deps["react"]) {
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
result.detected = true;
|
|
95
|
-
result.version = deps["react"];
|
|
96
|
-
const features = [];
|
|
97
|
-
if (deps["next"]) {
|
|
98
|
-
result.type = "nextjs";
|
|
99
|
-
result.version = deps["next"];
|
|
100
|
-
try {
|
|
101
|
-
await fs.access(path.join(rootPath, "app"));
|
|
102
|
-
features.push("app-router");
|
|
103
|
-
} catch {
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
await fs.access(path.join(rootPath, "pages"));
|
|
107
|
-
features.push("pages-router");
|
|
108
|
-
} catch {
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
await fs.access(path.join(rootPath, "src", "pages"));
|
|
112
|
-
features.push("pages-router");
|
|
113
|
-
} catch {
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
await fs.access(path.join(rootPath, "src", "app"));
|
|
117
|
-
features.push("app-router");
|
|
118
|
-
} catch {
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (deps["@apollo/client"] || deps["graphql"] || deps["graphql-request"] || deps["urql"]) {
|
|
122
|
-
features.push("graphql");
|
|
123
|
-
}
|
|
124
|
-
if (deps["typescript"]) {
|
|
125
|
-
features.push("typescript");
|
|
126
|
-
}
|
|
127
|
-
if (deps["redux"] || deps["@reduxjs/toolkit"]) {
|
|
128
|
-
features.push("redux");
|
|
129
|
-
}
|
|
130
|
-
if (deps["zustand"]) {
|
|
131
|
-
features.push("zustand");
|
|
132
|
-
}
|
|
133
|
-
if (deps["jotai"] || deps["recoil"]) {
|
|
134
|
-
features.push("atomic-state");
|
|
135
|
-
}
|
|
136
|
-
result.features = features;
|
|
137
|
-
} catch {
|
|
138
|
-
}
|
|
139
|
-
return result;
|
|
140
|
-
}
|
|
141
|
-
function getAnalyzersForEnvironments(envResult) {
|
|
142
|
-
const frontend = [];
|
|
143
|
-
const backend = [];
|
|
144
|
-
if (envResult.hasNextjs || envResult.hasReact) {
|
|
145
|
-
frontend.push("pages", "graphql", "dataflow", "rest-api");
|
|
146
|
-
}
|
|
147
|
-
if (envResult.hasRails) {
|
|
148
|
-
backend.push("routes", "controllers", "models", "grpc");
|
|
149
|
-
}
|
|
150
|
-
return { frontend, backend };
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export { detectEnvironments, getAnalyzersForEnvironments };
|