mindstudio
Version:
Client library for MindStudio AI Workers
35 lines (34 loc) • 1.46 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigPaths = void 0;
const path_1 = __importDefault(require("path"));
class ConfigPaths {
static getConfigPath() {
return path_1.default.join(process.cwd(), ".mindstudio.json");
}
static getTypesPath() {
try {
// Try to resolve the main entry point using require
const mainModule = require.resolve("mindstudio");
const projectRoot = process.cwd();
const packageDir = path_1.default.dirname(path_1.default.dirname(path_1.default.dirname(mainModule))); // Go up two levels from dist/src/index.js
// If we're running from a project that has mindstudio as dependency
// (not running from within mindstudio package itself)
if (!projectRoot.includes(packageDir)) {
return path_1.default.join(packageDir, "dist/src/generated");
}
}
catch {
// Either:
// 1. We're in development
// 2. Resolution failed
// 3. We're in tests (where require.resolve might be mocked)
}
// Default to local development path
return path_1.default.join(process.cwd(), "dist/src/generated");
}
}
exports.ConfigPaths = ConfigPaths;