truecourse 0.2.2 → 0.2.4
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/cli.mjs +1236 -933
- package/package.json +2 -2
- package/server.mjs +30 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "truecourse",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Visualize your codebase architecture as an interactive graph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"node": ">=20"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@clack/prompts": "^
|
|
13
|
+
"@clack/prompts": "^1.2.0",
|
|
14
14
|
"commander": "^12.1.0",
|
|
15
15
|
"dotenv": "^16.4.0",
|
|
16
16
|
"embedded-postgres": "18.3.0-beta.16",
|
package/server.mjs
CHANGED
|
@@ -407088,7 +407088,7 @@ function computeLayerContentSize(level, layerModules, methodsByModule) {
|
|
|
407088
407088
|
const height = rows * MODULE_NODE_HEIGHT + (rows - 1) * MODULE_GAP;
|
|
407089
407089
|
return { width: width2, height };
|
|
407090
407090
|
}
|
|
407091
|
-
|
|
407091
|
+
const moduleWidths = [];
|
|
407092
407092
|
const moduleHeights = [];
|
|
407093
407093
|
for (const mod2 of layerModules) {
|
|
407094
407094
|
const mths = methodsByModule.get(mod2.id) || [];
|
|
@@ -407101,11 +407101,19 @@ function computeLayerContentSize(level, layerModules, methodsByModule) {
|
|
|
407101
407101
|
MIN_MODULE_WIDTH
|
|
407102
407102
|
);
|
|
407103
407103
|
const modHeight = MODULE_NODE_HEIGHT + mthRows * METHOD_NODE_HEIGHT + (mthRows - 1) * METHOD_GAP + 8;
|
|
407104
|
-
|
|
407104
|
+
moduleWidths.push(modWidth);
|
|
407105
407105
|
moduleHeights.push(modHeight);
|
|
407106
407106
|
}
|
|
407107
407107
|
const cols = Math.max(Math.ceil(layerModules.length / MAX_PER_COL), 1);
|
|
407108
|
-
const
|
|
407108
|
+
const colMaxWidths = new Array(cols).fill(MIN_MODULE_WIDTH);
|
|
407109
|
+
for (let i = 0; i < moduleWidths.length; i++) {
|
|
407110
|
+
const c = Math.floor(i / MAX_PER_COL);
|
|
407111
|
+
if (moduleWidths[i] > colMaxWidths[c]) colMaxWidths[c] = moduleWidths[i];
|
|
407112
|
+
}
|
|
407113
|
+
let width = 0;
|
|
407114
|
+
for (let c = 0; c < cols; c++) {
|
|
407115
|
+
width += colMaxWidths[c] + (c > 0 ? MOD_COL_GAP : 0);
|
|
407116
|
+
}
|
|
407109
407117
|
let maxColHeight = 0;
|
|
407110
407118
|
for (let col = 0; col < cols; col++) {
|
|
407111
407119
|
let colH = 0;
|
|
@@ -407120,6 +407128,24 @@ function computeLayerContentSize(level, layerModules, methodsByModule) {
|
|
|
407120
407128
|
}
|
|
407121
407129
|
function placeModulesInGrid(nodes, level, layerModules, methodsByModule, layerNodeId, layer, svc, layerWidth) {
|
|
407122
407130
|
const cols = Math.max(Math.ceil(layerModules.length / MAX_PER_COL), 1);
|
|
407131
|
+
const colMaxWidths = new Array(cols).fill(MIN_MODULE_WIDTH);
|
|
407132
|
+
if (level === "method") {
|
|
407133
|
+
for (let i = 0; i < layerModules.length; i++) {
|
|
407134
|
+
const c = Math.floor(i / MAX_PER_COL);
|
|
407135
|
+
const mths = methodsByModule.get(layerModules[i].id) || [];
|
|
407136
|
+
const mthCount = mths.length || 1;
|
|
407137
|
+
const mthCols = Math.max(Math.ceil(mthCount / MAX_PER_COL), 1);
|
|
407138
|
+
const w = Math.max(
|
|
407139
|
+
MOD_PAD_X * 2 + mthCols * METHOD_NODE_WIDTH + (mthCols - 1) * METHOD_COL_GAP,
|
|
407140
|
+
MIN_MODULE_WIDTH
|
|
407141
|
+
);
|
|
407142
|
+
if (w > colMaxWidths[c]) colMaxWidths[c] = w;
|
|
407143
|
+
}
|
|
407144
|
+
}
|
|
407145
|
+
const colX = [LAYER_PAD_X];
|
|
407146
|
+
for (let c = 1; c < cols; c++) {
|
|
407147
|
+
colX[c] = colX[c - 1] + colMaxWidths[c - 1] + MOD_COL_GAP;
|
|
407148
|
+
}
|
|
407123
407149
|
for (let i = 0; i < layerModules.length; i++) {
|
|
407124
407150
|
const mod2 = layerModules[i];
|
|
407125
407151
|
const col = Math.floor(i / MAX_PER_COL);
|
|
@@ -407169,7 +407195,7 @@ function placeModulesInGrid(nodes, level, layerModules, methodsByModule, layerNo
|
|
|
407169
407195
|
const prevRows = Math.min(prevCount, MAX_PER_COL);
|
|
407170
407196
|
yOffset += MODULE_NODE_HEIGHT + prevRows * METHOD_NODE_HEIGHT + (prevRows - 1) * METHOD_GAP + 8 + MODULE_GAP;
|
|
407171
407197
|
}
|
|
407172
|
-
const x =
|
|
407198
|
+
const x = colX[col];
|
|
407173
407199
|
nodes.push({
|
|
407174
407200
|
id: mod2.id,
|
|
407175
407201
|
type: "moduleNode",
|