quickwire
Version:
Automatic API generator for Next.js applications that creates API routes and TypeScript client functions from backend functions
87 lines • 3.85 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CONFIG = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const typescript_1 = __importDefault(require("typescript"));
const defaultConfig = {
backendDir: path_1.default.join(process.cwd(), "src", "backend"),
apiDir: path_1.default.join(process.cwd(), "src", "app", "api", "(quickwired)"),
quickwireDir: path_1.default.join(process.cwd(), "quickwired"),
supportedExtensions: [".ts", ".js"],
apiRouteTemplate: "route.ts",
excludePatterns: ["*.test.ts", "*.spec.ts", "*.d.ts", "node_modules", ".git"],
compilerOptions: {
target: typescript_1.default.ScriptTarget.Latest,
module: typescript_1.default.ModuleKind.ESNext,
strict: true,
esModuleInterop: true,
skipLibCheck: true,
forceConsistentCasingInFileNames: true,
moduleResolution: typescript_1.default.ModuleResolutionKind.Bundler,
},
watchDebounceMs: 300,
performance: {
enableDocGeneration: true,
maxFilesToProcess: 1000,
enableIncrementalUpdates: true,
cacheExpiryMs: 30 * 60 * 1000, // Increased to 30 minutes
},
httpMethods: {
GET: [
'get', 'fetch', 'find', 'list', 'show', 'read', 'retrieve', 'search',
'query', 'view', 'display', 'load', 'check', 'verify', 'validate',
'count', 'exists', 'has', 'is', 'can'
],
POST: [
'create', 'add', 'insert', 'post', 'submit', 'send', 'upload',
'register', 'login', 'signup', 'authenticate', 'authorize', 'process',
'execute', 'run', 'perform', 'handle', 'trigger', 'invoke', 'call',
'generate', 'build', 'make', 'produce', 'sync', 'import', 'export'
],
PUT: [
'update', 'edit', 'modify', 'change', 'set', 'put', 'replace',
'toggle', 'switch', 'enable', 'disable', 'activate', 'deactivate',
'publish', 'unpublish', 'approve', 'reject', 'accept', 'decline',
'assign', 'unassign', 'move', 'transfer', 'migrate', 'restore',
'reset', 'refresh', 'renew', 'reorder', 'sort', 'merge'
],
PATCH: [
'patch', 'partial', 'increment', 'decrement', 'append', 'prepend',
'adjust', 'tweak', 'fine', 'tune'
],
DELETE: [
'delete', 'remove', 'destroy', 'clear', 'clean', 'purge', 'drop',
'erase', 'wipe', 'cancel', 'revoke', 'withdraw', 'uninstall',
'detach', 'disconnect', 'unlink', 'archive', 'trash'
]
}
};
function loadConfig() {
// Look for config in multiple locations
const configPaths = [
path_1.default.join(process.cwd(), "quickwire.config.json"),
path_1.default.join(process.cwd(), "scripts", "quickwire.config.json"),
path_1.default.join(process.cwd(), ".quickwire", "config.json"),
];
for (const configPath of configPaths) {
if (fs_1.default.existsSync(configPath)) {
try {
const configContent = fs_1.default.readFileSync(configPath, "utf-8");
const userConfig = JSON.parse(configContent);
console.log(`📄 Loaded config from: ${path_1.default.relative(process.cwd(), configPath)}`);
return { ...defaultConfig, ...userConfig };
}
catch (error) {
console.warn(`⚠️ Failed to load config from ${configPath}: ${error}`);
}
}
}
console.log(`📄 Using default configuration`);
return defaultConfig;
}
exports.CONFIG = loadConfig();
//# sourceMappingURL=config.js.map
;