Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/so1ve/unplugin-todo-or-die

TODO or Die plugin for JavaScript :)
https://github.com/so1ve/unplugin-todo-or-die

astro javascript quasar rollup rspack todo typescript unplugin vite webpack

Last synced: 19 days ago
JSON representation

TODO or Die plugin for JavaScript :)

Awesome Lists containing this project

README

        

# unplugin-todo-or-die

[![NPM version](https://img.shields.io/npm/v/unplugin-todo-or-die?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-todo-or-die)

> TODO or DIEEEEEEE!!!!!!!!!!!!!

This plugin turns these TODO comments:

```ts
// TODO::expires(2021-01-01): do something
// TODO::expire(2021-01-01): do something
```

Into such code:

```ts
if (Date.now() > 1_704_067_200_000) {
throw new Error("TODO expired: do something");
}
```

## 📦 Installation

```bash
$ npm install -D unplugin-todo-or-die
$ yarn add -D unplugin-todo-or-die
$ pnpm add -D unplugin-todo-or-die
```

## 🚀 Usage

Vite

```ts
// vite.config.ts
import TodoOrDie from "unplugin-todo-or-die/vite";

export default defineConfig({
plugins: [
TodoOrDie({
/* options */
}),
],
});
```


Rollup

```ts
// rollup.config.js
import TodoOrDie from "unplugin-todo-or-die/rollup";

export default {
plugins: [
TodoOrDie({
/* options */
}),
// other plugins
],
};
```


Webpack

```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require("unplugin-todo-or-die/webpack")({
/* options */
}),
],
};
```


Nuxt

```ts
// nuxt.config.ts
export default defineNuxtConfig({
modules: ["unplugin-todo-or-die/nuxt"],
});
```


Vue CLI

```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require("unplugin-todo-or-die/webpack")({
/* options */
}),
],
},
};
```


Quasar

```ts
// quasar.conf.js [Vite]
module.exports = {
vitePlugins: [
[
"unplugin-todo-or-die/vite",
{
/* options */
},
],
],
};
```

```ts
// quasar.conf.js [Webpack]
const TodoOrDiePlugin = require("unplugin-todo-or-die/webpack");

module.exports = {
build: {
chainWebpack(chain) {
chain.plugin("unplugin-todo-or-die").use(
TodoOrDiePlugin({
/* options */
}),
);
},
},
};
```


esbuild

```ts
// esbuild.config.js
import { build } from "esbuild";

build({
/* ... */
plugins: [
require("unplugin-todo-or-die/esbuild")({
/* options */
}),
],
});
```


Astro

```ts
// astro.config.mjs
import TodoOrDie from "unplugin-todo-or-die/astro";

export default defineConfig({
integrations: [
TodoOrDie({
/* options */
}),
],
});
```


## 🖥️ Credits

Original version (ruby): https://github.com/searls/todo_or_die

## 📝 License

[MIT](./LICENSE). Made with ❤️ by [Ray](https://github.com/so1ve)