Skip to content

Commit e7d7506

Browse files
committed
add webpack, prettier, eslint
1 parent 6b1cda9 commit e7d7506

File tree

9 files changed

+2700
-30
lines changed

9 files changed

+2700
-30
lines changed

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
This is a workaround for https://github.com/eslint/eslint/issues/3458
3+
4+
TLDR; eslint requires you to know and declare all eslint plugins that are being used in the plugin you
5+
are consuming as peer dependencies. This patch fixes that so you don't have to add to your peer
6+
dependencies and is [recommended](https://github.com/microsoft/rushstack/tree/main/eslint/eslint-config#2-choose-one-profile) by the rush stack eslint-config package.
7+
*/
8+
require("@rushstack/eslint-config/patch/modern-module-resolution")
9+
10+
module.exports = {
11+
extends: ["@rushstack/eslint-config/profile/node"],
12+
rules: {
13+
"@typescript-eslint/no-explicit-any": 0,
14+
"@typescript-eslint/consistent-type-definitions": [1, "type"],
15+
"@typescript-eslint/naming-convention": [
16+
"error",
17+
{
18+
selector: "parameter",
19+
format: ["camelCase"],
20+
leadingUnderscore: "allow"
21+
}
22+
],
23+
"@typescript-eslint/typedef": 0,
24+
"@rushstack/no-new-null": 0,
25+
"@rushstack/typedef-var": 0,
26+
"@rushstack/hoist-jest-mock": 0
27+
},
28+
parserOptions: { tsconfigRootDir: __dirname }
29+
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Because this helper is designed to allow sharing credentials on the same machine
1010

1111
## Installation and Usage
1212

13-
This helper is written in Typescript and compiles down to two Javascript scripts, one for the server and one for the client. At this point, there is no installation tooling or bundling. The simplest way to install it is to clone this repo on both the host machine and inside the Docker container. Once that is done, do the following:
13+
This helper is written in Typescript and compiles down to two Javascript scripts, one for the server and one for the client. At this point, there is no installation tooling. The simplest way to install it is to clone this repo on both the host machine and inside the Docker container. Once that is done, do the following:
1414

1515
### On the host
1616

1717
Run `pnpm install & pnpm build` or your favorite package tool to install dependencies and compile the app.
1818

19-
At the root of the repository, run `node dist/server/index.js`. This will launch the server and it will listen for TCP connections on localhost at a random port which will be displayed in the console. You will need to keep this console/terminal open.
19+
At the root of the repository, run `node dist/gcf-server.js`. This will launch the server and it will listen for TCP connections on localhost at a random port which will be displayed in the console. You will need to keep this console/terminal open.
2020

2121
Notes:
2222

@@ -32,7 +32,7 @@ Edit your git configuration file to call the client you just complied as a git c
3232

3333
```
3434
[credential]
35-
helper = "!f() { node ~/git-credential-forwarder/dist/client/index.js $*; }; f"
35+
helper = "!f() { node ~/git-credential-forwarder/dist/gcf-client.js $*; }; f"
3636
```
3737

3838
Run git normally and all requests for credentials should be passed through to the host which will handle appropriately on the host side.
@@ -69,6 +69,6 @@ Nothing is perfectly secure, but I have tried to think through the security impl
6969
## To Do
7070

7171
- Test more extensively. Mostly it's only be tested on Azure Devops and GitHub using git credential manager as the host credential helper.
72-
- Bundle the scripts and make the install easier.
72+
- Make the install easier.
7373
- More tests.
7474
- Maybe some utilities to make setting up the docker part easier to do as part of a Dockerfile

package.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
{
22
"name": "git-credential-forwarder",
3-
"version": "0.0.2",
3+
"version": "1.0.0",
44
"description": "utilities for forwarding git credential helper commands to another git installation (e.g. container to host)",
55
"main": "dist/index.js",
66
"scripts": {
7-
"build": "rimraf ./dist && tsc -p tsconfig.prod.json",
7+
"build": "rimraf ./dist && webpack",
88
"start": "node bin/index.js",
9-
"test": "jest --watch"
9+
"test": "jest --watch",
10+
"lint": "eslint ./src/",
11+
"fix-formatting": "prettier --write --config ./prettier.config.js ./src/",
12+
"check-formatting": "prettier --check --config ./prettier.config.js ./src/"
1013
},
1114
"author": "Sam Davidoff",
1215
"license": "MIT",
1316
"devDependencies": {
17+
"@rushstack/eslint-config": "^3.6.9",
1418
"@types/jest": "^29.5.12",
1519
"@types/node": "^20.12.4",
20+
"@typescript-eslint/eslint-plugin": "^7.7.0",
21+
"@typescript-eslint/parser": "^7.7.0",
22+
"eslint": "^8.57.0",
1623
"jest": "^29.7.0",
24+
"prettier": "^3.2.5",
1725
"rimraf": "^5.0.5",
1826
"ts-jest": "^29.1.2",
19-
"typescript": "^5.0.0"
27+
"ts-loader": "^9.5.1",
28+
"typescript": "^5.0.0",
29+
"webpack": "^5.91.0",
30+
"webpack-cli": "^5.1.4"
2031
}
2132
}

0 commit comments

Comments
 (0)