-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a type safe config with sane defaults on type level
- Loading branch information
1 parent
165c793
commit c5185fd
Showing
19 changed files
with
269 additions
and
141 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,7 @@ | ||
PUBLIC_EXPLORER_URL="https://app.radicle.xyz/nodes/$host/$rid$path" | ||
SUPPORTED_API_VERSION: "4.0.0" | ||
DEFAULT_HTTPD_API_PORT: 443 | ||
DEFAULT_HTTPD_SCHEME: "https" | ||
HISTORY_COMMITS_PER_PAGE: 30 | ||
SUPPORT_WEBSITE: "https://radicle.xyz" | ||
PREFERRED_SEEDS: '[{ "hostname": "seed.radicle.garden", "port": 443, "scheme": "https" }]' |
This file was deleted.
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
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,25 +1,37 @@ | ||
import nodeConfig from "config"; | ||
import path from "node:path"; | ||
import virtual from "vite-plugin-virtual"; | ||
import { configureAdapters } from "../vite.config"; | ||
import { defineConfig } from "vite"; | ||
import { loadConfig } from "zod-config"; | ||
import { webConfigSchema } from "./lib/shared"; | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
virtual({ | ||
"virtual:config": nodeConfig.util.toObject(), | ||
}), | ||
], | ||
test: { | ||
environment: "node", | ||
include: ["http-client/tests/*.test.ts"], | ||
reporters: "verbose", | ||
globalSetup: "./tests/support/globalSetup", | ||
}, | ||
resolve: { | ||
alias: { | ||
"@tests": path.resolve("./tests"), | ||
"@app": path.resolve("./src"), | ||
"@http-client": path.resolve("./http-client"), | ||
export default defineConfig(async () => { | ||
const adapters = await configureAdapters(); | ||
const config = await loadConfig({ | ||
schema: webConfigSchema, | ||
adapters, | ||
logger: { | ||
warn: message => console.warn(`WARN [config]: ${message}`), | ||
}, | ||
}, | ||
}); | ||
return { | ||
plugins: [ | ||
virtual({ | ||
"virtual:config": config, | ||
}), | ||
], | ||
test: { | ||
environment: "node", | ||
include: ["http-client/tests/*.test.ts"], | ||
reporters: "verbose", | ||
globalSetup: "./tests/support/globalSetup", | ||
}, | ||
resolve: { | ||
alias: { | ||
"@tests": path.resolve("./tests"), | ||
"@app": path.resolve("./src"), | ||
"@http-client": path.resolve("./http-client"), | ||
}, | ||
}, | ||
}; | ||
}); |
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,19 +1,6 @@ | ||
declare module "virtual:*" { | ||
const config: { | ||
nodes: { | ||
apiVersion: string; | ||
fallbackPublicExplorer: string; | ||
defaultHttpdPort: number; | ||
defaultLocalHttpdPort: number; | ||
defaultHttpdScheme: string; | ||
}; | ||
source: { | ||
commitsPerPage: number; | ||
}; | ||
reactions: string[]; | ||
supportWebsite: string; | ||
preferredSeeds: BaseUrl[]; | ||
}; | ||
import type { WebConfig } from "@http-client/lib/shared"; | ||
const config: WebConfig; | ||
|
||
export default config; | ||
} |
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
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
Oops, something went wrong.