chore: update fastify-git-server to get more event data into onPush + some cleanup@@ -12,10 +12,14 @@ export const getHomeView: ReqHandler = async (request, reply) => {
const foo = authService.isExistingUsername("test");
const user = authService.findUserByUid((request.params as any).uid);
- await authService.validateUserEmailAddress("user-uid", "email@address.tld");
+ const never = await authService.validateUserEmailAddress(
+ "user-uid",
+ "email@address.tld"
+ );
// TODO: Create a User model in db where to store user data.
user; // so typescript do not complains about unused variable.
+ never;
return reqHandler<HomeViewProps>(HomeView.name, {
foo,
@@ -208,13 +208,27 @@ async function main(): Promise<AppServer> {
gitRepositoryDir: orgRepo.gitRepositoryDir,
};
},
- onPush: (sideBand) => {
- sideBand.write("\n");
- sideBand.write("🖖 See the details of your push at:\n");
- sideBand.write(
- `🧲 ${Env.DEPLOYMENT_SCHEME}://${Env.DEPLOYMENT_DOMAIN}/testorg/test-repo/commits/some_commit_hash\n`
- );
- sideBand.write("\n");
+ onPush({ data, message, type }) {
+ const { request: _, ...dataRest } = data;
+ console.log("event.type:", type);
+ console.log("event.data:", dataRest);
+
+ if (data.packType === GitServer.PackType.RECEIVE) {
+ // client has done something like "git push"
+ // it is uploading, we are receiving
+ message.write("\n");
+ message.write("🖖 See the details of your push at:\n");
+ message.write(
+ `🧲 ${Env.DEPLOYMENT_SCHEME}://${Env.DEPLOYMENT_DOMAIN}:${PORT}/${data.repoSlug}/commits/some_commit_hash\n`
+ );
+ message.write("\n");
+ } else if (data.packType === GitServer.PackType.UPLOAD) {
+ // client has done something like "git clone"
+ // it is receiving, we are uploading
+ message.write("\n");
+ message.write(`🖖 Welcome at GitFOSS ${data.username}!\n`);
+ message.write("\n");
+ }
},
});
@@ -18,31 +18,6 @@ export const makeRequestHandler = {
props?: T & CommonViewProps,
viewCtx?: ViewContext
) => {
- /*console.log(
- "----",
- request.namedViewsPathMap,
- request.pathNamedViewsMap
- );*/
-
- // const routerPath = request.routerPath.trim();
- // const viewNameFromPath = request.pathNamedViewsMap[routerPath];
- // const viewPathFromName = request.namedViewsPathMap[viewNameFromPath];
- // const viewNameFromPath2 = request.pathNamedViewsMap[viewPathFromName];
-
- /*console.log(
- "-> ",
- "viewName:",
- viewName,
- "routerPath:",
- routerPath,
- "viewPathFromName:",
- viewPathFromName,
- "viewNameFromPath:",
- viewNameFromPath,
- "viewNameFromPath2:",
- viewNameFromPath2
- );*/
-
const viewProps: T & { commonProps: CommonViewProps } = {
...props,
commonProps: {
@@ -19,8 +19,7 @@
"migrate:reset": "yarn env:local && prisma migrate reset",
"bundle:islands": "NODE_ENV=production bundle-islands",
"build:ts": "NODE_ENV=production tsc",
- "build": "run-s clean build:ts bundle:islands docs:copy-to-dist",
- "docs:copy-to-dist": "cp -rf ./docs/ ./dist/docs",
+ "build": "run-s clean build:ts bundle:islands",
"dev": "NODE_ENV=development ts-node-dev --respawn ./app/server.ts",
"deploy": "exoframe deploy --update",
"start": "NODE_ENV=production node ./dist/app/server.js",
@@ -29,7 +28,7 @@
},
"dependencies": {
"@ethicdevs/fastify-custom-session": "^0.6.0",
- "@ethicdevs/fastify-git-server": "^1.2.0",
+ "@ethicdevs/fastify-git-server": "^1.3.1",
"@ethicdevs/fastify-stream-react-views": "^1.9.9",
"@ethicdevs/react-monolith": "^1.6.1",
"@fastify/cookie": "6.0.0",
@@ -303,9 +303,9 @@
pg "^8.7.3"
pg-pool "^3.5.1"
-"@ethicdevs/fastify-git-server@^1.2.0":
- version "1.2.0"
- resolved "https://registry.yarnpkg.com/@ethicdevs/fastify-git-server/-/fastify-git-server-1.2.0.tgz#d0aa357a9db0236b59e10e14d67e6cf809be62cb"
+"@ethicdevs/fastify-git-server@^1.3.1":
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/@ethicdevs/fastify-git-server/-/fastify-git-server-1.3.1.tgz#f140f63b1d996b81d8a5c7d0bc889dd5f7ba3393"
dependencies:
debug "^4.3.4"
fastify-plugin "^3.0.1"