export declare namespace Weshop { type Command = 'dev' | 'prod' | 'assemble' | 'build' | 'config' | 'init' | 'lint' | 'update' // repo interface Repo { url: string, branch?: string, tag?: string, isLocal?: boolean // 复制包的时候,确认是否为本地合包 } interface Dependency extends Repo { copy: { from: string, to: string }[] } // env type Env = 'dev' | 'test' | 'stage' | 'prod' | 'build' interface CDNOptions { publicPath: string, dirs?: boolean, // dirs 默认是 true,打包的时候会生成文件夹 maxSize?: number, excludes?: string[], dist?: string } interface UglifyOptions { dropConsole?: boolean, excludes?: string[] } interface EnvOptions { config: { appid: string, paasid: string, projectName: string, [key: string]: any }, cdn: CDNOptions, uglify: UglifyOptions } interface EnvConfig { dev: EnvOptions, test: EnvOptions, stage: EnvOptions, prod: EnvOptions, build: EnvOptions } interface wxFnConfig { Page: string } interface Config { type: 'mp' | 'miniprogram' | 'xtbg' | 'wangting', sshLimit: number, mainPackage: Repo, subPackages: Repo[], dependencies: Dependency[] env: EnvConfig, wxFn?: wxFnConfig, plugins?: Plugin[] } interface Plugin { name: string, options: Record } interface PluginModule { begin: (options: IAnyObject) => void end: (options: IAnyObject) => void } type IAnyObject = Record interface Dirs { projectDir: string, packagesDir: string, distDir: string, cacheDir: string, logDir: string } interface MainDepPath { rawPath: string, // 没转换前的路径 relativePath: string, // 基于当前文件夹的相对路径 absolutePath: string, // 基于根目录的绝对路径 resolvedPath: string // process.pwd } interface Log { packageName: string, url: string, branch: string, hash: string, author: string, message: string, date: string } // init 初始化 type initType = 'mp' | 'xtbg' | 'wangting' | 'weshop-plugin' type xtbgType = 'pc' | 'h5' type wangtingType = 'pc' type mpType = 'main' | 'sub' interface CliEngineOptions { cwd?: string } interface CliBaseOptions { verbose?: boolean quiet?: boolean checkVersion?: boolean } interface CliAssembleOptions extends CliBaseOptions { env: Env, debug: boolean, configPath: string } interface CliLintOptions extends CliBaseOptions { path: string } interface CliInitOptions extends CliBaseOptions { rootDir?: string, projectName: string, type: initType, mpType?: mpType, xtbgType?: xtbgType, wangtingType?: wangtingType, packageName?: string } } // 旧版本 Weshop 兼容 export declare namespace OldWeshop { interface Dependency { path?: string, repo: string, copyRootDir?: string, remotePaths: string[] } interface EnvConfig { dev: EnvInfo, test: EnvInfo, stage: EnvInfo, prod: EnvInfo, build: EnvInfo } interface EnvInfo { appid: string, projectName: string, paasid: string, [key: string]: any } interface CDNConfig { CDN_PUBLIC_PATH: string IMAGE_MAX_SIZE: number IGNORE_STATIC_FOLDERS: string[] } interface UglifyOptions { ignore?: string[], dropConsole?: boolean } interface Config { mainPackage: string subPackages: string[], dependencies: Dependency[], env: EnvConfig, CDN: CDNConfig, uglify: UglifyOptions } }