Skip to content

Commit 12f20c9

Browse files
authored
Merge branch 'main' into 948-neDB-implementation-issues
2 parents b5cd038 + 740bd1a commit 12f20c9

File tree

16 files changed

+282
-15
lines changed

16 files changed

+282
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ jobs:
6060
# if: ${{ steps.test.outputs.exit_code }} != 0
6161
# run: exit ${{ steps.test.outputs.exit_code }}
6262

63-
- name: Build application
64-
run: npm run build
63+
- name: Build frontend
64+
run: npm run build-ui
6565

6666
- name: Save build folder
6767
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4

.github/workflows/npm.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
registry-url: 'https://registry.npmjs.org'
2323
- run: npm ci
2424
- run: npm run build
25+
env:
26+
IS_PUBLISHING: 'YES'
2527
- run: npm publish --access=public
2628
env:
2729
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# This file required to override .gitignore when publishing to npm
22
website/
33
plugins/
4+
experimental/
5+
cypress/

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ $ git push proxy $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remo
8484
Using the default configuration, GitProxy intercepts the push and _blocks_ it. To enable code pushing to your fork via GitProxy, add your repository URL into the GitProxy config file (`proxy.config.json`). For more information, refer to [our documentation](https://git-proxy.finos.org).
8585

8686
## Documentation
87+
8788
For detailed step-by-step instructions for how to install, deploy & configure GitProxy and
8889
customize for your environment, see the [project's documentation](https://git-proxy.finos.org/docs/):
8990

@@ -101,11 +102,11 @@ If you identify a security vulnerability in the codebase, please follow the step
101102

102103
## Code of Conduct
103104

104-
We are committed to making open source an enjoyable and respectful experience for our community. See <a href="https://github.com/finos/git-proxy/blob/main/CODE_OF_CONDUCT.md"><code>CODE_OF_CONDUCT</code></a> for more information.
105+
We are committed to making open source an enjoyable and respectful experience for our community. See [`CODE_OF_CONDUCT`](CODE_OF_CONDUCT.md) for more information.
105106

106107
## License
107108

108-
This project is distributed under the Apache-2.0 license. See <a href="./LICENSE"><code>LICENSE</code></a> for more information.
109+
This project is distributed under the Apache-2.0 license. See [`LICENSE`](LICENSE) for more information.
109110

110111
## Contact
111112

@@ -115,4 +116,4 @@ If you can't access Slack, you can also [subscribe to our mailing list](mailto:g
115116

116117
Join our [fortnightly Zoom meeting](https://zoom.us/j/97235277537?pwd=aDJsaE8zcDJpYW1vZHJmSTJ0RXNZUT09) on Monday, 11AM EST (odd week numbers). Send an e-mail to [[email protected]](mailto:[email protected]) to get a calendar invitation.
117118

118-
Otherwise, if you have a deeper query or require more support, please [raise an issue](https://github.com/finos/git-proxy/issues).
119+
Otherwise, if you have a deeper query or require more support, please [raise an issue](https://github.com/finos/git-proxy/issues).

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
22
"name": "@finos/git-proxy",
3-
"version": "1.11.0",
3+
"version": "1.13.0",
44
"description": "Deploy custom push protections and policies on top of Git.",
55
"scripts": {
66
"cli": "node ./packages/git-proxy-cli/index.js",
77
"client": "vite --config vite.config.js",
88
"clientinstall": "npm install --prefix client",
99
"server": "tsx index.ts",
1010
"start": "concurrently \"npm run server\" \"npm run client\"",
11-
"build": "vite build",
12-
"build-ts": "tsc",
11+
"build": "npm run build-ui && npm run build-lib",
12+
"build-ui": "vite build",
13+
"build-lib": "./scripts/build-for-publish.sh",
14+
"restore-lib": "./scripts/undo-build.sh",
15+
"check-types": "tsc",
1316
"test": "NODE_ENV=test ts-mocha './test/*.js' --exit",
1417
"test-coverage": "nyc npm run test",
1518
"test-coverage-ci": "nyc --reporter=lcovonly --reporter=text npm run test",

scripts/build-for-publish.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# This script allows for emitting js and definitions from the typescript into
5+
# the same import locations as the original files.
6+
# When we adjust how we import the library we can move to a "dist" folder and
7+
# explicit "exports".
8+
9+
if [ "${IS_PUBLISHING:-}" != "YES" ]; then
10+
echo "This script is intended to prepare the directory for publishing"
11+
echo "and replaces files. If you only want to build the UI run \`npm run build-ui\`."
12+
echo "Otherwise set IS_PUBLISHING to \"YES\""
13+
exit 1
14+
fi
15+
16+
set -x
17+
18+
REPO_ROOT="$(git rev-parse --show-toplevel)"
19+
cd "$REPO_ROOT"
20+
21+
rm -rf dist || true
22+
tsc --project tsconfig.publish.json
23+
# replace tsx with node for the new index.js
24+
sed -ie '1s/tsx/node/' dist/index.js
25+
# ensure it's executable
26+
chmod +x dist/index.js
27+
# move the ts source
28+
mv src src-old
29+
# move the built source
30+
mv dist/src dist/index.js dist/index.d.ts .
31+
# copy back unchanged ui code
32+
# could probably drop this as the ui code shouldn't really be imported from
33+
# the main package but keep for compat until split out.
34+
mv src-old/ui src/ui
35+
rm -rf src-old index.ts dist

scripts/undo-build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
4+
# Undo what was done by build-for-publish.sh in the event this was ran locally
5+
6+
REPO_ROOT="$(git rev-parse --show-toplevel)"
7+
cd "$REPO_ROOT"
8+
9+
rm -rf dist index.js index.d.ts || true
10+
git checkout src index.ts
11+
git clean -f src

src/proxy/chain.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const pushActionChain: ((req: any, action: Action) => Promise<Action>)[] = [
1414
proc.push.writePack,
1515
proc.push.preReceive,
1616
proc.push.getDiff,
17+
// run before clear remote
18+
proc.push.gitleaks,
1719
proc.push.clearBareClone,
1820
proc.push.scanDiff,
1921
proc.push.blockForAuth,

src/proxy/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const options = {
2727
cert: getTLSEnabled() ? fs.readFileSync(getTLSCertPemPath()) : undefined,
2828
};
2929

30-
const proxyPreparations = async () => {
30+
export const proxyPreparations = async () => {
3131
const plugins = getPlugins();
3232
const pluginLoader = new PluginLoader(plugins);
3333
await pluginLoader.load();
@@ -47,15 +47,15 @@ const proxyPreparations = async () => {
4747
};
4848

4949
// just keep this async incase it needs async stuff in the future
50-
const createApp = async () => {
50+
export const createApp = async () => {
5151
const app = express();
5252
// Setup the proxy middleware
5353
app.use(bodyParser.raw(options));
5454
app.use('/', router);
5555
return app;
5656
};
5757

58-
const start = async () => {
58+
export const start = async () => {
5959
const app = await createApp();
6060
await proxyPreparations();
6161
http.createServer(options as any, app).listen(proxyHttpPort, () => {

0 commit comments

Comments
 (0)