sdin
Version:
JavaScript package builder.
29 lines (28 loc) • 1.01 kB
TypeScript
export interface PackageInfo extends Record<string, any> {
/** 包名称 */
name: string;
/** 版本 */
version: string;
/** 描述 */
description: string;
/** "xxx <xxx@xxx.xxx>"*/
author: string;
/** "xxx" */
authorName: string;
/** "xxx@xxx.xxx" */
authorEmail: string;
}
export declare const PACKAGE_INFO: PackageInfo;
export declare const PACKAGE_INFO_FILE_NAME = "package.json";
/**
* 获取给定文件所属包的根目录
*/
export declare function getPackageRootPath(path: string): string;
/**
* 根据文件夹目录,获取包的信息
*/
export declare function readPackageInfo(root: string, strict: true): PackageInfo;
export declare function readPackageInfo(root: string, strict?: false): PackageInfo | undefined;
export declare function getDependenceName(importedPath: string): string;
export declare function getDependenceVersion(pkg: PackageInfo, dep: string): string;
export declare function downloadModules(root: string): Promise<void>;