diff --git a/packages/cli/package.json b/packages/cli/package.json index d123ed85..321fbfae 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -32,7 +32,7 @@ "tap": "16.3.4", "test": "3.3.0", "ts-node": "10.9.1", - "typescript": "4.9.5" + "typescript": "5.0.4" }, "moker": { "plugins": [ diff --git a/packages/core/package.json b/packages/core/package.json index 130c374c..e7a46c21 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -36,7 +36,7 @@ "tempy": "3.0.0", "test": "3.3.0", "ts-node": "10.9.1", - "typescript": "4.9.5" + "typescript": "5.0.4" }, "publishConfig": { "access": "public" diff --git a/packages/core/src/json.ts b/packages/core/src/json.ts index e42850d4..e94088f0 100644 --- a/packages/core/src/json.ts +++ b/packages/core/src/json.ts @@ -2,8 +2,8 @@ import { isReadableAndWritableFile, readFile, writeFile } from "./file.js"; import { deepmerge, isPlainObject, - JSONValue, - StringableJSONValue, + type JSONValue, + type StringableJSONValue, } from "./utils/index.js"; export async function readJson({ diff --git a/packages/core/src/monorepo.ts b/packages/core/src/monorepo.ts index 7efafe1d..9a2a6562 100644 --- a/packages/core/src/monorepo.ts +++ b/packages/core/src/monorepo.ts @@ -1,10 +1,10 @@ import { join } from "node:path"; -import { Package, readPackage } from "./package.js"; +import { readPackage, type Package } from "./package.js"; import { - createRepo, - CreateRepoOptions, DEFAULT_LICENSE, + createRepo, isRepo, + type CreateRepoOptions, } from "./repo.js"; import { addYarnPlugin } from "./yarn.js"; diff --git a/packages/core/src/repo.ts b/packages/core/src/repo.ts index 630a6a91..e976480d 100644 --- a/packages/core/src/repo.ts +++ b/packages/core/src/repo.ts @@ -2,7 +2,7 @@ import hostedGitInfo from "hosted-git-info"; import { basename, join } from "node:path"; import { isDirectory, isReadableAndWritableDirectory } from "./directory.js"; import { generateLicense } from "./license.js"; -import { hasPackage, Package, writePackage } from "./package.js"; +import { hasPackage, writePackage, type Package } from "./package.js"; import { exec, getAuthor } from "./utils/index.js"; import { writeReadme } from "./workspace.js"; import { diff --git a/packages/core/src/yaml.ts b/packages/core/src/yaml.ts index 02c47e01..21e199c9 100644 --- a/packages/core/src/yaml.ts +++ b/packages/core/src/yaml.ts @@ -2,7 +2,7 @@ import deepmerge from "deepmerge"; import yaml from "yaml"; import { isReadableAndWritableFile, readFile, writeFile } from "./file.js"; -import { isPlainObject, JSONValue } from "./utils/types.js"; +import { isPlainObject, type JSONValue } from "./utils/types.js"; export async function readYaml({ path, diff --git a/packages/plugins/package.json b/packages/plugins/package.json index cf0da276..8a0ed40e 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -24,7 +24,7 @@ }, "devDependencies": { "@types/node": "18.16.3", - "typescript": "4.9.5" + "typescript": "5.0.4" }, "publishConfig": { "access": "public" diff --git a/packages/plugins/src/dependabot/dependabot.ts b/packages/plugins/src/dependabot/dependabot.ts index a2537ce4..c3aa044b 100644 --- a/packages/plugins/src/dependabot/dependabot.ts +++ b/packages/plugins/src/dependabot/dependabot.ts @@ -1,10 +1,10 @@ import { - hasPlugin, - PluginArgs, PluginType, + hasPlugin, readYaml, removeFile, writeYaml, + type PluginArgs, } from "@mokr/core"; import { join } from "node:path"; diff --git a/packages/plugins/src/devcontainer/devcontainer.ts b/packages/plugins/src/devcontainer/devcontainer.ts index 278b1baa..b9feccc0 100644 --- a/packages/plugins/src/devcontainer/devcontainer.ts +++ b/packages/plugins/src/devcontainer/devcontainer.ts @@ -1,4 +1,4 @@ -import { hasPlugin, PluginArgs, PluginType } from "@mokr/core"; +import { PluginType, hasPlugin, type PluginArgs } from "@mokr/core"; import { readDevcontainerJson, removeDevcontainerJson, diff --git a/packages/plugins/src/doctoc/doctoc.ts b/packages/plugins/src/doctoc/doctoc.ts index 0641dd40..10f958e6 100644 --- a/packages/plugins/src/doctoc/doctoc.ts +++ b/packages/plugins/src/doctoc/doctoc.ts @@ -1,11 +1,11 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, hasPlugin, - PluginArgs, - PluginType, updatePackage, writePackage, + type PluginArgs, } from "@mokr/core"; import { addPreCommitHookCommand, diff --git a/packages/plugins/src/esbuild/esbuild.ts b/packages/plugins/src/esbuild/esbuild.ts index e86fb903..bc698f05 100644 --- a/packages/plugins/src/esbuild/esbuild.ts +++ b/packages/plugins/src/esbuild/esbuild.ts @@ -1,14 +1,14 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, getMonorepoDirectory, hasPlugin, - PluginArgs, - PluginType, updatePackage, warning, writeGitignore, writePackage, + type PluginArgs, } from "@mokr/core"; async function install({ directory }: PluginArgs) { diff --git a/packages/plugins/src/githubActions/githubActions.ts b/packages/plugins/src/githubActions/githubActions.ts index 8151e72c..0a580b39 100644 --- a/packages/plugins/src/githubActions/githubActions.ts +++ b/packages/plugins/src/githubActions/githubActions.ts @@ -1,9 +1,9 @@ import { + PluginType, copyFile, hasPlugin, - PluginArgs, - PluginType, removeDirectory, + type PluginArgs, } from "@mokr/core"; import { join } from "node:path"; import { URL } from "node:url"; diff --git a/packages/plugins/src/husky/husky.ts b/packages/plugins/src/husky/husky.ts index d0b37886..fbeae3f8 100644 --- a/packages/plugins/src/husky/husky.ts +++ b/packages/plugins/src/husky/husky.ts @@ -1,11 +1,10 @@ import { + PluginType, enqueueRemoveDependency, exec, installDependency, isMonorepo, isReadableAndWritableFile, - PluginArgs, - PluginType, readFile, removeDirectory, removeFile, @@ -13,6 +12,7 @@ import { warning, writeFile, writePackage, + type PluginArgs, } from "@mokr/core"; import os from "node:os"; import { join } from "node:path"; diff --git a/packages/plugins/src/jest/jest.ts b/packages/plugins/src/jest/jest.ts index 91780bec..13aea567 100644 --- a/packages/plugins/src/jest/jest.ts +++ b/packages/plugins/src/jest/jest.ts @@ -1,14 +1,14 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, getMonorepoDirectory, hasPlugin, - PluginArgs, - PluginType, removeFile, warning, writeFile, writePackage, + type PluginArgs, } from "@mokr/core"; import { join } from "path"; diff --git a/packages/plugins/src/lintStaged/lintStaged.ts b/packages/plugins/src/lintStaged/lintStaged.ts index da00590b..de4516d1 100644 --- a/packages/plugins/src/lintStaged/lintStaged.ts +++ b/packages/plugins/src/lintStaged/lintStaged.ts @@ -1,11 +1,11 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, hasPlugin, - PluginArgs, - PluginType, updatePackage, writePackage, + type PluginArgs, } from "@mokr/core"; import { addPreCommitHookCommand, diff --git a/packages/plugins/src/prettier/prettier.ts b/packages/plugins/src/prettier/prettier.ts index 645bbcec..cb93133a 100644 --- a/packages/plugins/src/prettier/prettier.ts +++ b/packages/plugins/src/prettier/prettier.ts @@ -1,12 +1,12 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, - PluginArgs, - PluginType, removeFile, updatePackage, writeFile, writePackage, + type PluginArgs, } from "@mokr/core"; import os from "node:os"; import { join } from "node:path"; diff --git a/packages/plugins/src/semanticRelease/semanticRelease.ts b/packages/plugins/src/semanticRelease/semanticRelease.ts index d4396861..0cd7f625 100644 --- a/packages/plugins/src/semanticRelease/semanticRelease.ts +++ b/packages/plugins/src/semanticRelease/semanticRelease.ts @@ -1,11 +1,11 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, - PluginArgs, - PluginType, removeFile, writeJson, writePackage, + type PluginArgs, } from "@mokr/core"; import { join } from "node:path"; diff --git a/packages/plugins/src/test/test.ts b/packages/plugins/src/test/test.ts index 4be67dd6..734d12be 100644 --- a/packages/plugins/src/test/test.ts +++ b/packages/plugins/src/test/test.ts @@ -1,12 +1,12 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, getMonorepoDirectory, hasPlugin, - PluginArgs, - PluginType, warning, writePackage, + type PluginArgs, } from "@mokr/core"; async function install({ directory }: PluginArgs) { diff --git a/packages/plugins/src/todos/todos.ts b/packages/plugins/src/todos/todos.ts index ff13b428..da487af3 100644 --- a/packages/plugins/src/todos/todos.ts +++ b/packages/plugins/src/todos/todos.ts @@ -1,11 +1,11 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, hasPlugin, - PluginArgs, - PluginType, updatePackage, writePackage, + type PluginArgs, } from "@mokr/core"; import { addPreCommitHookCommand, diff --git a/packages/plugins/src/typescript/tsconfig.ts b/packages/plugins/src/typescript/tsconfig.ts index c46e9877..393c98cc 100644 --- a/packages/plugins/src/typescript/tsconfig.ts +++ b/packages/plugins/src/typescript/tsconfig.ts @@ -72,19 +72,7 @@ type CompilerOptionsDefinition = { suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; stripInternal?: boolean; - target?: - | "es3" - | "es5" - | "es6" - | "es2015" - | "es2016" - | "es2017" - | "es2018" - | "es2019" - | "es2020" - | "es2021" - | "es2022" - | "esnext"; + target?: string; watch?: boolean; experimentalDecorators?: boolean; emitDecoratorMetadata?: boolean; @@ -112,67 +100,7 @@ type CompilerOptionsDefinition = { noImplicitUseStrict?: boolean; listEmittedFiles?: boolean; disableSizeLimit?: boolean; - lib?: ( - | "es5" - | "es6" - | "es7" - | "es2015" - | "es2015.collection" - | "es2015.core" - | "es2015.generator" - | "es2015.iterable" - | "es2015.promise" - | "es2015.proxy" - | "es2015.reflect" - | "es2015.symbol.wellknown" - | "es2015.symbol" - | "es2016" - | "es2016.array.include" - | "es2017" - | "es2017.intl" - | "es2017.object" - | "es2017.sharedmemory" - | "es2017.string" - | "es2017.typedarrays" - | "es2018" - | "es2018.asynciterable" - | "es2018.intl" - | "es2018.promise" - | "es2018.regexp" - | "es2019" - | "es2019.array" - | "es2019.object" - | "es2019.string" - | "es2019.symbol" - | "es2020" - | "es2020.bigint" - | "es2020.promise" - | "es2020.string" - | "es2020.symbol.wellknown" - | "es2021" - | "es2021.promise" - | "es2021.string" - | "es2021.weakref" - | "es2022" - | "es2022.array" - | "es2022.error" - | "es2022.full" - | "es2022.intl" - | "es2022.object" - | "es2022.sharedmemory" - | "es2022.string" - | "esnext" - | "esnext.array" - | "esnext.asynciterable" - | "esnext.bigint" - | "esnext.intl" - | "esnext.symbol" - | "dom" - | "dom.iterable" - | "scripthost" - | "webworker" - | "webworker.importscripts" - )[]; + lib?: string[]; strictNullChecks?: boolean; maxNodeModuleJsDepth?: number; importHelpers?: boolean; diff --git a/packages/plugins/src/typescript/typescript.ts b/packages/plugins/src/typescript/typescript.ts index 9a6e6862..aedb587b 100644 --- a/packages/plugins/src/typescript/typescript.ts +++ b/packages/plugins/src/typescript/typescript.ts @@ -1,17 +1,17 @@ import { + PluginType, addYarnPlugin, enqueueInstallDependency, enqueueRemoveDependency, getMonorepoDirectory, - PluginArgs, - PluginType, removeYarnPlugin, warning, writeGitignore, writePackage, + type PluginArgs, } from "@mokr/core"; import deepmerge from "deepmerge"; -import { removeTsconfig, Tsconfig, writeTsconfig } from "./tsconfig.js"; +import { removeTsconfig, writeTsconfig, type Tsconfig } from "./tsconfig.js"; const TSCONFIG_WORKSPACE: Tsconfig = { compilerOptions: { @@ -22,12 +22,12 @@ const TSCONFIG_WORKSPACE: Tsconfig = { include: ["src/**/*"], }; -// https://github.com/tsconfig/bases/blob/main/bases/node18-strictest-esm.combined.json +// https://github.com/tsconfig/bases/tree/main/bases const TSCONFIG_BASE: Tsconfig = { $schema: "https://json.schemastore.org/tsconfig", - display: "Node 18 + ESM + Strictest", + display: "Node 20 + ESM + Strictest", compilerOptions: { - lib: ["es2022"], + lib: ["es2023"], module: "es2022", target: "es2022", strict: true, @@ -35,6 +35,7 @@ const TSCONFIG_BASE: Tsconfig = { skipLibCheck: true, forceConsistentCasingInFileNames: true, moduleResolution: "node", + verbatimModuleSyntax: true, allowUnusedLabels: false, allowUnreachableCode: false, exactOptionalPropertyTypes: true, @@ -45,7 +46,6 @@ const TSCONFIG_BASE: Tsconfig = { noUncheckedIndexedAccess: true, noUnusedLocals: true, noUnusedParameters: true, - importsNotUsedAsValues: "error", // Custom declaration: true, diff --git a/packages/plugins/src/xv/xv.ts b/packages/plugins/src/xv/xv.ts index 7e1217ba..8a7450f3 100644 --- a/packages/plugins/src/xv/xv.ts +++ b/packages/plugins/src/xv/xv.ts @@ -1,12 +1,12 @@ import { + PluginType, enqueueInstallDependency, enqueueRemoveDependency, getMonorepoDirectory, hasPlugin, - PluginArgs, - PluginType, warning, writePackage, + type PluginArgs, } from "@mokr/core"; async function install({ directory }: PluginArgs) { diff --git a/packages/templates/package.json b/packages/templates/package.json index 0a5c08de..1d95f5de 100644 --- a/packages/templates/package.json +++ b/packages/templates/package.json @@ -24,7 +24,7 @@ }, "devDependencies": { "@types/node": "18.16.3", - "typescript": "4.9.5" + "typescript": "5.0.4" }, "publishConfig": { "access": "public" diff --git a/packages/templates/src/bandersnatch.ts b/packages/templates/src/bandersnatch.ts index 0b6744d1..942f10fb 100644 --- a/packages/templates/src/bandersnatch.ts +++ b/packages/templates/src/bandersnatch.ts @@ -1,10 +1,10 @@ import { + PluginType, enqueueInstallDependency, installPlugin, - PluginType, - TemplateArgs, writeFile, writePackage, + type TemplateArgs, } from "@mokr/core"; import { basename, join } from "node:path"; diff --git a/packages/templates/src/common.ts b/packages/templates/src/common.ts index 594694e8..98a36da6 100644 --- a/packages/templates/src/common.ts +++ b/packages/templates/src/common.ts @@ -1,4 +1,4 @@ -import { installPlugin, PluginType, TemplateArgs } from "@mokr/core"; +import { installPlugin, PluginType, type TemplateArgs } from "@mokr/core"; async function apply({ directory }: TemplateArgs) { await installPlugin({ directory, name: "prettier" }); diff --git a/packages/templates/src/cra.ts b/packages/templates/src/cra.ts index 30059585..3db43ec8 100644 --- a/packages/templates/src/cra.ts +++ b/packages/templates/src/cra.ts @@ -1,12 +1,12 @@ import { + PluginType, exec, getMonorepoDirectory, - PluginType, readPackage, removeDirectory, removeFile, - TemplateArgs, writePackage, + type TemplateArgs, } from "@mokr/core"; import { basename, dirname, join } from "node:path"; diff --git a/packages/templates/src/express.ts b/packages/templates/src/express.ts index 2ab31bce..1f4cdf39 100644 --- a/packages/templates/src/express.ts +++ b/packages/templates/src/express.ts @@ -1,10 +1,10 @@ import { + PluginType, enqueueInstallDependency, installPlugin, - PluginType, - TemplateArgs, writeFile, writePackage, + type TemplateArgs, } from "@mokr/core"; import { basename, join } from "node:path"; diff --git a/packages/templates/src/githubAction.ts b/packages/templates/src/githubAction.ts index 53b761e3..3a62ff4d 100644 --- a/packages/templates/src/githubAction.ts +++ b/packages/templates/src/githubAction.ts @@ -1,13 +1,13 @@ import { + PluginType, enqueueInstallDependency, hasPlugin, installPlugin, - PluginType, - TemplateArgs, warning, writeFile, writePackage, writeYaml, + type TemplateArgs, } from "@mokr/core"; import { basename, join, resolve } from "node:path"; diff --git a/packages/templates/src/lib.ts b/packages/templates/src/lib.ts index f09459d2..9a7d1ac7 100644 --- a/packages/templates/src/lib.ts +++ b/packages/templates/src/lib.ts @@ -1,4 +1,9 @@ -import { installPlugin, PluginType, TemplateArgs, writeFile } from "@mokr/core"; +import { + PluginType, + installPlugin, + writeFile, + type TemplateArgs, +} from "@mokr/core"; import { join } from "path"; async function apply({ directory }: TemplateArgs) { diff --git a/tsconfig.json b/tsconfig.json index f8036cd0..838c28a7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,16 @@ { "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 18 + ESM + Strictest", + "display": "Node 20 + ESM + Strictest", "compilerOptions": { - "lib": ["es2021", "es2022"], + "lib": ["es2023"], "module": "es2022", "target": "es2022", - "moduleResolution": "node", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, + "moduleResolution": "node", + "verbatimModuleSyntax": true, "allowUnusedLabels": false, "allowUnreachableCode": false, "exactOptionalPropertyTypes": true, @@ -20,7 +21,6 @@ "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, - "importsNotUsedAsValues": "error", "declaration": true, "declarationMap": true } diff --git a/yarn.lock b/yarn.lock index 1cdc16f3..bae6a83e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -476,7 +476,7 @@ __metadata: tempy: 3.0.0 test: 3.3.0 ts-node: 10.9.1 - typescript: 4.9.5 + typescript: 5.0.4 yaml: 2.2.2 languageName: unknown linkType: soft @@ -487,7 +487,7 @@ __metadata: dependencies: "@mokr/core": "workspace:*" "@types/node": 18.16.3 - typescript: 4.9.5 + typescript: 5.0.4 languageName: unknown linkType: soft @@ -516,7 +516,7 @@ __metadata: "@mokr/core": "workspace:*" "@mokr/plugins": "workspace:*" "@types/node": 18.16.3 - typescript: 4.9.5 + typescript: 5.0.4 languageName: unknown linkType: soft @@ -5320,7 +5320,7 @@ __metadata: tap: 16.3.4 test: 3.3.0 ts-node: 10.9.1 - typescript: 4.9.5 + typescript: 5.0.4 bin: moker: moker.js languageName: unknown @@ -7896,23 +7896,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:4.9.5": - version: 4.9.5 - resolution: "typescript@npm:4.9.5" +"typescript@npm:5.0.4": + version: 5.0.4 + resolution: "typescript@npm:5.0.4" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: ee000bc26848147ad423b581bd250075662a354d84f0e06eb76d3b892328d8d4440b7487b5a83e851b12b255f55d71835b008a66cbf8f255a11e4400159237db + checksum: 82b94da3f4604a8946da585f7d6c3025fff8410779e5bde2855ab130d05e4fd08938b9e593b6ebed165bda6ad9292b230984f10952cf82f0a0ca07bbeaa08172 languageName: node linkType: hard -"typescript@patch:typescript@4.9.5#~builtin": - version: 4.9.5 - resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin::version=4.9.5&hash=d73830" +"typescript@patch:typescript@5.0.4#~builtin": + version: 5.0.4 + resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=d73830" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 2eee5c37cad4390385db5db5a8e81470e42e8f1401b0358d7390095d6f681b410f2c4a0c496c6ff9ebd775423c7785cdace7bcdad76c7bee283df3d9718c0f20 + checksum: 6a1fe9a77bb9c5176ead919cc4a1499ee63e46b4e05bf667079f11bf3a8f7887f135aa72460a4c3b016e6e6bb65a822cb8689a6d86cbfe92d22cc9f501f09213 languageName: node linkType: hard