UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 1.79 kB
{"version":3,"file":"setup-gitignore.cjs","sources":["../../../src/cli/commands/setup-gitignore.ts"],"sourcesContent":["import fs from \"fs/promises\";\nimport { classListFile, gitIgnoreFilePath, processIdFile } from \"../consts\";\n\n/**\n * Sets up the `.flowbite-react/.gitignore` file in the project.\n *\n * This function ensures the `.gitignore` file exists in the `.flowbite-react` directory.\n * It will create or update the file if needed.\n */\nexport async function setupGitIgnore() {\n const content = `${classListFile}\\n${processIdFile}`;\n\n try {\n let currentContent: string;\n try {\n currentContent = await fs.readFile(gitIgnoreFilePath, \"utf-8\");\n } catch {\n currentContent = \"\";\n }\n\n if (currentContent.trimEnd() !== content) {\n console.log(`${currentContent ? \"Updating\" : \"Creating\"} ${gitIgnoreFilePath} file...`);\n setTimeout(() => fs.writeFile(gitIgnoreFilePath, content), 10);\n }\n } catch (error) {\n console.error(`Failed to update ${gitIgnoreFilePath}:`, error);\n }\n}\n"],"names":["classListFile","processIdFile","gitIgnoreFilePath"],"mappings":";;;;;AAGO,eAAe,cAAc,GAAG;AACvC,EAAE,MAAM,OAAO,GAAG,CAAC,EAAEA,oBAAa;AAClC,EAAEC,oBAAa,CAAC,CAAC;AACjB,EAAE,IAAI;AACN,IAAI,IAAI,cAAc;AACtB,IAAI,IAAI;AACR,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC,QAAQ,CAACC,wBAAiB,EAAE,OAAO,CAAC;AACpE,KAAK,CAAC,MAAM;AACZ,MAAM,cAAc,GAAG,EAAE;AACzB;AACA,IAAI,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,OAAO,EAAE;AAC9C,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC,EAAEA,wBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC7F,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,SAAS,CAACA,wBAAiB,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC;AACpE;AACA,GAAG,CAAC,OAAO,KAAK,EAAE;AAClB,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAEA,wBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;AAClE;AACA;;;;"}