diff --git a/src/cli/index.ts b/src/cli/index.ts index b88d382edc..d129f4d48e 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,13 +1,13 @@ -import type { AvailablePackages } from "../installers/index.js"; +import type { AvailablePackages } from "~/installers/index.js"; import chalk from "chalk"; import { Command } from "commander"; import inquirer from "inquirer"; -import { CREATE_T3_APP, DEFAULT_APP_NAME } from "../consts.js"; -import { availablePackages } from "../installers/index.js"; -import { getVersion } from "../utils/getT3Version.js"; -import { getUserPkgManager } from "../utils/getUserPkgManager.js"; -import { logger } from "../utils/logger.js"; -import { validateAppName } from "../utils/validateAppName.js"; +import { CREATE_T3_APP, DEFAULT_APP_NAME } from "~/consts.js"; +import { availablePackages } from "~/installers/index.js"; +import { getVersion } from "~/utils/getT3Version.js"; +import { getUserPkgManager } from "~/utils/getUserPkgManager.js"; +import { logger } from "~/utils/logger.js"; +import { validateAppName } from "~/utils/validateAppName.js"; interface CliFlags { noGit: boolean; diff --git a/src/helpers/createProject.ts b/src/helpers/createProject.ts index f5d28c0d73..07fbd05875 100644 --- a/src/helpers/createProject.ts +++ b/src/helpers/createProject.ts @@ -1,10 +1,10 @@ -import type { PkgInstallerMap } from "../installers/index.js"; +import type { PkgInstallerMap } from "~/installers/index.js"; import path from "path"; -import { getUserPkgManager } from "../utils/getUserPkgManager.js"; -import { curryRunPkgManagerInstall } from "../utils/runPkgManagerInstall.js"; -import { installPackages } from "./installPackages.js"; -import { scaffoldProject } from "./scaffoldProject.js"; -import { selectAppFile, selectIndexFile } from "./selectBoilerplate.js"; +import { installPackages } from "~/helpers/installPackages.js"; +import { scaffoldProject } from "~/helpers/scaffoldProject.js"; +import { selectAppFile, selectIndexFile } from "~/helpers/selectBoilerplate.js"; +import { getUserPkgManager } from "~/utils/getUserPkgManager.js"; +import { curryRunPkgManagerInstall } from "~/utils/runPkgManagerInstall.js"; interface CreateProjectOptions { projectName: string; diff --git a/src/helpers/initGit.ts b/src/helpers/initGit.ts index 1938625c9b..76cedc06ac 100644 --- a/src/helpers/initGit.ts +++ b/src/helpers/initGit.ts @@ -1,7 +1,7 @@ import chalk from "chalk"; import ora from "ora"; -import { execa } from "../utils/execAsync.js"; -import { logger } from "../utils/logger.js"; +import { execa } from "~/utils/execAsync.js"; +import { logger } from "~/utils/logger.js"; // This initializes the Git-repository for the project export const initializeGit = async (projectDir: string) => { diff --git a/src/helpers/installPackages.ts b/src/helpers/installPackages.ts index 849ca13e98..20330336f7 100644 --- a/src/helpers/installPackages.ts +++ b/src/helpers/installPackages.ts @@ -1,7 +1,7 @@ import type { InstallerOptions, PkgInstallerMap } from "../installers/index.js"; import chalk from "chalk"; import ora from "ora"; -import { logger } from "../utils/logger.js"; +import { logger } from "~/utils/logger.js"; type InstallPackagesOptions = { packages: PkgInstallerMap; diff --git a/src/helpers/logNextSteps.ts b/src/helpers/logNextSteps.ts index 0f6ad1fa95..026c6761ba 100644 --- a/src/helpers/logNextSteps.ts +++ b/src/helpers/logNextSteps.ts @@ -1,7 +1,7 @@ -import type { InstallerOptions } from "../installers/index.js"; -import { DEFAULT_APP_NAME } from "../consts.js"; -import { getUserPkgManager } from "../utils/getUserPkgManager.js"; -import { logger } from "../utils/logger.js"; +import type { InstallerOptions } from "~/installers/index.js"; +import { DEFAULT_APP_NAME } from "~/consts.js"; +import { getUserPkgManager } from "~/utils/getUserPkgManager.js"; +import { logger } from "~/utils/logger.js"; // This logs the next steps that the user should take in order to advance the project export const logNextSteps = ({ diff --git a/src/helpers/scaffoldProject.ts b/src/helpers/scaffoldProject.ts index e965085889..527e087c66 100644 --- a/src/helpers/scaffoldProject.ts +++ b/src/helpers/scaffoldProject.ts @@ -3,10 +3,10 @@ import chalk from "chalk"; import fs from "fs-extra"; import inquirer from "inquirer"; import ora from "ora"; -import { PKG_ROOT } from "../consts.js"; -import { InstallerOptions } from "../installers/index.js"; -import { execa } from "../utils/execAsync.js"; -import { logger } from "../utils/logger.js"; +import { PKG_ROOT } from "~/consts.js"; +import { InstallerOptions } from "~/installers/index.js"; +import { execa } from "~/utils/execAsync.js"; +import { logger } from "~/utils/logger.js"; // This bootstraps the base Next.js application export const scaffoldProject = async ({ diff --git a/src/helpers/selectBoilerplate.ts b/src/helpers/selectBoilerplate.ts index d5d4bad942..7350250ae6 100644 --- a/src/helpers/selectBoilerplate.ts +++ b/src/helpers/selectBoilerplate.ts @@ -1,7 +1,7 @@ -import type { InstallerOptions } from "../installers/index.js"; +import type { InstallerOptions } from "~/installers/index.js"; import path from "path"; import fs from "fs-extra"; -import { PKG_ROOT } from "../consts.js"; +import { PKG_ROOT } from "~/consts.js"; type SelectBoilerplateProps = Required< Pick diff --git a/src/index.ts b/src/index.ts index bd7992b110..e1a7a5321f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,14 +2,14 @@ import type { PackageJson } from "type-fest"; import path from "path"; import fs from "fs-extra"; -import { runCli } from "./cli/index.js"; -import { createProject } from "./helpers/createProject.js"; -import { initializeGit } from "./helpers/initGit.js"; -import { logNextSteps } from "./helpers/logNextSteps.js"; -import { buildPkgInstallerMap } from "./installers/index.js"; -import { logger } from "./utils/logger.js"; -import { parseNameAndPath } from "./utils/parseNameAndPath.js"; -import { renderTitle } from "./utils/renderTitle.js"; +import { runCli } from "~/cli/index.js"; +import { createProject } from "~/helpers/createProject.js"; +import { initializeGit } from "~/helpers/initGit.js"; +import { logNextSteps } from "~/helpers/logNextSteps.js"; +import { buildPkgInstallerMap } from "~/installers/index.js"; +import { logger } from "~/utils/logger.js"; +import { parseNameAndPath } from "~/utils/parseNameAndPath.js"; +import { renderTitle } from "~/utils/renderTitle.js"; const main = async () => { renderTitle(); diff --git a/src/installers/envVars.ts b/src/installers/envVars.ts index 7278985fe1..a00ccc0f0f 100644 --- a/src/installers/envVars.ts +++ b/src/installers/envVars.ts @@ -1,7 +1,7 @@ -import type { Installer } from "./index.js"; +import type { Installer } from "~/installers/index.js"; import path from "path"; import fs from "fs-extra"; -import { PKG_ROOT } from "../consts.js"; +import { PKG_ROOT } from "~/consts.js"; export const envVariablesInstaller: Installer = async ({ projectDir, diff --git a/src/installers/index.ts b/src/installers/index.ts index 2a7ec20030..7d09a81162 100644 --- a/src/installers/index.ts +++ b/src/installers/index.ts @@ -1,10 +1,10 @@ -import type { PackageManager } from "../utils/getUserPkgManager.js"; -import type { CurriedRunPkgManagerInstallOptions } from "../utils/runPkgManagerInstall.js"; -import { envVariablesInstaller as envVariablesInstaller } from "./envVars.js"; -import { nextAuthInstaller } from "./next-auth.js"; -import { prismaInstaller } from "./prisma.js"; -import { tailwindInstaller } from "./tailwind.js"; -import { trpcInstaller } from "./trpc.js"; +import type { PackageManager } from "~/utils/getUserPkgManager.js"; +import type { CurriedRunPkgManagerInstallOptions } from "~/utils/runPkgManagerInstall.js"; +import { envVariablesInstaller as envVariablesInstaller } from "~/installers/envVars.js"; +import { nextAuthInstaller } from "~/installers/next-auth.js"; +import { prismaInstaller } from "~/installers/prisma.js"; +import { tailwindInstaller } from "~/installers/tailwind.js"; +import { trpcInstaller } from "~/installers/trpc.js"; // Turning this into a const allows the list to be iterated over for programatically creating prompt options // Should increase extensability in the future diff --git a/src/installers/next-auth.ts b/src/installers/next-auth.ts index 399d415fd4..e3d0bdb496 100644 --- a/src/installers/next-auth.ts +++ b/src/installers/next-auth.ts @@ -1,7 +1,7 @@ -import type { Installer } from "./index.js"; +import type { Installer } from "~/installers/index.js"; import path from "path"; import fs from "fs-extra"; -import { PKG_ROOT } from "../consts.js"; +import { PKG_ROOT } from "~/consts.js"; export const nextAuthInstaller: Installer = async ({ projectDir, diff --git a/src/installers/prisma.ts b/src/installers/prisma.ts index 7b6ece38fa..bf2ed30e38 100644 --- a/src/installers/prisma.ts +++ b/src/installers/prisma.ts @@ -1,9 +1,9 @@ -import type { Installer } from "./index.js"; import type { PackageJson } from "type-fest"; +import type { Installer } from "~/installers/index.js"; import path from "path"; import fs from "fs-extra"; -import { PKG_ROOT } from "../consts.js"; -import { execa } from "../utils/execAsync.js"; +import { PKG_ROOT } from "~/consts.js"; +import { execa } from "~/utils/execAsync.js"; export const prismaInstaller: Installer = async ({ projectDir, diff --git a/src/installers/tailwind.ts b/src/installers/tailwind.ts index e77158d894..089ae31ee2 100644 --- a/src/installers/tailwind.ts +++ b/src/installers/tailwind.ts @@ -1,7 +1,7 @@ -import type { Installer } from "./index.js"; +import type { Installer } from "~/installers/index.js"; import path from "path"; import fs from "fs-extra"; -import { PKG_ROOT } from "../consts.js"; +import { PKG_ROOT } from "~/consts.js"; export const tailwindInstaller: Installer = async ({ projectDir, diff --git a/src/installers/trpc.ts b/src/installers/trpc.ts index 63652604a4..5825bef0d8 100644 --- a/src/installers/trpc.ts +++ b/src/installers/trpc.ts @@ -1,7 +1,7 @@ -import type { Installer } from "./index.js"; +import type { Installer } from "~/installers/index.js"; import path from "path"; import fs from "fs-extra"; -import { PKG_ROOT } from "../consts.js"; +import { PKG_ROOT } from "~/consts.js"; export const trpcInstaller: Installer = async ({ projectDir, diff --git a/src/utils/getT3Version.ts b/src/utils/getT3Version.ts index af4bd3eb98..881df1f9f3 100644 --- a/src/utils/getT3Version.ts +++ b/src/utils/getT3Version.ts @@ -1,7 +1,7 @@ import type { PackageJson } from "type-fest"; import path from "path"; import fs from "fs-extra"; -import { PKG_ROOT } from "../consts.js"; +import { PKG_ROOT } from "~/consts.js"; export const getVersion = () => { const packageJsonPath = path.join(PKG_ROOT, "package.json"); diff --git a/src/utils/renderTitle.ts b/src/utils/renderTitle.ts index 24f01c73f5..f0c8c42c71 100644 --- a/src/utils/renderTitle.ts +++ b/src/utils/renderTitle.ts @@ -1,6 +1,6 @@ import gradient from "gradient-string"; -import { TITLE_TEXT } from "../consts.js"; -import { getUserPkgManager } from "./getUserPkgManager.js"; +import { TITLE_TEXT } from "~/consts.js"; +import { getUserPkgManager } from "~/utils/getUserPkgManager.js"; // colors brought in from vscode poimandres theme const poimandresTheme = { diff --git a/src/utils/runPkgManagerInstall.ts b/src/utils/runPkgManagerInstall.ts index 8e6bce3b0b..24d47bd725 100644 --- a/src/utils/runPkgManagerInstall.ts +++ b/src/utils/runPkgManagerInstall.ts @@ -1,9 +1,9 @@ -import type { PackageManager } from "./getUserPkgManager.js"; +import type { PackageManager } from "~/utils/getUserPkgManager.js"; import path from "path"; import fs from "fs-extra"; import { type PackageJson } from "type-fest"; -import { execa } from "./execAsync.js"; -import { logger } from "./logger.js"; +import { execa } from "~/utils/execAsync.js"; +import { logger } from "~/utils/logger.js"; export interface RunPkgManagerInstallOptions { pkgManager: PackageManager; diff --git a/tsconfig.json b/tsconfig.json index 215c7892b8..11e2b5f82a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -35,6 +35,12 @@ // "exactOptionalPropertyTypes": true, // TLDR - Setting to undefined is not the same as a property not being defined at all // "noPropertyAccessFromIndexSignature": true, // TLDR - Use dot notation for objects if youre sure it exists, use ['index'] notaion if unsure + /* MODULE PATH ALIAS*/ + "baseUrl": "./", + "paths": { + "~/*": ["./src/*"] + }, + /* OTHER OPTIONS */ "allowSyntheticDefaultImports": true, "esModuleInterop": true,