-
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.
- Loading branch information
Showing
13 changed files
with
198 additions
and
6 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,24 @@ | ||
// @ts-check | ||
|
||
import eslint from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommendedTypeChecked, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
project: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ["eslint.config.js", "vitest.config.js", "**/*.d.ts"], | ||
...tseslint.configs.disableTypeChecked, | ||
}, | ||
{ | ||
ignores: ["**/coverage/*", "**/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 @@ | ||
export { getServerURL } from "./src/index.js"; |
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,42 @@ | ||
{ | ||
"name": "@rusty/config", | ||
"version": "1.0.0", | ||
"private": true, | ||
"type": "module", | ||
"imports": { | ||
"#internal": "./dist/src/index.js" | ||
}, | ||
"exports": { | ||
".": "./dist/index.js" | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"clean": "rm -rf dist", | ||
"build": "tsc --build --verbose", | ||
"test": "vitest", | ||
"check-types": "tsc --noEmit", | ||
"lint": "eslint src" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "GPL-3.0-only", | ||
"devDependencies": { | ||
"@types/node": "20.14.12", | ||
"@types/pino": "7.0.5", | ||
"@vitest/coverage-v8": "^2.0.4", | ||
"@vitest/ui": "^2.0.4", | ||
"eslint": "^8.57.0", | ||
"nx": "19.5.1", | ||
"ts-node": "^10.9.2", | ||
"tslib": "^2.6.3", | ||
"typescript": "^5.5.4", | ||
"vite": "2.0.4", | ||
"vitest": "^2.0.4" | ||
}, | ||
"dependencies": { | ||
"@rusty/util": "workspace:*", | ||
"@sentry/node": "^8.20.0", | ||
"@sentry/profiling-node": "^8.20.0", | ||
"pino": "9.3.1" | ||
} | ||
} |
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,4 @@ | ||
export function getServerURL(): string { | ||
const serverURL = process.env.SERVER_URL ?? "https://rusty-motors.com"; | ||
return serverURL; | ||
} | ||
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 @@ | ||
export { getServerURL } from "./config.js"; |
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,24 @@ | ||
export type rawHttpRequestData = { | ||
headers: Record<string, string>; | ||
remoteAddress: string; | ||
method: string; | ||
url: string; | ||
}; | ||
|
||
export type parsedHttpRequestData = { | ||
headers: Record<string, string>; | ||
remoteAddress: string; | ||
method: string; | ||
pathname: string; | ||
searchParams: URLSearchParams; | ||
}; | ||
export type RequestResponse = { | ||
statusCode: number; | ||
body: string; | ||
headers: Record<string, string>; | ||
}; | ||
|
||
export type User = { | ||
username: string; | ||
password: string; | ||
}; |
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,13 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { getServerURL } from "@rusty/config"; | ||
|
||
describe("config", () => { | ||
it("should have a default serverURL if SERVER_URL environment variable is not set", () => { | ||
expect(getServerURL()).toBe("https://rusty-motors.com"); | ||
}); | ||
|
||
it("should use the SERVER_URL environment variable if set", () => { | ||
process.env.SERVER_URL = "https://example.com"; | ||
expect(getServerURL()).toBe("https://example.com"); | ||
}); | ||
}); |
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,11 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"declarationDir": "./dist", | ||
"composite": true | ||
}, | ||
"include": ["index.ts", "src/**/*.ts", "test/**/*.ts"], | ||
"exclude": ["node_modules", "dist"], | ||
"references": [{ "path": "../util" }] | ||
} |
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,20 @@ | ||
import { defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({ | ||
test: { | ||
coverage: { | ||
enabled: true, | ||
all: true, | ||
exclude: [ | ||
"dist/**", | ||
"eslint.config.js", | ||
"vitest.config.js" | ||
], | ||
reporter: ["lcov", "text", "cobertura"], | ||
}, | ||
reporters: ["junit", "default", "hanging-process"], | ||
outputFile: "mcos.junit.xml", | ||
pool: "forks", | ||
watch: false, | ||
}, | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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