-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update packages * add dockerfile and update server bundle * update tsconfig * rename parse config * publish packages * use console logger in cli
- Loading branch information
1 parent
9315638
commit c92f393
Showing
20 changed files
with
198 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.git | ||
.gitignore | ||
*.md | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM node:20-slim AS base | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
FROM base AS build | ||
COPY . /usr/src/app | ||
WORKDIR /usr/src/app | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
RUN pnpm run -r build | ||
RUN pnpm deploy --filter=@gateweaver/server --prod /prod/server | ||
|
||
FROM base | ||
COPY --from=build /prod/server /prod/server | ||
WORKDIR /prod/server | ||
EXPOSE 8080 | ||
CMD [ "pnpm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
#! /usr/bin/env node | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require("dotenv").config({ path: ".env.gateweaver" }); | ||
import { readFileSync } from "node:fs"; | ||
import { resolve } from "node:path"; | ||
import { config } from "dotenv"; | ||
config({ path: ".env.gateweaver" }); | ||
import { program } from "commander"; | ||
import { startServer } from "@gateweaver/server"; | ||
import { logger } from "@gateweaver/utils"; | ||
import { startServer } from "@gateweaver/server/start"; | ||
import { generateApiKeyAction } from "./generate-api-key"; | ||
|
||
const packageJson = JSON.parse( | ||
readFileSync(resolve(__dirname, "../package.json"), "utf8"), | ||
); | ||
const setupCLI = async () => { | ||
const packageJson = await import("../package.json", { | ||
assert: { type: "json" }, | ||
}); | ||
|
||
program | ||
.name("gateweaver") | ||
.description("A CLI tool for managing gateweaver gateways") | ||
.version(packageJson.version); | ||
program | ||
.name("gateweaver") | ||
.description("A CLI tool for managing gateweaver gateways") | ||
.version(packageJson.default.version); | ||
|
||
program | ||
.command("generate-api-key") | ||
.description("Generate a new API key and hash") | ||
.action(generateApiKeyAction); | ||
program | ||
.command("generate-api-key") | ||
.description("Generate a new API key and hash") | ||
.action(generateApiKeyAction); | ||
|
||
program | ||
.command("start") | ||
.description("Start the gateweaver server") | ||
.action(() => { | ||
try { | ||
startServer(); | ||
} catch (error) { | ||
logger.error(error); | ||
process.exit(1); | ||
} | ||
}); | ||
program | ||
.command("start") | ||
.description("Start the gateweaver server") | ||
.action(() => { | ||
try { | ||
startServer(); | ||
} catch (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
}); | ||
|
||
program.parse(); | ||
}; | ||
|
||
program.parse(); | ||
setupCLI().catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
export { startServer } from "./server/start-server"; | ||
import { config } from "dotenv"; | ||
config({ path: ".env.gateweaver" }); | ||
import { logger } from "@gateweaver/utils"; | ||
import { startServer } from "./start-server"; | ||
|
||
try { | ||
startServer(); | ||
} catch (error) { | ||
logger.error(error); | ||
process.exit(1); | ||
} |
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
packages/server/src/server/start-server.ts → packages/server/src/start-server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from "tsup"; | ||
|
||
export default defineConfig({ | ||
entry: ["src/index.ts", "src/start-server.ts"], | ||
format: ["cjs", "esm"], | ||
dts: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters