fix(server): update build paths

This commit is contained in:
Mauricio Siu
2024-10-26 15:48:30 -06:00
parent 0873618c63
commit 27c33c7661
6 changed files with 18 additions and 76 deletions

View File

@@ -1,16 +0,0 @@
export interface LemonSqueezyLicenseResponse {
valid: boolean;
error?: string;
meta?: {
store_id: string;
order_id: number;
order_item_id: number;
product_id: number;
product_name: string;
variant_id: number;
variant_name: string;
customer_id: number;
customer_name: string;
customer_email: string;
};
}

View File

@@ -1,45 +1,12 @@
import {
deployApplication,
deployCompose,
deployRemoteApplication,
deployRemoteCompose,
rebuildApplication,
rebuildCompose,
rebuildRemoteApplication,
rebuildRemoteCompose,
updateApplicationStatus,
updateCompose,
} from "@dokploy/server/dist";
} from "@dokploy/server";
import type { DeployJob } from "./schema";
import type { LemonSqueezyLicenseResponse } from "./types";
// const LEMON_SQUEEZY_API_KEY = process.env.LEMON_SQUEEZY_API_KEY;
// const LEMON_SQUEEZY_STORE_ID = process.env.LEMON_SQUEEZY_STORE_ID;
// export const validateLemonSqueezyLicense = async (
// licenseKey: string,
// ): Promise<LemonSqueezyLicenseResponse> => {
// try {
// const response = await fetch(
// "https://api.lemonsqueezy.com/v1/licenses/validate",
// {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// "x-api-key": LEMON_SQUEEZY_API_KEY as string,
// },
// body: JSON.stringify({
// license_key: licenseKey,
// store_id: LEMON_SQUEEZY_STORE_ID as string,
// }),
// },
// );
// return response.json();
// } catch (error) {
// console.error("Error validating license:", error);
// return { valid: false, error: "Error validating license" };
// }
// };
export const deploy = async (job: DeployJob) => {
try {

View File

@@ -8,7 +8,7 @@ import {
runMongoBackup,
runMySqlBackup,
runPostgresBackup,
} from "@dokploy/server/dist";
} from "@dokploy/server";
import { db } from "@dokploy/server/dist/db";
import { backups, server } from "@dokploy/server/dist/db/schema";
import { eq } from "drizzle-orm";

View File

@@ -16,18 +16,6 @@
"./constants": {
"import": "./src/constants/index.ts",
"require": "./dist/constants.cjs.js"
},
"./dist": {
"import": "./dist/index.js",
"require": "./dist/index.cjs.js"
},
"./dist/db": {
"import": "./dist/db/index.js",
"require": "./dist/db/*.cjs"
},
"./dist/db/schema": {
"import": "./dist/db/schema/index.js",
"require": "./dist/db/schema/*.cjs"
}
},
"scripts": {

View File

@@ -8,6 +8,8 @@ const __dirname = path.dirname(__filename);
const packagePath = path.resolve(__dirname, "../package.json");
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
pkg.main = "./dist/index.js";
pkg.exports = {
".": {
import: "./dist/index.js",
@@ -21,6 +23,18 @@ pkg.exports = {
import: "./dist/*",
require: "./dist/*.cjs",
},
"./dist": {
import: "./dist/index.js",
require: "./dist/index.cjs.js",
},
"./dist/db": {
import: "./dist/db/index.js",
require: "./dist/db/index.cjs.js",
},
"./dist/db/schema": {
import: "./dist/db/schema/index.js",
require: "./dist/db/schema/index.cjs.js",
},
};
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2));

View File

@@ -10,6 +10,8 @@ const packagePath = path.resolve(__dirname, "../package.json");
// Leer el archivo package.json
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
pkg.main = "./src/index.ts";
// Modificar los exports
pkg.exports = {
".": "./src/index.ts",
@@ -25,19 +27,6 @@ pkg.exports = {
import: "./src/constants/index.ts",
require: "./dist/constants.cjs.js",
},
"./dist": {
import: "./dist/index.js",
require: "./dist/index.cjs.js",
},
"./dist/db": {
import: "./dist/db/index.js",
require: "./dist/db/*.cjs",
},
"./dist/db/schema": {
import: "./dist/db/schema/index.js",
require: "./dist/db/schema/*.cjs",
},
};
// Guardar los cambios en package.json