frontity
Version:
Frontity cli and entry point to other packages
110 lines (109 loc) • 3.88 kB
TypeScript
import { CreateCommandOptions } from "./types";
/**
* This function normalizes and validates options.
*
* @param defaultOptions - The default options. Defined in {@link
* CreateCommandOptions}.
* @param passedOptions - The options from the user. Defined in {@link
* CreateCommandOptions}.
*
* @returns The final options, normalized. Defined in {@link
* CreateCommandOptions}.
*/
export declare const normalizeOptions: (defaultOptions: CreateCommandOptions, passedOptions: CreateCommandOptions) => CreateCommandOptions;
/**
* This function ensures the path exists and checks if it's empty or it's a new
* repo. Also returns a boolean indicating if the directory existed already.
*
* @param path - The path where the project will be installed.
*
* @returns A promise that resolves once the check has been made.
*/
export declare const ensureProjectDir: (path: string) => Promise<boolean>;
/**
* Create a `package.json` file.
*
* @param name - The name of the project.
* @param theme - The theme that will be cloned and installed locally.
* @param path - The path where the file will be created.
* @param typescript - Indicates if the typescript flag is active.
*/
export declare const createPackageJson: (name: string, theme: string, path: string, typescript: boolean) => Promise<void>;
/**
* Create a `README.md` file.
*
* @param name - The name of the project.
* @param path - The path where the file will be created.
*/
export declare const createReadme: (name: string, path: string) => Promise<void>;
/**
* Create a `frontity.settings` file.
*
* @param extension - The extension of the file, either `.js` or `.ts`.
* @param name - The name of the project.
* @param path - The path where the file will be created.
* @param theme - The theme installed in the project.
*/
export declare const createFrontitySettings: (extension: string, name: string, path: string, theme: string) => Promise<void>;
/**
* Create a `tsconfig.json` file.
*
* @param path - The path where the file will be created.
*/
export declare const createTsConfig: (path: string) => Promise<void>;
/**
* Clone the starter theme.
*
* @param theme - The name of the theme.
* @param path - The path where it needs to be installed.
*/
export declare const cloneStarterTheme: (theme: string, path: string) => Promise<void>;
/**
* Install the Frontity packages.
*
* @param path - The location where `npm install` should be run.
*/
export declare const installDependencies: (path: string) => Promise<void>;
/**
* Downlaod the favicon file.
*
* @param path - The path where the favicon should be downloaded.
*/
export declare const downloadFavicon: (path: string) => Promise<void>;
/**
* Initializes a new git repository.
*
* @param path - The path where git should be initialized.
*/
export declare const initializeGit: (path: string) => Promise<void>;
/**
* Creates a .gitignore file.
*
* @param path - The path where .gitignore file should be created.
* @returns - A promise which resolves with a cleanup function which
* should be called if any subsequent step fails.
*/
export declare const createGitignore: (path: string) => Promise<() => Promise<void>>;
/**
* Remove the files and directories created with `frontity create` in case there
* was a problem and we need to revert everything.
*
* @param dirExisted - If the directory existed already.
* @param path - The path of the direcotry.
*/
export declare const revertProgress: (dirExisted: boolean, path: string) => Promise<void>;
/**
* Check if an email is valid or not.
*
* @param email - The email to be checked.
*
* @returns True or false depending if the email is valid.
*/
/**
* Subscribe an email to the newsletter service.
*
* @param email - The email to be subscribed.
*
* @returns The response of the subscription.
*/
export declare const subscribe: () => Promise<never>;