@re-shell/cli
Version:
Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja
219 lines (218 loc) • 7.52 kB
TypeScript
export interface FileTemplate {
path: string;
content: string;
encoding?: string;
permissions?: number;
}
export interface BaseTemplate {
id: string;
name: string;
description: string;
version: string;
tags: string[];
dependencies: Record<string, string>;
devDependencies?: Record<string, string>;
files: Record<string, any>;
prompts?: TemplatePrompt[];
postInstall?: string[];
}
export interface BackendTemplate extends BaseTemplate {
framework: string;
displayName: string;
language: 'typescript' | 'javascript' | 'python' | 'rust' | 'go' | 'java' | 'csharp' | 'php' | 'ruby' | 'lua' | 'cpp' | 'dart' | 'swift' | 'kotlin' | 'haskell' | 'fsharp' | 'clojure' | 'perl' | 'deno' | 'bun' | 'scala' | 'crystal' | 'zig' | 'elixir' | 'nim' | 'vlang' | 'gleam' | 'rescript' | 'grain' | 'mojo' | 'julia' | 'ocaml';
port?: number;
features?: BackendFeature[];
author?: string;
icon?: string;
packageJson?: any;
scripts?: any;
featured_frameworks?: string[];
type?: string;
complexity?: string;
keywords?: string[];
}
export interface FrontendTemplate extends BaseTemplate {
framework: 'react' | 'vue' | 'svelte' | 'angular' | 'vanilla';
language: 'typescript' | 'javascript';
buildTool: 'vite' | 'webpack' | 'rollup' | 'esbuild';
features?: FrontendFeature[];
}
export interface DatabaseTemplate extends BaseTemplate {
type: 'sql' | 'nosql' | 'graph' | 'cache';
engine: string;
orm?: string;
migrations?: boolean;
}
export interface TemplatePrompt {
type: 'input' | 'confirm' | 'list' | 'checkbox' | 'password';
name: string;
message: string;
default?: any;
choices?: string[] | PromptChoice[];
when?: (answers: Record<string, any>) => boolean;
validate?: (input: any) => boolean | string;
filter?: (input: any) => any;
}
export interface PromptChoice {
name: string;
value: any;
short?: string;
}
export type BackendFeature = string | ('authentication' | 'authorization' | 'database' | 'caching' | 'logging' | 'monitoring' | 'testing' | 'documentation' | 'security' | 'validation' | 'rate-limiting' | 'cors' | 'compression' | 'session-management' | 'file-upload' | 'file-uploads' | 'email' | 'mail' | 'websockets' | 'websocket' | 'graphql' | 'rest-api' | 'microservices' | 'docker' | 'ci-cd' | 'queue' | 'routing' | 'middleware' | 'mvc-architecture' | 'mvc' | 'lucid-orm' | 'edge-template' | 'events' | 'orm' | 'real-time' | 'dependency-injection' | 'hot-reload' | 'oauth2' | 'openapi' | 'migration' | 'plugin-system' | 'multi-process' | 'scheduler' | 'i18n' | 'error-handling' | 'async' | 'schema-validation' | 'plugins' | 'decorators' | 'hooks' | 'swagger' | 'blueprints' | 'policies' | 'static-files' | 'esm' | 'typescript' | 'mongodb' | 'TypeScript decorators' | 'Dependency injection' | 'OpenAPI/Swagger' | 'GraphQL support' | 'WebSocket (Socket.io)' | 'Passport.js auth' | 'TypeORM integration' | 'Exception filters' | 'Interceptors (AOP)' | 'Model validation' | 'Testing framework' | 'Docker support');
export type FrontendFeature = 'routing' | 'state-management' | 'styling' | 'testing' | 'pwa' | 'ssr' | 'ssg' | 'i18n' | 'accessibility' | 'performance' | 'error-tracking' | 'analytics' | 'ui-library' | 'forms' | 'charts' | 'animations' | 'theming' | 'responsive' | 'typescript';
export interface TemplateContext {
projectName: string;
author?: string;
description?: string;
version?: string;
license?: string;
repository?: string;
keywords?: string[];
features?: string[];
[key: string]: any;
}
export interface TemplateGenerationOptions {
template: BaseTemplate;
context: TemplateContext;
outputPath: string;
overwrite?: boolean;
dryRun?: boolean;
}
export interface TemplateGenerationResult {
success: boolean;
filesCreated: string[];
filesSkipped: string[];
errors: string[];
warnings: string[];
postInstallCommands?: string[];
}
export interface TemplateMetadata {
id: string;
name: string;
description: string;
category: 'backend' | 'frontend' | 'fullstack' | 'database' | 'utility';
framework: string;
language: string;
difficulty: 'beginner' | 'intermediate' | 'advanced';
tags: string[];
features: string[];
prerequisites?: string[];
documentation?: string;
examples?: string[];
maintainer?: string;
repository?: string;
license?: string;
lastUpdated?: Date;
downloads?: number;
rating?: number;
}
export interface TemplateRegistry {
templates: Map<string, BaseTemplate>;
metadata: Map<string, TemplateMetadata>;
categories: Map<string, string[]>;
tags: Map<string, string[]>;
}
export interface TemplateValidationResult {
valid: boolean;
errors: TemplateValidationError[];
warnings: TemplateValidationWarning[];
}
export interface TemplateValidationError {
field: string;
message: string;
severity: 'error' | 'warning';
}
export interface TemplateValidationWarning {
field: string;
message: string;
suggestion?: string;
}
export interface TemplateHooks {
beforeGeneration?: (context: TemplateContext) => Promise<void>;
afterGeneration?: (result: TemplateGenerationResult) => Promise<void>;
beforeFileWrite?: (filePath: string, content: string) => Promise<string>;
afterFileWrite?: (filePath: string) => Promise<void>;
onError?: (error: Error) => Promise<void>;
}
export interface TemplateEngineConfig {
interpolationRegex?: RegExp;
conditionalRegex?: RegExp;
loopRegex?: RegExp;
includeRegex?: RegExp;
escapeHtml?: boolean;
strictMode?: boolean;
customHelpers?: Record<string, Function>;
}
export interface TypeScriptConfig {
target: string;
module: string;
strict: boolean;
esModuleInterop: boolean;
skipLibCheck: boolean;
forceConsistentCasingInFileNames: boolean;
declaration?: boolean;
sourceMap?: boolean;
outDir?: string;
rootDir?: string;
include?: string[];
exclude?: string[];
compilerOptions?: Record<string, any>;
}
export interface ESLintConfig {
env: Record<string, boolean>;
extends: string[];
parser?: string;
parserOptions?: Record<string, any>;
plugins?: string[];
rules: Record<string, any>;
overrides?: Array<{
files: string[];
rules?: Record<string, any>;
}>;
}
export interface PrettierConfig {
semi: boolean;
trailingComma: string;
singleQuote: boolean;
printWidth: number;
tabWidth: number;
useTabs: boolean;
[key: string]: any;
}
export interface DockerConfig {
baseImage: string;
workdir: string;
exposedPorts: number[];
volumes?: string[];
environment?: Record<string, string>;
buildArgs?: Record<string, string>;
healthcheck?: {
test: string[];
interval: string;
timeout: string;
retries: number;
};
}
export interface CICDConfig {
provider: 'github' | 'gitlab' | 'jenkins' | 'circleci' | 'azure';
triggers: string[];
jobs: CICDJob[];
environment?: Record<string, string>;
secrets?: string[];
}
export interface CICDJob {
name: string;
runsOn: string;
steps: CICDStep[];
needs?: string[];
if?: string;
environment?: Record<string, string>;
}
export interface CICDStep {
name: string;
uses?: string;
run?: string;
with?: Record<string, any>;
env?: Record<string, string>;
if?: string;
}