git-truck 0.8.4-1 → 0.8.6-experimental
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/README.md +17 -13
- package/cli.js +2 -0
- package/dev.js +4 -2
- package/package.json +4 -4
- package/server.ts +13 -8
- package/src/analyzer/analyze.server.ts +288 -322
- package/src/analyzer/analyze.test.ts +30 -30
- package/src/analyzer/args.server.ts +20 -6
- package/src/analyzer/constants.ts +1 -1
- package/src/analyzer/git-caller.server.ts +290 -0
- package/src/analyzer/hydrate.server.ts +186 -186
- package/src/analyzer/model.ts +13 -2
- package/src/analyzer/{util.ts → util.server.ts} +27 -33
- package/src/analyzer/util.test.ts +1 -1
- package/src/components/AnalyzingIndicator.tsx +55 -0
- package/src/components/Animations.ts +14 -0
- package/src/components/Chart.tsx +29 -8
- package/src/components/Details.tsx +8 -7
- package/src/components/GlobalInfo.tsx +19 -8
- package/src/components/HiddenFiles.tsx +3 -3
- package/src/components/Legend.tsx +1 -1
- package/src/components/LegendOther.tsx +42 -42
- package/src/components/Main.tsx +1 -1
- package/src/components/SearchBar.tsx +1 -6
- package/src/components/util.tsx +19 -10
- package/src/const.ts +6 -6
- package/src/contexts/ClickedContext.ts +17 -17
- package/src/contexts/DataContext.ts +12 -12
- package/src/contexts/MetricContext.ts +12 -12
- package/src/contexts/OptionsContext.ts +51 -51
- package/src/contexts/SearchContext.ts +19 -19
- package/src/lang-map.d.ts +3 -3
- package/src/metrics.ts +3 -2
- package/src/root.tsx +44 -1
- package/src/routes/{repo.tsx → $repo.tsx} +59 -15
- package/src/routes/index.tsx +156 -46
- package/build/index.js +0 -6838
- package/post-build.js +0 -14
- package/public/favicon.ico +0 -0
- package/src/analyzer/git-caller.ts +0 -117
- package/src/analyzer/index.ts +0 -4
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ To check if these programs are installed, and what version you have, run `node -
|
|
|
18
18
|
|
|
19
19
|
## [Get started](#get-started)
|
|
20
20
|
|
|
21
|
-
1.
|
|
22
|
-
2.
|
|
23
|
-
3.
|
|
21
|
+
1. Within a git repository, or a directory containing git repositories, run the command `npx git-truck@latest`.
|
|
22
|
+
2. Press `y` if it asks you to download the package.
|
|
23
|
+
3. The application will now open in your default browser.
|
|
24
24
|
|
|
25
25
|
## [I got an error or I want to give feedback, what do i do?](#i-got-an-error-or-i-want-to-give-feedback-what-do-i-do)
|
|
26
26
|
|
|
@@ -38,19 +38,23 @@ npx git-truck [args]
|
|
|
38
38
|
|
|
39
39
|
### [Arguments](#arguments)
|
|
40
40
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
41
|
+
| arg | description | default value |
|
|
42
|
+
| :------------------: | :-------------------------------------------------------------------: | :----------------: |
|
|
43
|
+
| `--branch` | branch name | checked out branch |
|
|
44
|
+
| `--path` | path to a folder or a git repository | current directory |
|
|
45
|
+
| `--log` | output log level. See [here](./src/analyzer/log.server.ts) for values | - |
|
|
46
|
+
| `--port` | port to use for the program | 3000 |
|
|
47
|
+
| `--invalidate-cache` | bypass analyzer cache manually | - |
|
|
48
|
+
|
|
49
|
+
**Note:** Using `--invalidate-cache` will cause the analyzer to run every time the client talks to the server.
|
|
47
50
|
|
|
48
51
|
### [Configuration](#configuration)
|
|
49
52
|
|
|
50
53
|
You can add a `truckconfig.json` file to the root of your project, where you can define the arguments you want.
|
|
51
|
-
Additionally you can define which git-aliases should be considered as the same person.
|
|
54
|
+
Additionally you can define which git-aliases should be considered as the same person using `unionedAuthors`. If provided, the first name in the array is used as the name of the person.
|
|
52
55
|
You can also define files to ignore.
|
|
53
|
-
|
|
56
|
+
|
|
57
|
+
**Example:**
|
|
54
58
|
|
|
55
59
|
```json
|
|
56
60
|
{
|
|
@@ -60,7 +64,7 @@ Example:
|
|
|
60
64
|
["Bob", "Bobby Bob"],
|
|
61
65
|
["Alice", "aliiii", "alice alice"]
|
|
62
66
|
],
|
|
63
|
-
"hiddenFiles": ["package-lock.json", "*.bin", "*.svg"]
|
|
67
|
+
"hiddenFiles": ["package-lock.json", "*.bin", "*.svg"],
|
|
68
|
+
"invalidateCache": true
|
|
64
69
|
}
|
|
65
|
-
|
|
66
70
|
```
|
package/cli.js
ADDED
package/dev.js
CHANGED
|
@@ -6,12 +6,14 @@ const open = require("open")
|
|
|
6
6
|
const getPortLib = (await import("get-port"))
|
|
7
7
|
const getPort = getPortLib.default
|
|
8
8
|
const port = await getPort({
|
|
9
|
-
port: getPortLib.portNumbers(3000, 4000),
|
|
9
|
+
port: [80, ...getPortLib.portNumbers(3000, 4000)],
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
+
process.env["PORT"] = port.toString()
|
|
13
|
+
|
|
12
14
|
open("http://localhost:" + port)
|
|
13
15
|
await runAll(
|
|
14
|
-
[`dev:node --
|
|
16
|
+
[`dev:node -- ${process.argv.slice(2).join(" ")}`, "dev:remix"],
|
|
15
17
|
{
|
|
16
18
|
parallel: true,
|
|
17
19
|
stdout: process.stdout,
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-truck",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6-experimental",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Visualizing a Git repository",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"main": "./
|
|
8
|
-
"bin": "./
|
|
7
|
+
"main": "./cli.js",
|
|
8
|
+
"bin": "./cli.js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "jest --coverage",
|
|
11
11
|
"clean": "rimraf -rf build public/build .cache .temp",
|
|
12
12
|
"tsc": "tsc",
|
|
13
|
-
"build": "remix setup node && cross-env NODE_ENV=production remix build
|
|
13
|
+
"build": "remix setup node && cross-env NODE_ENV=production remix build",
|
|
14
14
|
"dev": "cross-env NODE_ENV=development remix build && node dev.js",
|
|
15
15
|
"dev:remix": "cross-env NODE_ENV=development remix watch",
|
|
16
16
|
"postinstall": "npm run build",
|
package/server.ts
CHANGED
|
@@ -57,10 +57,7 @@ for usage instructions.`)
|
|
|
57
57
|
|
|
58
58
|
const staticAssetsPath = join(__dirname, "../public/build")
|
|
59
59
|
// Remix fingerprints its assets so we can cache forever.
|
|
60
|
-
app.use(
|
|
61
|
-
"/build",
|
|
62
|
-
express.static(staticAssetsPath, { immutable: true, maxAge: "1y" })
|
|
63
|
-
)
|
|
60
|
+
app.use("/build", express.static(staticAssetsPath, { immutable: true, maxAge: "1y" }))
|
|
64
61
|
|
|
65
62
|
// Everything else (like favicon.ico) is cached for an hour. You may want to be
|
|
66
63
|
// more aggressive with this caching.
|
|
@@ -76,16 +73,24 @@ for usage instructions.`)
|
|
|
76
73
|
})
|
|
77
74
|
)
|
|
78
75
|
|
|
76
|
+
let devServerPort: number | null = null
|
|
77
|
+
let userHasProvidedPort = false
|
|
79
78
|
let minPort = 3000
|
|
80
79
|
|
|
81
|
-
if (args.port && !isNaN(parseInt(args.port)))
|
|
80
|
+
if (args.port && !isNaN(parseInt(args.port))) {
|
|
81
|
+
minPort = parseInt(args.port)
|
|
82
|
+
userHasProvidedPort = true
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (process.env["PORT"] && !isNaN(parseInt(process.env["PORT"]))) {
|
|
86
|
+
devServerPort = parseInt(process.env["PORT"])
|
|
87
|
+
}
|
|
82
88
|
|
|
83
89
|
const getPortLib = await import("get-port")
|
|
84
90
|
const getPort = getPortLib.default
|
|
85
91
|
const port = await getPort({
|
|
86
|
-
port: getPortLib.portNumbers(minPort, minPort + 1000),
|
|
92
|
+
port: devServerPort ?? [...(!userHasProvidedPort ? [80] : []), ...getPortLib.portNumbers(minPort, minPort + 1000)],
|
|
87
93
|
})
|
|
88
|
-
|
|
89
94
|
app.listen(port).once("listening", () => printOpen(port))
|
|
90
95
|
})()
|
|
91
96
|
|
|
@@ -93,7 +98,7 @@ async function printOpen(port: number) {
|
|
|
93
98
|
console.log()
|
|
94
99
|
console.log(`Now listening on port ${port}`)
|
|
95
100
|
if (process.env.NODE_ENV !== "development") {
|
|
96
|
-
const url =
|
|
101
|
+
const url = `http://localhost:${port}`
|
|
97
102
|
console.log(`Opening ${url} in your browser`)
|
|
98
103
|
await open(url)
|
|
99
104
|
}
|