INNER CODE UNIT · TypeScript
cleanComponent
Serverless-Devs/Serverless-Devs · src/command/clean/index.ts:44
function cleanComponent(component: string | boolean) {
const sPath = getRootHome();
const componentsPath = path.join(sPath, 'components');
if (component === true) {
rimraf.sync(componentsPath);
logger.info('Component cleaned up successfully.');
return;
}
const p = path.join(componentsPath, 'devsapp.cn', component as string);
if (!fs.existsSync(p)) {
return logger.tips(`Component [${component}] does not exist.`, 'Please check whether the component has been downloaded.');
}
rimraf.sync(p);
logger.info(`Component [${component}] has been cleaned up successfully.`);
}
export default (program: Command) => {