lightswind
Version:
A professionally designed animate react component library & templates market that brings together functionality, accessibility, and beautiful aesthetics for modern applications.
57 lines (50 loc) • 1.85 kB
JavaScript
const fs = require("fs-extra");
const path = require("path");
const args = process.argv.slice(2);
const componentArg = args[0];
const libFrom = path.join(__dirname, "dist", "components","lib");
const libTo = path.join(process.cwd(), "src", "components", "lib");
const styleFrom = path.join(__dirname, "dist", "components", "styles", "lightswind.css");
const styleToDir = path.join(process.cwd(), "src","components", "lightswind.css");
if (componentArg) {
// Install single component
const fileName = `${componentArg}.js`;
const fromComponent = path.join(__dirname, "dist", "components", "ui", fileName);
const toComponent = path.join(
process.cwd(),
"src",
"components",
"lightswind",
fileName
);
if (fs.existsSync(fromComponent)) {
fs.ensureDirSync(path.dirname(toComponent));
fs.copyFileSync(fromComponent, toComponent);
console.log(`✅ Installed component: ${fileName}`);
} else {
console.error(`❌ Component '${componentArg}' not found.`);
process.exit(1);
}
if (fs.existsSync(libFrom,styleFrom)) {
fs.ensureDirSync(libTo, styleToDir);
fs.copySync(libFrom, libTo);
fs.copySync(styleFrom, styleToDir);
console.log(`✅ Installed shared utils`);
}
} else {
// Install all components
const allFrom = path.join(__dirname, "dist", "components", "ui");
const allTo = path.join(process.cwd(), "src", "components", "lightswind");
if (fs.existsSync(allFrom)) {
fs.ensureDirSync(allTo);
fs.copySync(allFrom, allTo);
console.log(`✅ Installed all components`);
}
if (fs.existsSync(libFrom, styleFrom)) {
fs.ensureDirSync(libTo, styleToDir);
fs.copySync(libFrom, libTo);
fs.copySync(styleFrom, styleToDir);
console.log(`✅ Installed shared utils`);
}
}