Repository: ioBroker/create-adapter
Pull request #815 (2021-09-06 11:18:25)

Modernize TSConfig, require Node 12.20 for ESM support
As part of #757, the creator itself now requires Node 12.20 for full ESM support. To simplify configuration, I've changed the tsconfig to extend `@tsconfig/bases` where we just need to install the correct template for the Node version we want to target (currently Node 12). This does not affect the generated adapters, which still support Node 10.

I've taken the chance to modernize the tsconfig a bit and avoid runtime imports when we only import types.


Patch:
diff --git a/.eslintignore b/.eslintignore
index fae1bc1..25ad6ad 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,1 +1,4 @@
+build/
 test/baselines/
+.eslintrc.js
+.prettierrc.js
diff --git a/.eslintrc.js b/.eslintrc.js
index 878bdc1..a4030c3 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,7 +1,7 @@
 module.exports = {
 	parser: "@typescript-eslint/parser", // Specifies the ESLint parser
 	parserOptions: {
-		ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
+		ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features
 		sourceType: "module", // Allows for the use of imports
 		project: "./tsconfig.json",
 	},
diff --git a/.github/create_pullrequest.ts b/.github/create_pullrequest.ts
index 8f70d50..bf81104 100644
--- a/.github/create_pullrequest.ts
+++ b/.github/create_pullrequest.ts
@@ -25,7 +25,7 @@ const options: AxiosRequestConfig = {
 				base: "master",
 			},
 		});
-	} catch (e) {
+	} catch (e: any) {
 		createPrResponse = e.response;
 		console.error(
 			red(`PR creation failed with code ${createPrResponse.status}:
diff --git a/.github/create_templates.ts b/.github/create_templates.ts
index bcde259..a6a8aff 100644
--- a/.github/create_templates.ts
+++ b/.github/create_templates.ts
@@ -3,7 +3,7 @@ import { execSync, ExecSyncOptions } from "child_process";
 import * as fs from "fs-extra";
 import * as path from "path";
 import { createAdapter } from "../src";
-import { Answers } from "../src/lib/core/questions";
+import type { Answers } from "../src/lib/core/questions";
 import { writeFiles } from "../src/lib/createAdapter";
 
 const outDir = path.join(process.cwd(), "ioBroker.template");
diff --git a/LICENSE b/LICENSE
index 8d277a4..894ce5e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2018-2020 AlCalzone
+Copyright (c) 2018-2021 AlCalzone
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/maintenance/cacheLicenses.ts b/maintenance/cacheLicenses.ts
index b3632e2..5784d84 100644
--- a/maintenance/cacheLicenses.ts
+++ b/maintenance/cacheLicenses.ts
@@ -5,7 +5,7 @@ import axios, { AxiosRequestConfig } from "axios";
 import * as fs from "fs-extra";
 import * as path from "path";
 import * as yargs from "yargs";
-import { License } from "../src/lib/core/licenses";
+import type { License } from "../src/lib/core/licenses";
 import { applyHttpsProxy, getRequestTimeout } from "../src/lib/tools";
 
 // Taken from https://api.github.com/licenses
diff --git a/maintenance/generateTemplateIndex.ts b/maintenance/generateTemplateIndex.ts
index f77c5c1..7a6cd60 100644
--- a/maintenance/generateTemplateIndex.ts
+++ b/maintenance/generateTemplateIndex.ts
@@ -41,7 +41,7 @@ const indexContent = `
 // and contains references to all defined templates.
 // Do not edit it by hand or your changes will be lost!
 
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templates: { name: string, templateFunction: TemplateFunction }[] = [
 ${templatePaths.join(os.EOL)}
diff --git a/package.json b/package.json
index 5d873d7..3a9e9d8 100644
--- a/package.json
+++ b/package.json
@@ -27,13 +27,14 @@
     "url": "https://github.com/ioBroker/create-adapter/issues"
   },
   "engines": {
-    "node": ">=12"
+    "node": ">=12.20"
   },
   "publishConfig": {
     "access": "public"
   },
   "devDependencies": {
     "@alcalzone/release-script": "^1.10.0",
+    "@tsconfig/node12": "^1.0.9",
     "@types/ansi-colors": "^3.2.2",
     "@types/chai": "^4.2.19",
     "@types/chai-as-promised": "^7.1.4",
diff --git a/src/cli.ts b/src/cli.ts
index 7adc3ff..9ddd83c 100644
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -3,8 +3,8 @@ import { prompt } from "enquirer";
 import * as fs from "fs-extra";
 import * as path from "path";
 import * as yargs from "yargs";
-import { CheckResult } from "./lib/core/actionsAndTransformers";
-import { MigrationContextBase } from "./lib/core/migrationContextBase";
+import type { CheckResult } from "./lib/core/actionsAndTransformers";
+import type { MigrationContextBase } from "./lib/core/migrationContextBase";
 import {
 	Answers,
 	Question,
diff --git a/src/lib/core/actionsAndTransformers.ts b/src/lib/core/actionsAndTransformers.ts
index fdde744..7c4a02e 100644
--- a/src/lib/core/actionsAndTransformers.ts
+++ b/src/lib/core/actionsAndTransformers.ts
@@ -1,5 +1,5 @@
 import { yellow } from "ansi-colors";
-import { Answers } from "./questions";
+import type { Answers } from "./questions";
 
 const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
 
diff --git a/src/lib/core/questions.ts b/src/lib/core/questions.ts
index c49829c..2deed52 100644
--- a/src/lib/core/questions.ts
+++ b/src/lib/core/questions.ts
@@ -1,6 +1,6 @@
 import { isArray } from "alcalzone-shared/typeguards";
 import { dim, gray, green } from "ansi-colors";
-import { SpecificPromptOptions } from "enquirer";
+import type { SpecificPromptOptions } from "enquirer";
 import {
 	checkAdapterName,
 	checkAuthorName,
@@ -15,7 +15,7 @@ import {
 	transformKeywords,
 } from "./actionsAndTransformers";
 import { licenses } from "./licenses";
-import { MigrationContextBase } from "./migrationContextBase";
+import type { MigrationContextBase } from "./migrationContextBase";
 
 // This is being used to simulate wrong options for conditions on the type level
 const __misused: unique symbol = Symbol.for("__misused");
diff --git a/src/lib/createAdapter.ts b/src/lib/createAdapter.ts
index f7eb941..79e2f49 100644
--- a/src/lib/createAdapter.ts
+++ b/src/lib/createAdapter.ts
@@ -1,8 +1,8 @@
 import * as fs from "fs-extra";
 import * as os from "os";
 import * as path from "path";
-import * as templateFiles from "../../templates";
-import { Answers } from "./core/questions";
+import templateFiles from "../../templates";
+import type { Answers } from "./core/questions";
 import {
 	formatWithPrettier,
 	getOwnVersion,
diff --git a/src/lib/tools.ts b/src/lib/tools.ts
index b233e40..c8e6625 100644
--- a/src/lib/tools.ts
+++ b/src/lib/tools.ts
@@ -9,8 +9,9 @@ import * as JSON5 from "json5";
 import * as os from "os";
 import * as path from "path";
 import * as prettier from "prettier";
+import { URL } from "url";
 import { licenses } from "./core/licenses";
-import { Answers } from "./core/questions";
+import type { Answers } from "./core/questions";
 
 export function error(message: string): void {
 	console.error(bold.red(message));
diff --git a/src/lib/translation.ts b/src/lib/translation.ts
index 5af91d1..7eaf8e0 100644
--- a/src/lib/translation.ts
+++ b/src/lib/translation.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, Answers, getDefaultAnswer } from "./core/questions";
-import { TemplateFunction } from "./createAdapter";
+import type { TemplateFunction } from "./createAdapter";
 import { formatJsonString, translateText } from "./tools";
 
 export type Languages =
diff --git a/templates/LICENSE.ts b/templates/LICENSE.ts
index 09e9183..ba8e8b7 100644
--- a/templates/LICENSE.ts
+++ b/templates/LICENSE.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 import { getFormattedLicense } from "../src/lib/tools";
 
 export = (answers => {
diff --git a/templates/README.md.ts b/templates/README.md.ts
index 0659476..703233e 100644
--- a/templates/README.md.ts
+++ b/templates/README.md.ts
@@ -1,5 +1,5 @@
 import { getIconName } from "../src/lib/core/questions";
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 import { getFormattedLicense } from "../src/lib/tools";
 
 export = (answers => {
diff --git a/templates/_babelrc.ts b/templates/_babelrc.ts
index 410e5e5..db2ad8b 100644
--- a/templates/_babelrc.ts
+++ b/templates/_babelrc.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_create-adapter.json.ts b/templates/_create-adapter.json.ts
index dd0b8a2..24c02c7 100644
--- a/templates/_create-adapter.json.ts
+++ b/templates/_create-adapter.json.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_devcontainer/README.md.ts b/templates/_devcontainer/README.md.ts
index 0052358..c2a61e8 100644
--- a/templates/_devcontainer/README.md.ts
+++ b/templates/_devcontainer/README.md.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_devcontainer/devcontainer.json.ts b/templates/_devcontainer/devcontainer.json.ts
index 83ab90d..85d6e50 100644
--- a/templates/_devcontainer/devcontainer.json.ts
+++ b/templates/_devcontainer/devcontainer.json.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_devcontainer/docker-compose.yml.ts b/templates/_devcontainer/docker-compose.yml.ts
index 556cf8f..b43cc0c 100644
--- a/templates/_devcontainer/docker-compose.yml.ts
+++ b/templates/_devcontainer/docker-compose.yml.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_devcontainer/iobroker/_Dockerfile.ts b/templates/_devcontainer/iobroker/_Dockerfile.ts
index 72e90a6..2ca8669 100644
--- a/templates/_devcontainer/iobroker/_Dockerfile.ts
+++ b/templates/_devcontainer/iobroker/_Dockerfile.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_devcontainer/nginx/nginx.conf.ts b/templates/_devcontainer/nginx/nginx.conf.ts
index 055f869..cca658c 100644
--- a/templates/_devcontainer/nginx/nginx.conf.ts
+++ b/templates/_devcontainer/nginx/nginx.conf.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_devcontainer/parcel/_Dockerfile.ts b/templates/_devcontainer/parcel/_Dockerfile.ts
index 9d5d073..562bb45 100644
--- a/templates/_devcontainer/parcel/_Dockerfile.ts
+++ b/templates/_devcontainer/parcel/_Dockerfile.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_devcontainer/parcel/run.sh.ts b/templates/_devcontainer/parcel/run.sh.ts
index 7ccec46..6b174a8 100644
--- a/templates/_devcontainer/parcel/run.sh.ts
+++ b/templates/_devcontainer/parcel/run.sh.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_eslintignore.ts b/templates/_eslintignore.ts
index 129869a..0cfc4da 100644
--- a/templates/_eslintignore.ts
+++ b/templates/_eslintignore.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_eslintrc_javascript.json.ts b/templates/_eslintrc_javascript.json.ts
index 11bef58..89cfcf9 100644
--- a/templates/_eslintrc_javascript.json.ts
+++ b/templates/_eslintrc_javascript.json.ts
@@ -1,5 +1,5 @@
 import * as JSON5 from "json5";
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_eslintrc_typescript.js.ts b/templates/_eslintrc_typescript.js.ts
index 455b10c..68e461a 100644
--- a/templates/_eslintrc_typescript.js.ts
+++ b/templates/_eslintrc_typescript.js.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_github/dependabot.yml.ts b/templates/_github/dependabot.yml.ts
index 8c939af..61cf9a1 100644
--- a/templates/_github/dependabot.yml.ts
+++ b/templates/_github/dependabot.yml.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_gitignore.ts b/templates/_gitignore.ts
index 7517ca1..e55cd2d 100644
--- a/templates/_gitignore.ts
+++ b/templates/_gitignore.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_npmignore.ts b/templates/_npmignore.ts
index ee4cc11..a58fbef 100644
--- a/templates/_npmignore.ts
+++ b/templates/_npmignore.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_prettierignore.ts b/templates/_prettierignore.ts
index 808691b..96b4b4f 100644
--- a/templates/_prettierignore.ts
+++ b/templates/_prettierignore.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_prettierrc.js.ts b/templates/_prettierrc.js.ts
index af7366b..c33dd88 100644
--- a/templates/_prettierrc.js.ts
+++ b/templates/_prettierrc.js.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_vscode/extensions.json.ts b/templates/_vscode/extensions.json.ts
index 8e0c433..b9128d7 100644
--- a/templates/_vscode/extensions.json.ts
+++ b/templates/_vscode/extensions.json.ts
@@ -1,5 +1,5 @@
 import * as JSON5 from "json5";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/_vscode/settings.json.ts b/templates/_vscode/settings.json.ts
index fbf0f0c..8e8bf1c 100644
--- a/templates/_vscode/settings.json.ts
+++ b/templates/_vscode/settings.json.ts
@@ -1,5 +1,5 @@
 import * as JSON5 from "json5";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/admin/custom_m.html.ts b/templates/admin/custom_m.html.ts
index f250b9e..a4fd719 100644
--- a/templates/admin/custom_m.html.ts
+++ b/templates/admin/custom_m.html.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 export = (answers => {
 
diff --git a/templates/admin/index_m.html.ts b/templates/admin/index_m.html.ts
index 2809ae1..b65c021 100644
--- a/templates/admin/index_m.html.ts
+++ b/templates/admin/index_m.html.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, getDefaultAnswer, getIconName } from "../../src/lib/core/questions";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 function generateSettingsDiv(settings: AdapterSettings): string {
 	if (settings.inputType === "select" && settings.options) {
diff --git a/templates/admin/src/app.tsx_jsx.ts b/templates/admin/src/app.tsx_jsx.ts
index 288c38e..6153d85 100644
--- a/templates/admin/src/app.tsx_jsx.ts
+++ b/templates/admin/src/app.tsx_jsx.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/admin/src/components/settings.tsx_jsx.ts b/templates/admin/src/components/settings.tsx_jsx.ts
index 98b5616..f5bfd6c 100644
--- a/templates/admin/src/components/settings.tsx_jsx.ts
+++ b/templates/admin/src/components/settings.tsx_jsx.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, getDefaultAnswer } from "../../../../src/lib/core/questions";
-import { TemplateFunction } from "../../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../../src/lib/createAdapter";
 
 function generateSettingsMethod(settings: AdapterSettings): string {
 	if (settings.inputType === "select" && settings.options) {
diff --git a/templates/admin/src/i18n/i18n.d.ts.ts b/templates/admin/src/i18n/i18n.d.ts.ts
index 893f2ed..8877ccb 100644
--- a/templates/admin/src/i18n/i18n.d.ts.ts
+++ b/templates/admin/src/i18n/i18n.d.ts.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/admin/src/index.tsx_jsx.ts b/templates/admin/src/index.tsx_jsx.ts
index dffa9da..a78118f 100644
--- a/templates/admin/src/index.tsx_jsx.ts
+++ b/templates/admin/src/index.tsx_jsx.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/admin/src/tab-app.tsx_jsx.ts b/templates/admin/src/tab-app.tsx_jsx.ts
index eb14504..b4a16df 100644
--- a/templates/admin/src/tab-app.tsx_jsx.ts
+++ b/templates/admin/src/tab-app.tsx_jsx.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/admin/src/tab.tsx_jsx.ts b/templates/admin/src/tab.tsx_jsx.ts
index 6442e49..f3c7c0d 100644
--- a/templates/admin/src/tab.tsx_jsx.ts
+++ b/templates/admin/src/tab.tsx_jsx.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/admin/tab_m.html.ts b/templates/admin/tab_m.html.ts
index d8acfba..7d58d92 100644
--- a/templates/admin/tab_m.html.ts
+++ b/templates/admin/tab_m.html.ts
@@ -1,5 +1,5 @@
 import { getIconName } from "../../src/lib/core/questions";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 export = (answers => {
 
diff --git a/templates/admin/words.js.ts b/templates/admin/words.js.ts
index 8adb886..e3e8ab3 100644
--- a/templates/admin/words.js.ts
+++ b/templates/admin/words.js.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 import { formatJsonString } from "../../src/lib/tools";
 import { getTranslatedSettings } from "../../src/lib/translation";
 
diff --git a/templates/gulpfile.js.ts b/templates/gulpfile.js.ts
index dab7dbf..9b7251c 100644
--- a/templates/gulpfile.js.ts
+++ b/templates/gulpfile.js.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 export = (answers => {
 
diff --git a/templates/index.ts b/templates/index.ts
index 6fa208e..1fc378a 100644
--- a/templates/index.ts
+++ b/templates/index.ts
@@ -2,7 +2,7 @@
 // and contains references to all defined templates.
 // Do not edit it by hand or your changes will be lost!
 
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 const templates: { name: string, templateFunction: TemplateFunction }[] = [
 	{ name: "_babelrc.ts", templateFunction: require("./_babelrc") },
diff --git a/templates/io-package.json.ts b/templates/io-package.json.ts
index d71c12a..3e2e47a 100644
--- a/templates/io-package.json.ts
+++ b/templates/io-package.json.ts
@@ -2,7 +2,7 @@ import { composeObject } from "alcalzone-shared/objects";
 import * as JSON5 from "json5";
 import { licenses } from "../src/lib/core/licenses";
 import { AdapterSettings, getDefaultAnswer, getIconName } from "../src/lib/core/questions";
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 import { translateText } from "../src/lib/tools";
 
 export = (async answers => {
diff --git a/templates/lib/adapter-config.d.ts.ts b/templates/lib/adapter-config.d.ts.ts
index a094ed1..296814f 100644
--- a/templates/lib/adapter-config.d.ts.ts
+++ b/templates/lib/adapter-config.d.ts.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, getDefaultAnswer } from "../../src/lib/core/questions";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 function generateSettingsProperty(settings: AdapterSettings): string {
 	if (settings.inputType === "select" && settings.options) {
diff --git a/templates/main.es6.js.ts b/templates/main.es6.js.ts
index ddfe060..8d26f63 100644
--- a/templates/main.es6.js.ts
+++ b/templates/main.es6.js.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, getDefaultAnswer } from "../src/lib/core/questions";
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 import { kebabCaseToUpperCamelCase } from "../src/lib/tools";
 
 const templateFunction: TemplateFunction = async answers => {
diff --git a/templates/main.js.ts b/templates/main.js.ts
index 438860a..8041890 100644
--- a/templates/main.js.ts
+++ b/templates/main.js.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, getDefaultAnswer } from "../src/lib/core/questions";
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 export = (async answers => {
 
diff --git a/templates/package.json.ts b/templates/package.json.ts
index bdde579..e02fa2b 100644
--- a/templates/package.json.ts
+++ b/templates/package.json.ts
@@ -1,8 +1,8 @@
 import * as JSON5 from "json5";
-import * as pLimit from "p-limit";
+import pLimit from "p-limit";
 import { licenses } from "../src/lib/core/licenses";
 import { getDefaultAnswer } from "../src/lib/core/questions";
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 import { fetchPackageReferenceVersion, getPackageName } from "../src/lib/packageVersions";
 
 // Limit package version downloads to 10 simultaneous connections
diff --git a/templates/src/main.es6.ts b/templates/src/main.es6.ts
index fea76ec..b2851df 100644
--- a/templates/src/main.es6.ts
+++ b/templates/src/main.es6.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, getDefaultAnswer } from "../../src/lib/core/questions";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 import { kebabCaseToUpperCamelCase } from "../../src/lib/tools";
 
 const templateFunction: TemplateFunction = async answers => {
diff --git a/templates/src/main.ts.ts b/templates/src/main.ts.ts
index 4f8b223..498e2fa 100644
--- a/templates/src/main.ts.ts
+++ b/templates/src/main.ts.ts
@@ -1,5 +1,5 @@
 import { AdapterSettings, getDefaultAnswer } from "../../src/lib/core/questions";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 export = (answers => {
 
diff --git a/templates/tsconfig.json.ts b/templates/tsconfig.json.ts
index 7480784..7d68ca1 100644
--- a/templates/tsconfig.json.ts
+++ b/templates/tsconfig.json.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../src/lib/createAdapter";
+import type { TemplateFunction } from "../src/lib/createAdapter";
 
 export = (answers => {
 
diff --git a/templates/widgets/style.css.ts b/templates/widgets/style.css.ts
index db1af24..8a0eec7 100644
--- a/templates/widgets/style.css.ts
+++ b/templates/widgets/style.css.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/widgets/template.html.ts b/templates/widgets/template.html.ts
index 0edc003..6e04111 100644
--- a/templates/widgets/template.html.ts
+++ b/templates/widgets/template.html.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/widgets/template.js.ts b/templates/widgets/template.js.ts
index 9efb83a..c49c3cc 100644
--- a/templates/widgets/template.js.ts
+++ b/templates/widgets/template.js.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/tsconfig.json b/tsconfig.json
index 814e39d..25cd64c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,22 +1,37 @@
 {
-	"compileOnSave": true,
+	// To update the compilation target, install a different version of @tsconfig/node... and reference it here
+	// https://github.com/tsconfig/bases#node-12-tsconfigjson
+	"extends": "@tsconfig/node12/tsconfig.json",
 	"compilerOptions": {
+		// do not compile anything, this file is just to configure type checking
+		// the compilation is configured in tsconfig.build.json
 		"noEmit": true,
+		// Never emit faulty JS
 		"noEmitOnError": true,
-		"module": "commonjs",
-		"moduleResolution": "node",
 		"outDir": "./build/",
 		"removeComments": false,
-		"strict": true,
+		// Avoid runtime imports that are unnecessary
+		"importsNotUsedAsValues": "error",
+		// The way we use `enquirer` is incompatible with strictFunctionTypes
 		"strictFunctionTypes": false,
+		// We import some .json files and TS should pick them up correctly
 		"resolveJsonModule": true,
+		// Required for TS debugging
 		"sourceMap": true,
 		"inlineSourceMap": false,
-		"target": "es2017",
-		"watch": false,
 		// Fix enquirer typings
-		"typeRoots": ["./src/@types/", "./node_modules/@types"]
+		"typeRoots": [
+			"./src/@types",
+			"./node_modules/@types"
+		]
 	},
-	"include": ["**/*.ts"],
-	"exclude": ["build/**", "node_modules/**", "test/baselines/**"]
+	"include": [
+		"**/*.ts",
+		".github/*.ts"
+	],
+	"exclude": [
+		"build/**",
+		"node_modules/**",
+		"test/baselines/**"
+	]
 }


Test patch:
diff --git a/src/lib/packageVersions.test.ts b/src/lib/packageVersions.test.ts
index 939f4b8..b726a5a 100644
--- a/src/lib/packageVersions.test.ts
+++ b/src/lib/packageVersions.test.ts
@@ -1,5 +1,5 @@
 import { expect } from "chai";
-import * as proxyquireModule from "proxyquire";
+import proxyquireModule from "proxyquire";
 import { stub } from "sinon";
 import { getPackageName, getVersionSpecifier } from "./packageVersions";
 
@@ -9,9 +9,7 @@ const proxyquire = proxyquireModule.noPreserveCache();
 const { fetchPackageVersion, fetchPackageReferenceVersion } = proxyquire<
 	typeof import("./packageVersions")
 >("./packageVersions", {
-	axios: {
-		default: axiosMock,
-	},
+	axios: axiosMock,
 });
 
 function returnVersions(versions: string[]) {
diff --git a/templates/_github/workflows/test-and-release.yml.ts b/templates/_github/workflows/test-and-release.yml.ts
index aa8b0c3..f635bd7 100644
--- a/templates/_github/workflows/test-and-release.yml.ts
+++ b/templates/_github/workflows/test-and-release.yml.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/test/integration.js.ts b/templates/test/integration.js.ts
index 76e0ba3..a2a75a7 100644
--- a/templates/test/integration.js.ts
+++ b/templates/test/integration.js.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/templates/test/mocha.setup.js.ts b/templates/test/mocha.setup.js.ts
index b34373c..4bddbd2 100644
--- a/templates/test/mocha.setup.js.ts
+++ b/templates/test/mocha.setup.js.ts
@@ -1,4 +1,4 @@
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 export = (answers => {
 
diff --git a/templates/test/mocharc.custom.ts b/templates/test/mocharc.custom.ts
index 4ba1b76..47de6a7 100644
--- a/templates/test/mocharc.custom.ts
+++ b/templates/test/mocharc.custom.ts
@@ -1,5 +1,5 @@
 import * as JSON5 from "json5";
-import { TemplateFunction } from "../../src/lib/createAdapter";
+import type { TemplateFunction } from "../../src/lib/createAdapter";
 
 const templateFunction: TemplateFunction = answers => {
 
diff --git a/test/baselines/TS_SingleQuotes/.eslintignore b/test/baselines/TS_SingleQuotes/.eslintignore
index b489111..70b6a26 100644
--- a/test/baselines/TS_SingleQuotes/.eslintignore
+++ b/test/baselines/TS_SingleQuotes/.eslintignore
@@ -1,2 +1,3 @@
+admin/build/
 build/
 **/.eslintrc.js
\ No newline at end of file
diff --git a/test/create-adapter.test.ts b/test/create-adapter.test.ts
index b6a0e53..fbe182c 100644
--- a/test/create-adapter.test.ts
+++ b/test/create-adapter.test.ts
@@ -6,7 +6,7 @@ import * as fs from "fs-extra";
 import { validate as validateJSON } from "jsonschema";
 import * as path from "path";
 import { createAdapter } from "../src/index";
-import { Answers } from "../src/lib/core/questions";
+import type { Answers } from "../src/lib/core/questions";
 import { File, writeFiles } from "../src/lib/createAdapter";
 
 const baselineDir = path.join(__dirname, "../test/baselines");