multipassify-ts
Version:
This is an example TypeScript Package ready to be published on npm. It has been set up with automated tests and package publishing workflow using GitHub Actions CI/CD. It is made primarily for GitHub + VS Code (Windows / Mac / Linux) users who are about t
30 lines (26 loc) • 812 B
JavaScript
/* eslint-disable */
const fs = require('fs')
const Path = require('path')
/* eslint-enable */
const deleteFolderRecursive = (path) => {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach((file) => {
const curPath = Path.join(path, file)
if (fs.lstatSync(curPath).isDirectory()) {
deleteFolderRecursive(curPath)
} else {
fs.unlinkSync(curPath)
}
})
fs.rmdirSync(path)
}
}
const folder = process.argv.slice(2)[0]
if (folder) {
deleteFolderRecursive(Path.join(__dirname, '../dist', folder))
} else {
deleteFolderRecursive(Path.join(__dirname, '../dist/cjs'))
deleteFolderRecursive(Path.join(__dirname, '../dist/esm'))
deleteFolderRecursive(Path.join(__dirname, '../dist/umd'))
deleteFolderRecursive(Path.join(__dirname, '../dist/types'))
}