index.d.cts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. interface GitInfo {
  2. provider: "github" | "gitlab" | "bitbucket" | "sourcehut";
  3. repo: string;
  4. subdir: string;
  5. ref: string;
  6. }
  7. interface TemplateInfo {
  8. name: string;
  9. tar: string;
  10. version?: string;
  11. subdir?: string;
  12. url?: string;
  13. defaultDir?: string;
  14. headers?: Record<string, string | undefined>;
  15. source?: never;
  16. dir?: never;
  17. [key: string]: any;
  18. }
  19. type TemplateProvider = (input: string, options: {
  20. auth?: string;
  21. }) => TemplateInfo | Promise<TemplateInfo> | null;
  22. interface DownloadTemplateOptions {
  23. provider?: string;
  24. force?: boolean;
  25. forceClean?: boolean;
  26. offline?: boolean;
  27. preferOffline?: boolean;
  28. providers?: Record<string, TemplateProvider>;
  29. dir?: string;
  30. registry?: false | string;
  31. cwd?: string;
  32. auth?: string;
  33. install?: boolean;
  34. silent?: boolean;
  35. }
  36. type DownloadTemplateResult = Omit<TemplateInfo, "dir" | "source"> & {
  37. dir: string;
  38. source: string;
  39. };
  40. declare function downloadTemplate(input: string, options?: DownloadTemplateOptions): Promise<DownloadTemplateResult>;
  41. declare const registryProvider: (registryEndpoint?: string, options?: {
  42. auth?: string;
  43. }) => TemplateProvider;
  44. declare function startShell(cwd: string): void;
  45. export { type DownloadTemplateOptions, type DownloadTemplateResult, type GitInfo, type TemplateInfo, type TemplateProvider, downloadTemplate, registryProvider, startShell };