UNPKG

ui-thing

Version:

CLI used to add Nuxt 3 components to a project

37 lines (32 loc) 955 B
import { UIConfig } from "../types"; import { getUIConfig } from "./config"; /** * Compares the UI config with a temporary config to see if any properties are missing * @returns {boolean} - Returns true if all properties are present */ export const compareUIConfig = async () => { // Get ui config let userConfig: UIConfig = await getUIConfig(); const tempConfig: UIConfig = { nuxtVersion: 3, theme: "string", tailwindCSSLocation: "string", tailwindConfigLocation: "string", componentsLocation: "string", composablesLocation: "string", utilsLocation: "string", force: true, useDefaultFilename: true, packageManager: "string", }; const missingProperties: string[] = []; for (const key of Object.keys(tempConfig)) { if (userConfig[key as keyof UIConfig] === undefined) { missingProperties.push(key); } } if (missingProperties.length > 0) { return false; } return true; };