Remove config, scripts, hydrate

This commit is contained in:
Owen Schwartz
2024-12-26 11:32:42 -05:00
parent 7d615d00d8
commit 34e3e7c819
7 changed files with 2 additions and 132 deletions
-74
View File
@@ -1,74 +0,0 @@
import esbuild from "esbuild";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { nodeExternalsPlugin } from "esbuild-node-externals";
// import { glob } from "glob";
// import path from "path";
const banner = `
// patch __dirname
// import { fileURLToPath } from "url";
// import path from "path";
// const __filename = fileURLToPath(import.meta.url);
// const __dirname = path.dirname(__filename);
// allow top level await
import { createRequire as topLevelCreateRequire } from "module";
const require = topLevelCreateRequire(import.meta.url);
`;
const argv = yargs(hideBin(process.argv))
.usage("Usage: $0 -entry [string] -out [string]")
.option("entry", {
alias: "e",
describe: "Entry point file",
type: "string",
demandOption: true,
})
.option("out", {
alias: "o",
describe: "Output file path",
type: "string",
demandOption: true,
})
.help()
.alias("help", "h").argv;
// generate a list of all package.json files in the monorepo
function getPackagePaths() {
// const packagePaths = [];
// const packageGlob = "package.json";
// const packageJsonFiles = glob.sync(packageGlob);
// for (const packageJsonFile of packageJsonFiles) {
// packagePaths.push(path.dirname(packageJsonFile) + "/package.json");
// }
// return packagePaths;
return ["package.json"];
}
esbuild
.build({
entryPoints: [argv.entry],
bundle: true,
outfile: argv.out,
format: "esm",
banner: {
js: banner,
},
platform: "node",
external: ["body-parser"],
plugins: [
nodeExternalsPlugin({
packagePath: getPackagePaths(),
}),
],
sourcemap: false,
target: "node20",
})
.then(() => {
console.log("Build completed successfully");
})
.catch((error) => {
console.error("Build failed:", error);
process.exit(1);
});
-130
View File
@@ -1,130 +0,0 @@
import { orgs, sites, resources, exitNodes, targets } from "@server/db/schema";
// import db from "@server/db";
// import { createAdminRole } from "@server/db/ensureActions";
// async function insertDummyData() {
// const org1 = db
// .insert(orgs)
// .values({
// orgId: "fossorial",
// name: "Fossorial",
// domain: "fossorial.io",
// })
// .returning()
// .get();
// await createAdminRole(org1.orgId!);
// // Insert dummy exit nodes
// const exitNode1 = db
// .insert(exitNodes)
// .values({
// name: "Exit Node 1",
// address: "10.0.0.1/24",
// publicKey: "sKQlCNErB2n+dV8eLp5Yw/avsjK/zkrxJE0n48hjb10=",
// listenPort: 51820,
// endpoint: "exitnode1.fossorial.io",
// })
// .returning()
// .get();
// // Insert dummy sites
// const site1 = db
// .insert(sites)
// .values({
// orgId: org1.orgId,
// exitNodeId: exitNode1.exitNodeId,
// name: "Main Site",
// subdomain: "main",
// pubKey: "Kn4eD0kvcTwjO//zqH/CtNVkMNdMiUkbqFxysEym2D8=",
// subnet: "10.0.0.16/28",
// })
// .returning()
// .get();
// const site2 = db
// .insert(sites)
// .values({
// orgId: org2.orgId,
// exitNode: exitNode2.exitNodeId,
// name: "Dev Site",
// subdomain: "dev",
// pubKey: "V329Uf/vhnBwYxAuT/ZlMZuLokHy5tug/sGsLfIMK1w=",
// subnet: "172.16.1.16/28",
// })
// .returning()
// .get();
// // Insert dummy resources
// const resource1 = db
// .insert(resources)
// .values({
// resourceId: `web.${site1.subdomain}.${org1.domain}`,
// siteId: site1.siteId,
// orgId: site1.orgId,
// name: "Web Server",
// subdomain: "web",
// })
// .returning()
// .get();
// const resource2 = db
// .insert(resources)
// .values({
// resourceId: `web2.${site1.subdomain}.${org1.domain}`,
// siteId: site1.siteId,
// orgId: site1.orgId,
// name: "Web Server 2",
// subdomain: "web2",
// })
// .returning()
// .get();
// const resource3 = db
// .insert(resources)
// .values({
// resourceId: `db.${site2.subdomain}.${org2.domain}`,
// siteId: site2.siteId,
// orgId: site2.orgId,
// name: "Database",
// subdomain: "db",
// })
// .returning()
// .get();
// // Insert dummy routes
// await db.insert(routes).values([
// { exitNodeId: exitNode1.exitNodeId, subnet: "10.0.0.0/24" },
// { exitNodeId: exitNode2.exitNodeId, subnet: "172.16.1.1/24" },
// ]);
// // Insert dummy targets
// await db.insert(targets).values([
// {
// resourceId: resource1.resourceId,
// ip: "10.0.0.16",
// method: "http",
// port: 4200,
// protocol: "TCP",
// },
// {
// resourceId: resource2.resourceId,
// ip: "10.0.0.17",
// method: "https",
// port: 443,
// protocol: "TCP",
// },
// {
// resourceId: resource3.resourceId,
// ip: "172.16.1.16",
// method: "http",
// port: 80,
// protocol: "TCP",
// },
// ]);
// console.log("Dummy data inserted successfully");
// }
// insertDummyData().catch(console.error);