{"id":32558363,"url":"https://github.com/shellicar/build-clean","last_synced_at":"2026-01-20T17:30:25.685Z","repository":{"id":310620935,"uuid":"1040593744","full_name":"shellicar/build-clean","owner":"shellicar","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-24T06:18:57.000Z","size":320,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-24T08:18:44.095Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shellicar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-19T08:07:22.000Z","updated_at":"2025-10-24T06:18:42.000Z","dependencies_parsed_at":"2025-08-19T09:38:06.485Z","dependency_job_id":"ef5a37e5-afbe-4527-b473-56ce91f1baac","html_url":"https://github.com/shellicar/build-clean","commit_stats":null,"previous_names":["shellicar/build-clean"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/shellicar/build-clean","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fbuild-clean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fbuild-clean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fbuild-clean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fbuild-clean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellicar","download_url":"https://codeload.github.com/shellicar/build-clean/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fbuild-clean/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281533443,"owners_count":26517827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-28T23:54:30.993Z","updated_at":"2025-10-28T23:55:31.826Z","avatar_url":"https://github.com/shellicar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @shellicar/build-clean\n\n[![npm package](https://img.shields.io/npm/v/@shellicar/build-clean.svg)](https://npmjs.com/package/@shellicar/build-clean)\n[![build status](https://github.com/shellicar/build-clean/actions/workflows/node.js.yml/badge.svg)](https://github.com/shellicar/build-clean/actions/workflows/node.js.yml)\n\nBuild plugin that automatically cleans unused files from output directories.\n\n- 🧹 **Cleans after build** - Removes unused files without deleting the entire output directory\n- 🛡️ **Safe by default** - Dry-run mode, requires explicit destructive flag  \n- 🔧 **Watch mode friendly** - No period with empty output directory\n\n## Installation \u0026 Quick Start\n\n```sh\nnpm i --save-dev @shellicar/build-clean\n```\n\n```sh\npnpm add -D @shellicar/build-clean\n```\n\n### esbuild\n\n```ts\nimport cleanPlugin from '@shellicar/build-clean/esbuild'\nimport { build } from 'esbuild'\n\nawait build({\n  entryPoints: ['src/main.ts'],\n  outdir: 'dist',\n  plugins: [\n    cleanPlugin({\n      // Required to actually delete files\n      destructive: true\n    })\n  ]\n})\n```\n\n### tsup\n\n```ts\n// tsup.config.ts\nimport cleanPlugin from '@shellicar/build-clean/esbuild'\nimport { defineConfig } from 'tsup'\n\nexport default defineConfig({\n  entry: ['src/index.ts'],\n  // Important: disable tsup's clean\n  clean: false,\n  esbuildPlugins: [\n    cleanPlugin({\n      destructive: true,\n      verbose: true\n    })\n  ]\n})\n```\n\n\u003c!-- BEGIN_ECOSYSTEM --\u003e\n\n## @shellicar TypeScript Ecosystem\n\n### Core Libraries\n\n- [`@shellicar/core-config`](https://github.com/shellicar/core-config) - A library for securely handling sensitive configuration values like connection strings, URLs, and secrets.\n- [`@shellicar/core-di`](https://github.com/shellicar/core-di) - A basic dependency injection library.\n\n### Reference Architectures\n\n- [`@shellicar/reference-foundation`](https://github.com/shellicar/reference-foundation) - A comprehensive starter repository. Illustrates individual concepts.\n- [`@shellicar/reference-enterprise`](https://github.com/shellicar/reference-enterprise) - A comprehensive starter repository. Can be used as the basis for creating a new Azure application workload.\n\n### Build Tools\n\n- [`@shellicar/build-clean`](https://github.com/shellicar/build-clean) - Build plugin that automatically cleans unused files from output directories.\n- [`@shellicar/build-version`](https://github.com/shellicar/build-version) - Build plugin that calculates and exposes version information through a virtual module import.\n- [`@shellicar/build-graphql`](https://github.com/shellicar/build-graphql) - Build plugin that loads GraphQL files and makes them available through a virtual module import.\n\n### Framework Adapters\n\n- [`@shellicar/svelte-adapter-azure-functions`](https://github.com/shellicar/svelte-adapter-azure-functions) - A [SvelteKit adapter](https://kit.svelte.dev/docs/adapters) that builds your app into an Azure Function.\n- [`@shellicar/cosmos-query-builder`](https://github.com/shellicar/cosmos-query-builder) - Helper class for type safe advanced queries for Cosmos DB (Sql Core).\n\n### Logging \u0026 Monitoring\n\n- [`@shellicar/winston-azure-application-insights`](https://github.com/shellicar/winston-azure-application-insights) - An [Azure Application Insights](https://azure.microsoft.com/en-us/services/application-insights/) transport for [Winston](https://github.com/winstonjs/winston) logging library.\n- [`@shellicar/pino-applicationinsights-transport`](https://github.com/shellicar/pino-applicationinsights-transport) - [Azure Application Insights](https://azure.microsoft.com/en-us/services/application-insights) transport for [pino](https://github.com/pinojs/pino)\n\n\u003c!-- END_ECOSYSTEM --\u003e\n\n## Motivation\n\nExisting solutions like tsup's `clean: true` delete the entire output directory, which causes issues:\n\n- **Watch mode problems** - Other projects depending on these files can break when the directory is temporarily empty\n- **Debugger performance** - Extra JavaScript files slow down Node.js debuggers when mapping to TypeScript sources, sometimes causing crashes\n\nThis plugin cleans after the build completes, removing only unused files while keeping the directory intact.\n\n## Options\n\n```ts\ninterface Options {\n  /** Show detailed debug information */\n  debug?: boolean\n  \n  /** Show verbose file-by-file processing */\n  verbose?: boolean\n  \n  /** Actually delete files (default: false for safety) */\n  destructive?: boolean\n}\n```\n\n## Other Build Tools\n\nThe plugin supports other tools via [unplugin](https://github.com/unjs/unplugin):\n\n```ts\n// vite.config.ts\nimport cleanPlugin from '@shellicar/build-clean/vite'\n\nexport default defineConfig({\n  plugins: [cleanPlugin({ destructive: true })]\n})\n```\n\n## Credits \u0026 Inspiration\n\n- [tsup](https://github.com/egoist/tsup)\n- [esbuild](https://github.com/evanw/esbuild)\n- [esbuild-clean-plugin](https://github.com/LinbuduLab/esbuild-plugins/tree/main/packages/esbuild-plugin-clean)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellicar%2Fbuild-clean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellicar%2Fbuild-clean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellicar%2Fbuild-clean/lists"}