flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
40 lines (36 loc) • 1.19 kB
JavaScript
;
var child_process = require('child_process');
var fs = require('fs/promises');
var path = require('path');
var consts = require('../consts.cjs');
var getConfig = require('../utils/get-config.cjs');
var setupOutputDirectory = require('./setup-output-directory.cjs');
async function register() {
const config = await getConfig.getConfig();
if (config.components.length) {
console.warn(consts.automaticClassGenerationMessage);
}
const processIdFilePath = path.join(consts.outputDir, consts.processIdFile);
try {
const pid = await fs.readFile(processIdFilePath, "utf8");
process.kill(parseInt(pid, 10));
await fs.unlink(processIdFilePath);
} catch {
}
try {
const devProcess = child_process.spawn("flowbite-react", ["dev"], {
stdio: "ignore",
detached: true,
shell: true
});
await setupOutputDirectory.setupOutputDirectory();
if (devProcess.pid) {
await fs.writeFile(processIdFilePath, devProcess.pid.toString(), { flag: "w" });
}
} catch (error) {
console.error("Failed to register flowbite-react", error);
}
process.exit();
}
exports.register = register;
//# sourceMappingURL=register.cjs.map