Skip to content

Commit 5e608c9

Browse files
authored
Merge branch 'main' into 1185-git-request-classification
2 parents 1312a6e + 6f56f15 commit 5e608c9

File tree

32 files changed

+481
-478
lines changed

32 files changed

+481
-478
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ jobs:
5050
- name: Check Types (Server)
5151
run: npm run check-types:server
5252

53+
- name: Build TypeScript
54+
run: npm run build-ts
55+
5356
- name: Test
5457
id: test
5558
run: |

.github/workflows/sample-publish.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,32 @@ permissions:
99
contents: read
1010

1111
jobs:
12-
build:
12+
build-and-publish:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Harden Runner
1616
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
1717
with:
1818
egress-policy: audit
19-
2019
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2120
# Setup .npmrc file to publish to npm
2221
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
2322
with:
2423
node-version: '22.x'
2524
registry-url: 'https://registry.npmjs.org'
26-
- name: publish sample package
27-
run: npm install --include peer && npm publish --access=public
25+
26+
- name: Install dependencies
27+
working-directory: plugins/git-proxy-plugin-samples
28+
run: npm ci
29+
30+
- name: Build TypeScript
31+
working-directory: plugins/git-proxy-plugin-samples
32+
run: npm run build
33+
34+
- name: Install peers and publish
2835
working-directory: plugins/git-proxy-plugin-samples
36+
run: |
37+
npm install --include=peer
38+
npm publish --provenance --access=public
2939
env:
3040
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# This file required to override .gitignore when publishing to npm
2+
src/
3+
tests/
4+
*.test.ts
5+
6+
tsconfig.json
7+
jest.config.js
8+
.eslintrc.js
9+
.prettierrc
10+
211
website/
312
plugins/
4-
experimental/
5-
cypress/

package.json

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,45 @@
22
"name": "@finos/git-proxy",
33
"version": "2.0.0-rc.3",
44
"description": "Deploy custom push protections and policies on top of Git.",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"exports": {
8+
".": {
9+
"import": "./dist/index.js",
10+
"require": "./dist/index.js",
11+
"types": "./dist/index.d.ts"
12+
},
13+
"./config": {
14+
"import": "./dist/src/config/index.js",
15+
"require": "./dist/src/config/index.js",
16+
"types": "./dist/src/config/index.d.ts"
17+
},
18+
"./db": {
19+
"import": "./dist/src/db/index.js",
20+
"require": "./dist/src/db/index.js",
21+
"types": "./dist/src/db/index.d.ts"
22+
},
23+
"./proxy": {
24+
"import": "./dist/src/proxy/index.js",
25+
"require": "./dist/src/proxy/index.js",
26+
"types": "./dist/src/proxy/index.d.ts"
27+
},
28+
"./types": {
29+
"import": "./dist/src/types/models.js",
30+
"require": "./dist/src/types/models.js",
31+
"types": "./dist/src/types/models.d.ts"
32+
}
33+
},
534
"scripts": {
635
"cli": "tsx ./packages/git-proxy-cli/index.ts",
736
"cli:js": "node ./packages/git-proxy-cli/dist/index.js",
837
"client": "vite --config vite.config.ts",
938
"clientinstall": "npm install --prefix client",
1039
"server": "tsx index.ts",
1140
"start": "concurrently \"npm run server\" \"npm run client\"",
12-
"build": "npm run generate-config-types && npm run build-ui && npm run build-lib",
13-
"build-ts": "tsc",
41+
"build": "npm run generate-config-types && npm run build-ui && npm run build-ts",
42+
"build-ts": "tsc --project tsconfig.publish.json && ./scripts/fix-shebang.sh",
1443
"build-ui": "vite build",
15-
"build-lib": "./scripts/build-for-publish.sh",
16-
"restore-lib": "./scripts/undo-build.sh",
1744
"check-types": "tsc",
1845
"check-types:server": "tsc --project tsconfig.publish.json --noEmit",
1946
"test": "NODE_ENV=test ts-mocha './test/**/*.test.js' --exit",
@@ -30,7 +57,7 @@
3057
"generate-config-types": "quicktype --src-lang schema --lang typescript --out src/config/generated/config.ts --top-level GitProxyConfig config.schema.json && ts-node scripts/add-banner.ts src/config/generated/config.ts && prettier --write src/config/generated/config.ts"
3158
},
3259
"bin": {
33-
"git-proxy": "./index.js",
60+
"git-proxy": "./dist/index.js",
3461
"git-proxy-all": "concurrently 'npm run server' 'npm run client'"
3562
},
3663
"workspaces": [

packages/git-proxy-cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { hideBin } from 'yargs/helpers';
55
import fs from 'fs';
66
import util from 'util';
77

8-
import { CommitData, PushData } from '@finos/git-proxy/src/types/models';
9-
import { PushQuery } from '@finos/git-proxy/src/db/types';
8+
import { CommitData, PushData } from '@finos/git-proxy/types';
9+
import { PushQuery } from '@finos/git-proxy/db';
1010

1111
const GIT_PROXY_COOKIE_FILE = 'git-proxy-cookie';
1212
// GitProxy UI HOST and PORT (configurable via environment variable)

scripts/build-for-publish.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

scripts/fix-shebang.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO_ROOT="$(git rev-parse --show-toplevel)"
5+
cd "$REPO_ROOT"
6+
7+
# Replace tsx with node in the shebang
8+
sed -ie '1s/tsx/node/' dist/index.js

scripts/undo-build.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/env bash
22
set -euxo pipefail
33

4-
# Undo what was done by build-for-publish.sh in the event this was ran locally
4+
# Clean build artifacts
55

66
REPO_ROOT="$(git rev-parse --show-toplevel)"
77
cd "$REPO_ROOT"
88

9-
rm -rf dist index.js index.d.ts || true
10-
git checkout src index.ts
11-
git clean -f src
9+
rm -rf dist

src/db/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,6 @@ export const findUserByEmail = (email: string): Promise<User | null> => sink.fin
169169
export const findUserByOIDC = (oidcId: string): Promise<User | null> => sink.findUserByOIDC(oidcId);
170170
export const getUsers = (query?: Partial<UserQuery>): Promise<User[]> => sink.getUsers(query);
171171
export const deleteUser = (username: string): Promise<void> => sink.deleteUser(username);
172+
172173
export const updateUser = (user: Partial<User>): Promise<void> => sink.updateUser(user);
174+
export type { PushQuery, Repo, Sink, User } from './types';

src/routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import RouteGuard from './ui/components/RouteGuard/RouteGuard';
2121
import Person from '@material-ui/icons/Person';
2222
import OpenPushRequests from './ui/views/OpenPushRequests/OpenPushRequests';
2323
import PushDetails from './ui/views/PushDetails/PushDetails';
24-
import User from './ui/views/User/User';
24+
import User from './ui/views/User/UserProfile';
2525
import UserList from './ui/views/UserList/UserList';
2626
import RepoDetails from './ui/views/RepoDetails/RepoDetails';
2727
import RepoList from './ui/views/RepoList/RepoList';

0 commit comments

Comments
 (0)