From 6196401cac8fe0067af7d9d7a4e2df69ca8f6fd2 Mon Sep 17 00:00:00 2001
From: Anton Gilgur <agilgur5@gmail.com>
Date: Wed, 12 Oct 2022 20:20:36 -0400
Subject: [PATCH] env: dogfood rpt2 as a `configPlugin` w/ `rollup.config.ts`

- use rpt2 as a `configPlugin` within our own build process, as well as to build itself
  - doubly dogfood

- we don't have any tests for `configPlugin`s, and it's a Rollup CLI option, so this is one of the few ways to test it
  - create a helper `_build-self` script so we don't need to type/repeat as much (or have as much potential for mistakes)

NOTE: this commit fails to build, need to make some more adjustments to the base config to get it to work in TS
- will do that in the next commits so that it's easier to read/differentiate/review
---
 package.json                                   | 7 ++++---
 rollup.config.base.js => rollup.config.base.ts | 0
 rollup.config.self.js => rollup.config.self.ts | 0
 rollup.config.js => rollup.config.ts           | 0
 4 files changed, 4 insertions(+), 3 deletions(-)
 rename rollup.config.base.js => rollup.config.base.ts (100%)
 rename rollup.config.self.js => rollup.config.self.ts (100%)
 rename rollup.config.js => rollup.config.ts (100%)

diff --git a/package.json b/package.json
index 4a50454b..888adc55 100644
--- a/package.json
+++ b/package.json
@@ -23,9 +23,10 @@
   "author": "@ezolenko",
   "scripts": {
     "prebuild": "rimraf dist/*",
-    "build": "rimraf dist/* && rollup -c",
-    "watch": "rollup -c rollup.config.self.js -w ",
-    "build-self": "rimraf dist/* && rollup -c rollup.config.self.js",
+    "build": "rollup -c rollup.config.ts --configPlugin typescript2",
+    "_build-self": "rollup -c rollup.config.self.ts --configPlugin ./build-self/dist/rollup-plugin-typescript2.es",
+    "watch": "npm run _build-self -- -w ",
+    "build-self": "rimraf dist/* && npm run _build-self",
     "lint": "tslint -c ./tslint.json src/*.ts __tests__/*.ts ./*.js",
     "test": "jest",
     "test:watch": "jest --watch",
diff --git a/rollup.config.base.js b/rollup.config.base.ts
similarity index 100%
rename from rollup.config.base.js
rename to rollup.config.base.ts
diff --git a/rollup.config.self.js b/rollup.config.self.ts
similarity index 100%
rename from rollup.config.self.js
rename to rollup.config.self.ts
diff --git a/rollup.config.js b/rollup.config.ts
similarity index 100%
rename from rollup.config.js
rename to rollup.config.ts