flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 2.53 kB
Source Map (JSON)
{"version":3,"file":"register.cjs","sources":["../../../src/cli/commands/register.ts"],"sourcesContent":["import { spawn } from \"child_process\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\nimport { automaticClassGenerationMessage, outputDir, processIdFile } from \"../consts\";\nimport { getConfig } from \"../utils/get-config\";\nimport { setupInit } from \"./setup-init\";\nimport { setupOutputDirectory } from \"./setup-output-directory\";\n\nexport async function register() {\n await setupOutputDirectory();\n const config = await getConfig();\n await setupInit(config);\n\n if (config.components.length) {\n console.warn(automaticClassGenerationMessage);\n }\n\n const processIdFilePath = path.join(outputDir, processIdFile);\n\n try {\n // clean up old process\n const pid = await fs.readFile(processIdFilePath, \"utf8\");\n process.kill(parseInt(pid, 10));\n await fs.unlink(processIdFilePath);\n } catch {\n //\n }\n\n try {\n // run `flowbite-react dev` in background\n const devProcess = spawn(\"flowbite-react\", [\"dev\"], {\n stdio: \"ignore\",\n detached: true,\n shell: true,\n });\n\n if (devProcess.pid) {\n await fs.writeFile(processIdFilePath, devProcess.pid.toString());\n }\n } catch (error) {\n console.error(\"Failed to register flowbite-react\", error);\n }\n\n process.exit();\n}\n"],"names":["setupOutputDirectory","getConfig","setupInit","automaticClassGenerationMessage","outputDir","processIdFile","spawn"],"mappings":";;;;;;;;;;AAQO,eAAe,QAAQ,GAAG;AACjC,EAAE,MAAMA,yCAAoB,EAAE;AAC9B,EAAE,MAAM,MAAM,GAAG,MAAMC,mBAAS,EAAE;AAClC,EAAE,MAAMC,mBAAS,CAAC,MAAM,CAAC;AACzB,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE;AAChC,IAAI,OAAO,CAAC,IAAI,CAACC,sCAA+B,CAAC;AACjD,EAAE;AACF,EAAE,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAACC,gBAAS,EAAEC,oBAAa,CAAC;AAC/D,EAAE,IAAI;AACN,IAAI,MAAM,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