Fix vite config

This commit is contained in:
Ryan Pandya 2024-11-08 19:52:34 -08:00
parent 6298684391
commit f56891c118
2 changed files with 32 additions and 24 deletions

29
apps/cli/bin/index.js Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/nix/store/bmmjbvb8hishfrg78ygjlynpq3ikpl39-nodejs-20.15.1/bin/node
import process$1 from "node:process";
import os from "node:os";
import tty from "node:tty";
@ -400,7 +401,7 @@ for (const model of usedModels) {
styles[model] = {
get() {
const { level } = this;
return function(...arguments_) {
return function (...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles.color.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
@ -410,7 +411,7 @@ for (const model of usedModels) {
styles[bgModel] = {
get() {
const { level } = this;
return function(...arguments_) {
return function (...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
@ -1395,7 +1396,8 @@ function createTRPCProxyClient(opts) {
function getAPIClient() {
const globals = getGlobalOptions();
return createTRPCProxyClient({
links: [httpBatchLink({
links: [
httpBatchLink({
url: `${globals.serverAddr}/api/trpc`,
maxURLLength: 14e3,
headers() {
@ -1403,7 +1405,8 @@ function getAPIClient() {
authorization: `Bearer ${globals.apiKey}`
};
}
})]
})
]
});
}
function getDefaultExportFromCjs(x) {
@ -4371,7 +4374,7 @@ commander.Help = Help$1;
commander.CommanderError = CommanderError$1;
commander.InvalidArgumentError = InvalidArgumentError$1;
commander.InvalidOptionArgumentError = InvalidArgumentError$1;
(function(module, exports) {
(function (module, exports) {
const commander$1 = commander;
exports = module.exports = {};
exports.program = new commander$1.Command();
@ -4408,11 +4411,23 @@ helloWorldCmd.command("test").description("does something specific I guess").act
try {
console.dir(api);
} catch (error2) {
printErrorMessageWithReason("Something went horribly wrong", error2);
printErrorMessageWithReason(
"Something went horribly wrong",
error2
);
}
});
const __vite_import_meta_env__ = { "BASE_URL": "/", "CLI_VERSION": "0.0.1", "DEV": false, "MODE": "production", "PROD": true, "SSR": true };
const program = new Command2().name("lifetracker").description("A CLI interface to interact with my lifetracker api").addOption(new Option2("--api-key <key>", "the API key to interact with the API").makeOptionMandatory(true).env("LIFETRACKER_API_KEY")).addOption(new Option2("--server-addr <addr>", "the address of the server to connect to").makeOptionMandatory(true).env("LIFETRACKER_SERVER_ADDR")).addOption(new Option2("--json", "to output the result as JSON")).version(__vite_import_meta_env__ && "CLI_VERSION" in __vite_import_meta_env__ ? "0.0.1" : "0.0.0");
const program = new Command2().name("lifetracker").description("A CLI interface to interact with my lifetracker api").addOption(
new Option2("--api-key <key>", "the API key to interact with the API").makeOptionMandatory(true).env("LIFETRACKER_API_KEY")
).addOption(
new Option2(
"--server-addr <addr>",
"the address of the server to connect to"
).makeOptionMandatory(true).env("LIFETRACKER_SERVER_ADDR")
).addOption(new Option2("--json", "to output the result as JSON")).version(
__vite_import_meta_env__ && "CLI_VERSION" in __vite_import_meta_env__ ? "0.0.1" : "0.0.0"
);
program.addCommand(helloWorldCmd);
setGlobalOptions(program.opts());
program.parse();

View File

@ -5,13 +5,6 @@
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import viteTS from "vite-plugin-ts";
const debugTsconfigPaths = tsconfigPaths({
loose: true,
root: ".",
ignoreConfigErrors: true
});
export default defineConfig({
build: {
@ -27,7 +20,7 @@ export default defineConfig({
// bundle everything except for Node built-ins
noExternal: /^(?!node:).*$/,
},
plugins: [debugTsconfigPaths, viteTS()],
plugins: [tsconfigPaths()],
define: {
"import.meta.env.CLI_VERSION": JSON.stringify(
process.env.npm_package_version,