UNPKG

sb-mig

Version:

CLI to rule the world. (and handle stuff related to Storyblok CMS)

67 lines (66 loc) 2.54 kB
import type { RequestBaseConfig } from "../api/utils/request.js"; export declare const toImportSpecifier: (filePath: string, platform?: NodeJS.Platform) => string; /** * Asynchronously load a file using dynamic import * Returns the default export of the module * * @param data - Object containing the file path * @returns The default export of the imported module */ export declare const getFileContent: (data: { file: string; }) => any; /** * Synchronously load a file using require * Handles both CommonJS and ES modules with default exports * * @param data - Object containing the file path * @returns The file content (default export if available) */ export declare const getFileContentWithRequire: (data: { file: string; }) => any; /** * Load multiple files using require * * @param data - Object containing array of file paths * @returns Array of file contents */ export declare const getFilesContentWithRequire: (data: { files: string[]; }) => any[]; /** * Read and parse the package.json from current working directory * * @returns Parsed package.json object */ export declare const getPackageJson: () => any; export declare const isDirectoryExists: (path: string) => boolean; export declare const createDir: (dirPath: string) => Promise<void>; export declare const createJsonFile: (content: string, pathWithFilename: string) => Promise<void>; export declare const createJSAllComponentsFile: (content: string, pathWithFilename: string, timestamp?: boolean) => Promise<void>; export declare const copyFolder: (src: string, dest: string) => Promise<unknown>; export declare const copyFile: (src: string, dest: string) => Promise<void>; type CreateAndSaveComponentListToFile = (args: { file?: string; folder?: string; res: any; timestamp?: boolean; }, config: RequestBaseConfig) => Promise<void>; type CreateAndSaveToFile = (args: { ext?: string; datestamp?: boolean; prefix?: string; suffix?: string; path?: string; filename?: string; folder?: string; res: any; }, config: RequestBaseConfig) => void; export declare const createAndSaveToFile: CreateAndSaveToFile; export declare const createAndSaveComponentListToFile: CreateAndSaveComponentListToFile; export declare const readFile: (pathToFile: string) => Promise<string | undefined>; export declare const dumpToFile: (path: string, content: string) => Promise<void>; export declare const getConsumerPackageJson: () => Promise<any>; export declare const getSbMigPackageJson: () => Promise<any>; export {};