diff --git a/README.md b/README.md index 9b553d5..6f91810 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,18 @@ -# Reliverse CLI +# Reliverse -*Build the Sites. Build the Apps. Build the Games. Build Anything.* +[GitHub](https://github.com/reliverse/cli), [npmjs](https://npmjs.com/package/reliverse) -**Reliverse** is a CLI tool designed to streamline the setup of JavaScript, TypeScript, and other types of projects, with a primary focus on Next.js templates, though it is not limited to them. It allows you to effortlessly bootstrap projects, including the [Relivator Next.js template](https://github.com/blefnk/relivator-nextjs-template) or any other template from GitHub or other Git-based sources. Additionally, Reliverse assists in managing configuration files and resolving potential conflicts between tools like ESLint, Prettier, and Biome. +**Reliverse** is a CLI tool designed to streamline the setup of JavaScript, TypeScript, and other types of projects, with a primary focus on Next.js templates, though it is not limited to them. + +It allows you to effortlessly bootstrap projects, including the [Relivator Next.js template](https://github.com/blefnk/relivator-nextjs-template) or any other template from GitHub or other Git-based sources. Additionally, Reliverse assists in managing configuration files and resolving potential conflicts between tools like ESLint, Prettier, and Biome. + +Reliverse is more than just the easiest way to install Relivator. It’s also the most convenient new way to download any repository from GitHub and automatically prepare it for work. Especially if it’s a project from the JavaScript ecosystem. + +The mission of this project is not only to help you install templates in seconds. It is also a desire to make web development more accessible to everyone. It’s a commitment to fixing many things that don’t work in the ecosystem. It’s a wish to share templates, libraries, and tools with the world that deserve attention. It’s also a drive to motivate developers to become contributors to various projects that need and deserve it. ## TL;DR -**It's a single tool for everything.** At its current stage, Reliverse CLI is a powerful website builder and project bootstrapper, right in your terminal. However, it won’t just be a website builder in the future. Even now, you can start from scratch or with a template, setting everything up automatically or customizing it to your exact preferences. With all the tools pre-configured and ready to go, you can build exactly what you envision. +**It's a single tool for everything.** At its current stage, Reliverse CLI is a powerful website builder and project bootstrapper, right in your terminal. However, it won’t be only a website builder in the future, it will be a tool for building anything. Even now, you can start from scratch or with a template, setting everything up automatically or customizing it to your exact preferences. With all the tools pre-configured and ready to go, you can build exactly what you envision. Remember the feeling of empowerment when you first used a website builder like WordPress? It gave you the freedom to create. But eventually, you hit limits—PageSpeed Insights flagged issues, performance lagged, and the bloated size of your site became hard to ignore. @@ -14,12 +20,10 @@ Remember the feeling of empowerment when you first used a website builder like W ## Get Started -Reliverse is still in its early stages, but it already allows you to bootstrap websites quickly. Soon, advanced customization options will be available, along with game-building tools and other exciting features. You're going to love what's coming. +Reliverse is still in its early stages, but it already allows you to bootstrap websites quickly. Soon, advanced customization options will be available, along with other exciting features. You're going to love what's coming. By the way, you might think that a CLI doing so many things would become bloated, like an elephant in the room, but don’t worry—it’s going to be lean. This is the dream of a creator, a dream that must become reality. Everything has to be perfect. -*Psst... We’re already working on a frontend version of the builder too!* 😉 - ## Installation You should install [Git](https://git-scm.com), [VSCode](https://code.visualstudio.com), and [Node.js LTS](https://nodejs.org/en/download/package-manager) first. Then use one of the following commands to install **Reliverse**: @@ -48,7 +52,7 @@ reliverse - **Interactive Prompts**: Customize your setup through interactive prompts that allow you to select which file categories to include. - **Template-Driven**: Automatically clones and installs templates from GitHub to kickstart your development. - **Unlimited Possibilities**: It can work not only with templates! Are you going to clone a JS library? Feel free to use Reliverse! -- **Anything Else?!**: Currently, the CLI is optimized for JS/TS projects (like React, Astro, Vue, Svelte, etc.). In the future, it will even support native video game applications! This is the dream of Reliverse's founder—a single tool designed for everything. +- **Anything Else?!**: Currently, the CLI is optimized for JS/TS projects (like React, Astro, Vue, Svelte, etc). This is the dream of Reliverse's founder—a single tool designed for everything. ### Commands diff --git a/knip.json b/knip.json index f012ccd..eda6159 100644 --- a/knip.json +++ b/knip.json @@ -17,8 +17,7 @@ "src/prompts/utils/putout.ts", "src/prompts/utils/string.ts", "src/prompts/utils/types.ts", - "src/prompts/utils/with.ts", - "src/prompts/05-askTemplate.ts" + "src/prompts/utils/with.ts" ], "ignoreBinaries": [], "ignoreDependencies": [ diff --git a/package.json b/package.json index 95864d6..9844f01 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,9 @@ "default": "./dist/index.js" } }, + "homepage": "https://reliverse.org", + "repository": "https://github.com/reliverse/cli", + "bugs": "https://github.com/reliverse/cli/issues", "main": "./dist/index.js", "types": "./dist/index.d.ts", "bin": { diff --git a/src/prompts/00-showReliverseMenu.ts b/src/prompts/00-showReliverseMenu.ts index 098ed27..25eec6f 100644 --- a/src/prompts/00-showReliverseMenu.ts +++ b/src/prompts/00-showReliverseMenu.ts @@ -1,11 +1,11 @@ import consola from "consola"; import { buildOwnRelivator } from "~/prompts/02-buildOwnRelivator"; import { justInstallRelivator } from "~/prompts/01-justInstallRelivator"; -import { installRepository } from "~/prompts/03-installAnyGitRepo"; +import { installAnyGitRepo } from "~/prompts/03-installAnyGitRepo"; export async function showReliverseMenu() { const option = await consola.prompt( - "Reliverse will allow you to do many things in the future. It's already able to create new projects and make some codebase modifications. How do you want to proceed?", + "Welcome to Reliverse! How do you want to proceed? Reliverse will allow you to do many things in the future. It's already able to create new projects and make some codebase modifications.", { options: [ "1. Install pre-configured Relivator", @@ -21,7 +21,7 @@ export async function showReliverseMenu() { } else if (option === "2. Build your own Relivator from scratch") { await buildOwnRelivator(); } else if (option === "3. Install any other repository from GitHub") { - await installRepository(); + await installAnyGitRepo(); } else { consola.error("Invalid option selected. Exiting."); } diff --git a/src/prompts/01-justInstallRelivator.ts b/src/prompts/01-justInstallRelivator.ts index 25af7a8..5b652e0 100644 --- a/src/prompts/01-justInstallRelivator.ts +++ b/src/prompts/01-justInstallRelivator.ts @@ -2,26 +2,28 @@ import { consola } from "consola"; import path from "pathe"; import { askAppName } from "~/prompts/04-askAppName"; -import { askUserName } from "~/prompts/06-askUserName"; -import { askAppDomain } from "~/prompts/07-askAppDomain"; -import { askGitInitialization } from "~/prompts/08-askGitInitialization"; -import { askInstallDependencies } from "~/prompts/09-askInstallDependencies"; -import { askSummaryConfirmation } from "~/prompts/10-askSummaryConfirmation"; -import { askInternationalizationSetup } from "~/prompts/11-askInternationalizationSetup"; -import { askCheckAndDownloadFiles } from "~/prompts/13-askCheckAndDownloadFiles"; -import { showCongratulationMenu } from "~/prompts/14-showCongratulationMenu"; +import { askUserName } from "~/prompts/05-askUserName"; +import { askAppDomain } from "~/prompts/06-askAppDomain"; +import { askGitInitialization } from "~/prompts/07-askGitInitialization"; +import { askInstallDependencies } from "~/prompts/08-askInstallDependencies"; +import { askSummaryConfirmation } from "~/prompts/09-askSummaryConfirmation"; +import { askInternationalizationSetup } from "~/prompts/10-askInternationalizationSetup"; +import { askCheckAndDownloadFiles } from "~/prompts/12-askCheckAndDownloadFiles"; +import { showCongratulationMenu } from "~/prompts/13-showCongratulationMenu"; import { downloadI18nFiles } from "~/prompts/utils/downloadI18nFiles"; import { getCurrentWorkingDirectory } from "~/prompts/utils/fs"; -import { handleReplacements } from "~/prompts/utils/handleReplacements"; -import { installTemplate } from "~/prompts/utils/installTemplate"; +import { handleStringReplacements } from "~/prompts/utils/handleStringReplacements"; +import { downloadGitRepo } from "~/prompts/utils/downloadGitRepo"; import { moveAppToLocale } from "~/prompts/utils/moveAppToLocale"; -import { isDev } from "~/settings"; +import { isDev, REPO_SHORT_URLS } from "~/settings"; export async function justInstallRelivator() { - const cwd = getCurrentWorkingDirectory(); + consola.info( + "Let's create a brand-new web app using the Relivator Next.js template. After that, you can customize everything however you like.", + ); + const template = REPO_SHORT_URLS.relivatorGithubLink; const appName = await askAppName(); - const template = "blefnk/relivator-nextjs-template"; const username = await askUserName(); const domain = await askAppDomain(); const git = await askGitInitialization(); @@ -38,33 +40,31 @@ export async function justInstallRelivator() { if (!confirmed) { consola.info("Project creation process was canceled."); - return; } - // Install the selected template - await installTemplate(appName, template, deps, git); + await downloadGitRepo(appName, template, deps, git); - // Set the target directory + const cwd = getCurrentWorkingDirectory(); const targetDir = isDev ? path.join(cwd, "..", appName) : path.join(cwd, appName); - // Handle string replacements in the project files (e.g., replace placeholders) - await handleReplacements(targetDir, template, appName, username, domain); + await handleStringReplacements( + targetDir, + template, + appName, + username, + domain, + ); - // Ask if the user wants i18n support - const enableI18n = await askInternationalizationSetup(); + const shouldAddI18n = await askInternationalizationSetup(); - if (enableI18n) { - // Move all content to src/app/[locale] and handle i18n files + if (shouldAddI18n) { await moveAppToLocale(targetDir); await downloadI18nFiles(targetDir, isDev); } - // Check and download any necessary files await askCheckAndDownloadFiles(targetDir, appName); - - // Display the final congratulation menu with the next steps await showCongratulationMenu(targetDir, deps, template, targetDir); } diff --git a/src/prompts/02-buildOwnRelivator.ts b/src/prompts/02-buildOwnRelivator.ts index 244283b..08e6f25 100644 --- a/src/prompts/02-buildOwnRelivator.ts +++ b/src/prompts/02-buildOwnRelivator.ts @@ -2,63 +2,58 @@ import { consola } from "consola"; import path from "pathe"; import { askAppName } from "~/prompts/04-askAppName"; -import { askUserName } from "~/prompts/06-askUserName"; -import { askAppDomain } from "~/prompts/07-askAppDomain"; -import { askGitInitialization } from "~/prompts/08-askGitInitialization"; -import { askInstallDependencies } from "~/prompts/09-askInstallDependencies"; -import { askSummaryConfirmation } from "~/prompts/10-askSummaryConfirmation"; -import { askInternationalizationSetup } from "~/prompts/11-askInternationalizationSetup"; -import { askCheckAndDownloadFiles } from "~/prompts/13-askCheckAndDownloadFiles"; -import { showCongratulationMenu } from "~/prompts/14-showCongratulationMenu"; +import { askUserName } from "~/prompts/05-askUserName"; +import { askAppDomain } from "~/prompts/06-askAppDomain"; +import { askGitInitialization } from "~/prompts/07-askGitInitialization"; +import { askInstallDependencies } from "~/prompts/08-askInstallDependencies"; +import { askSummaryConfirmation } from "~/prompts/09-askSummaryConfirmation"; +import { askInternationalizationSetup } from "~/prompts/10-askInternationalizationSetup"; +import { askCheckAndDownloadFiles } from "~/prompts/12-askCheckAndDownloadFiles"; +import { showCongratulationMenu } from "~/prompts/13-showCongratulationMenu"; import { downloadI18nFiles } from "~/prompts/utils/downloadI18nFiles"; import { getCurrentWorkingDirectory } from "~/prompts/utils/fs"; -import { handleReplacements } from "~/prompts/utils/handleReplacements"; -import { installTemplate } from "~/prompts/utils/installTemplate"; +import { handleStringReplacements } from "~/prompts/utils/handleStringReplacements"; +import { downloadGitRepo } from "~/prompts/utils/downloadGitRepo"; import { moveAppToLocale } from "~/prompts/utils/moveAppToLocale"; import { isDev } from "~/settings"; export async function buildOwnRelivator() { - const cwd = getCurrentWorkingDirectory(); - consola.info( - // "blefnk/relivator template is a highly modified sadmann7/skateshop. This template can be a good starting point to build your own Relivator as well.", - "Let's build your own Relivator from scratch! We'll use the reliverse/next-react-js-minimal template as a starting point.", + "Let's build your own Relivator from scratch! We'll use the blefnk/versator-nextjs-template as a starting point.", ); - // const template = await buildRelivatorTemplate(); // 04-buildTemplate.ts - const template = "reliverse/next-react-js-minimal"; - - const projectName = await askAppName(); // 05-askAppName.ts - const githubUser = await askUserName(); // 06-gitUsername.ts - const website = await askAppDomain(); // 07-askAppDomain.ts - const gitOption = await askGitInitialization(); // 08-askGitInitialization.ts - const deps = await askInstallDependencies("buildRelivator"); // 09-installDependencies.ts + const template = "blefnk/versator-nextjs-template"; + const appName = await askAppName(); + const githubUser = await askUserName(); + const website = await askAppDomain(); + const git = await askGitInitialization(); + const deps = await askInstallDependencies("buildOwnRelivator"); const confirmed = await askSummaryConfirmation( template, - projectName, + appName, githubUser, website, - gitOption, + git, deps, ); if (!confirmed) { consola.info("Project creation process was canceled."); - return; } - await installTemplate(projectName, template, deps, gitOption); + await downloadGitRepo(appName, template, deps, git); + const cwd = getCurrentWorkingDirectory(); const targetDir = isDev - ? path.join(cwd, "..", projectName) - : path.join(cwd, projectName); + ? path.join(cwd, "..", appName) + : path.join(cwd, appName); - await handleReplacements( + await handleStringReplacements( targetDir, template, - projectName, + appName, githubUser, website, ); @@ -70,6 +65,6 @@ export async function buildOwnRelivator() { await downloadI18nFiles(targetDir, isDev); } - await askCheckAndDownloadFiles(targetDir, projectName); + await askCheckAndDownloadFiles(targetDir, appName); await showCongratulationMenu(targetDir, deps, template, targetDir); } diff --git a/src/prompts/03-installAnyGitRepo.ts b/src/prompts/03-installAnyGitRepo.ts index 047529f..899728e 100644 --- a/src/prompts/03-installAnyGitRepo.ts +++ b/src/prompts/03-installAnyGitRepo.ts @@ -1,73 +1,153 @@ import { consola } from "consola"; import path from "pathe"; - import { askAppName } from "~/prompts/04-askAppName"; -import { askGitInitialization } from "~/prompts/08-askGitInitialization"; -import { askInstallDependencies } from "~/prompts/09-askInstallDependencies"; -import { askSummaryConfirmation } from "~/prompts/10-askSummaryConfirmation"; +import { askGitInitialization } from "~/prompts/07-askGitInitialization"; +import { askInstallDependencies } from "~/prompts/08-askInstallDependencies"; +import { askSummaryConfirmation } from "~/prompts/09-askSummaryConfirmation"; import { choosePackageManager } from "~/prompts/utils/choosePackageManager"; import { getCurrentWorkingDirectory } from "~/prompts/utils/fs"; -import { installTemplate } from "~/prompts/utils/installTemplate"; +import { downloadGitRepo } from "~/prompts/utils/downloadGitRepo"; import { validate } from "~/prompts/utils/validate"; -import { isDev } from "~/settings"; - -export async function installRepository() { - consola.info("You can clone any JavaScript/TypeScript library or tool."); +import { isDev, REPO_SHORT_URLS } from "~/settings"; +import { justInstallRelivator } from "~/prompts/01-justInstallRelivator"; +import { askUserName } from "~/prompts/05-askUserName"; +import { askAppDomain } from "~/prompts/06-askAppDomain"; + +export async function installAnyGitRepo() { + consola.info( + "At the moment, the current mode is optimized for installing any package.json-based projects from GitHub. Support for other types of projects and git providers will be added in the future.", + ); - const libraryOption = await consola.prompt("Select an option to proceed:", { - options: [ - "1. Clone Reliverse CLI repository", - "2. Provide a custom GitHub URL", - ] as const, - type: "select", - }); + const projectCategory = await consola.prompt( + "Choose an installation category:", + { + options: [ + "Install any template maintained or created by the Reliverse team", + "Install any external template by providing a custom GitHub link", + "Install any other JS/TS repo project such as a React library", + ] as const, + type: "select", + }, + ); + validate(projectCategory, "string", "Project category selection canceled."); - let libraryRepo = ""; + let repoToInstall = ""; - if (libraryOption === "1. Clone Reliverse CLI repository") { - libraryRepo = "reliverse/cli"; // Shorthand for the GitHub repo - } else if (libraryOption === "2. Provide a custom GitHub URL") { - const customRepo = await consola.prompt( + if ( + projectCategory === + "Install any template maintained or created by the Reliverse team" + ) { + const reliverseTemplate = await consola.prompt( + "Free Reliverse Templates Collection", + { + options: [ + REPO_SHORT_URLS.relivatorGithubLink, + "blefnk/all-in-one-nextjs-template", + "blefnk/create-t3-app", + "blefnk/create-next-app", + "blefnk/astro-starlight-template", + "reliverse/template-browser-extension", + ], + type: "select", + }, + ); + validate(reliverseTemplate, "string", "Template selection canceled."); + + repoToInstall = reliverseTemplate; + } else if ( + projectCategory === + "Install any external template by providing a custom GitHub link" + ) { + const defaultLinks = [ + "reliverse/cli", + "shadcn-ui/taxonomy", + "onwidget/astrowind", + ]; + + const randomDefaultLink = + defaultLinks[Math.floor(Math.random() * defaultLinks.length)]; + + const customLink = await consola.prompt( "Enter the GitHub repository link:", { + default: randomDefaultLink, + placeholder: randomDefaultLink, type: "text", }, ); + validate(customLink, "string", "Custom template providing canceled."); + + repoToInstall = customLink; + } else if ( + projectCategory === + "Install any other JS/TS repo project such as a React library" + ) { + const defaultLinks = [ + "reliverse/acme", + "pmndrs/zustand", + "reliverse/core", + "biomejs/biome", + "reliverse/fs", + "blefnk/knip", + "47ng/nuqs", + ]; + + const randomDefaultLink = + defaultLinks[Math.floor(Math.random() * defaultLinks.length)]; + + const customLink = await consola.prompt( + "Enter the GitHub repository link:", + { + default: randomDefaultLink, + placeholder: randomDefaultLink, + type: "text", + }, + ); + + validate(customLink, "string", "Custom template providing canceled."); + repoToInstall = customLink; + } else { + consola.error("Invalid option selected. Exiting."); + throw new Error("Unexpected template selection error."); + } - validate(customRepo, "string", "Custom repository selection canceled."); - libraryRepo = customRepo.replace("https://github.com/", "github:"); + if ( + repoToInstall === REPO_SHORT_URLS.relivatorGithubLink || + repoToInstall === "blefnk/relivator" + ) { + return justInstallRelivator(); } const projectName = await askAppName(); + const username = await askUserName(); + const domain = await askAppDomain(); const gitOption = await askGitInitialization(); - const installDeps = await askInstallDependencies("installRepository"); + const installDeps = await askInstallDependencies("installAnyGitRepo"); - // Call confirmation with all necessary params const confirmed = await askSummaryConfirmation( - libraryRepo, // Template - projectName, // Project Name - "", // GitHub User (none in this case) - "", // Website (none in this case) - gitOption, // Git Option - installDeps, // Install dependencies boolean + repoToInstall, + projectName, + username, + domain, + gitOption, + installDeps, ); if (!confirmed) { - consola.info("Library cloning process was canceled."); - + consola.info("Project setup was canceled."); return; } const cwd = getCurrentWorkingDirectory(); + const targetDir = isDev ? path.join(cwd, "..", projectName) : path.join(cwd, projectName); - await installTemplate(projectName, libraryRepo, installDeps, gitOption); + await downloadGitRepo(projectName, repoToInstall, installDeps, gitOption); if (installDeps) { const pkgManager = await choosePackageManager(cwd); - consola.info(`Using ${pkgManager} to install dependencies...`); try { @@ -77,12 +157,11 @@ export async function installRepository() { } } else { const pkgManager = await choosePackageManager(cwd); - consola.info( `👉 To install manually, run: cd ${targetDir} && ${pkgManager} i`, ); } - consola.success(`Library/Tool from ${libraryRepo} cloned successfully.`); + consola.success(`Repository from ${repoToInstall} installed successfully.`); consola.info(`👉 If you have VSCode installed, run: code ${targetDir}\n`); } diff --git a/src/prompts/04-askAppName.ts b/src/prompts/04-askAppName.ts index ec3cb19..ffcf730 100644 --- a/src/prompts/04-askAppName.ts +++ b/src/prompts/04-askAppName.ts @@ -3,9 +3,9 @@ import { generate } from "random-words"; import { validate } from "~/prompts/utils/validate"; -// Prompt user for the project name export async function askAppName(): Promise { const placeholder = generate({ exactly: 3, join: "-" }); + const name = await consola.prompt("Enter the project name:", { default: placeholder, placeholder, diff --git a/src/prompts/05-askTemplate.ts b/src/prompts/05-askTemplate.ts deleted file mode 100644 index bdea8c2..0000000 --- a/src/prompts/05-askTemplate.ts +++ /dev/null @@ -1,118 +0,0 @@ -// chooseTemplate.ts -import { consola } from "consola"; - -import { validate } from "~/prompts/utils/validate"; - -export async function buildRelivatorTemplate(): Promise { - const templateOption = await consola.prompt( - "Select a template or provide a custom GitHub URL:", - { - options: [ - // "1. Use skateshop template to have full Relivator version", - // "2. Use minext template to have minimal Relivator version", - "1. Use reliverse/next-react-js-minimal template", - "2. Provide custom GitHub URL (🚨 at your own risk)", - ] as const, - type: "select", - }, - ); - - let template = ""; - - if (templateOption === "1. Use reliverse/next-react-js-minimal template") { - template = "reliverse/next-react-js-minimal"; - } - - // else if ( - // templateOption === - // "2. Use minext template to have minimal Relivator version" - // ) { - // template = "blefnk/minext"; - // } - else if ( - templateOption === "2. Provide custom GitHub URL (🚨 at your own risk)" - ) { - const customTemplate = await consola.prompt( - "Enter the GitHub repository link:", - { type: "text" }, - ); - - validate(customTemplate, "string", "Custom template selection canceled."); - template = customTemplate; - } else { - consola.error("Invalid option selected. Exiting."); - - throw new Error("Invalid template selection"); - } - - return template; -} - -// Prompt user to choose the template -export async function askTemplate(): Promise { - const templateCategory = await consola.prompt("Choose a template category:", { - options: ["Install Reliverse Template", "Install External Template"], - type: "select", - }); - - if (templateCategory === "Install Reliverse Template") { - const reliverseTemplate = await consola.prompt( - "Select a Reliverse template:", - { - options: [ - "blefnk/relivator-nextjs-template", - "blefnk/astro-starlight-template", - ], - type: "select", - }, - ); - - validate(reliverseTemplate, "string", "Template selection canceled."); - - return reliverseTemplate; - } - - if (templateCategory === "Install External Template") { - const externalTemplate = await consola.prompt( - "Select an external template or provide a custom GitHub link:", - { - options: [ - "blefnk/create-next-app", - "blefnk/create-t3-app", - "Provide custom GitHub link", - ], - type: "select", - }, - ); - - if (externalTemplate === "Provide custom GitHub link") { - const defaultLinks = [ - "reliverse/acme", - "blefnk/relivator-nextjs-template", - "blefnk/astro-starlight-template", - ]; - - const randomDefaultLink = - defaultLinks[Math.floor(Math.random() * defaultLinks.length)]; - - const customLink = await consola.prompt( - "Enter the GitHub repository link:", - { - default: randomDefaultLink, - placeholder: randomDefaultLink, - type: "text", - }, - ); - - validate(customLink, "string", "Custom template selection canceled."); - - return customLink; - } - - validate(externalTemplate, "string", "Template selection canceled."); - - return externalTemplate; - } - - throw new Error("Unexpected template selection error."); -} diff --git a/src/prompts/06-askUserName.ts b/src/prompts/05-askUserName.ts similarity index 100% rename from src/prompts/06-askUserName.ts rename to src/prompts/05-askUserName.ts diff --git a/src/prompts/07-askAppDomain.ts b/src/prompts/06-askAppDomain.ts similarity index 100% rename from src/prompts/07-askAppDomain.ts rename to src/prompts/06-askAppDomain.ts diff --git a/src/prompts/08-askGitInitialization.ts b/src/prompts/07-askGitInitialization.ts similarity index 100% rename from src/prompts/08-askGitInitialization.ts rename to src/prompts/07-askGitInitialization.ts diff --git a/src/prompts/09-askInstallDependencies.ts b/src/prompts/08-askInstallDependencies.ts similarity index 73% rename from src/prompts/09-askInstallDependencies.ts rename to src/prompts/08-askInstallDependencies.ts index 0e07126..9130fef 100644 --- a/src/prompts/09-askInstallDependencies.ts +++ b/src/prompts/08-askInstallDependencies.ts @@ -3,11 +3,11 @@ import { consola } from "consola"; import { validate } from "~/prompts/utils/validate"; export async function askInstallDependencies( - mode: "buildRelivator" | "installRepository" | "justInstallRelivator", + mode: "buildOwnRelivator" | "installAnyGitRepo" | "justInstallRelivator", ): Promise { - if (mode === "installRepository") { + if (mode === "installAnyGitRepo") { consola.info( - "In `installRepository` mode, dependencies may not be installed automatically. Run `bun i` manually if needed.", + "In `installAnyGitRepo` mode, dependencies may not be installed automatically. Run `bun i` manually if needed.", ); } diff --git a/src/prompts/10-askSummaryConfirmation.ts b/src/prompts/09-askSummaryConfirmation.ts similarity index 100% rename from src/prompts/10-askSummaryConfirmation.ts rename to src/prompts/09-askSummaryConfirmation.ts diff --git a/src/prompts/11-askInternationalizationSetup.ts b/src/prompts/10-askInternationalizationSetup.ts similarity index 100% rename from src/prompts/11-askInternationalizationSetup.ts rename to src/prompts/10-askInternationalizationSetup.ts diff --git a/src/prompts/12-askToResolveProjectConflicts.ts b/src/prompts/11-askToResolveProjectConflicts.ts similarity index 100% rename from src/prompts/12-askToResolveProjectConflicts.ts rename to src/prompts/11-askToResolveProjectConflicts.ts diff --git a/src/prompts/13-askCheckAndDownloadFiles.ts b/src/prompts/12-askCheckAndDownloadFiles.ts similarity index 98% rename from src/prompts/13-askCheckAndDownloadFiles.ts rename to src/prompts/12-askCheckAndDownloadFiles.ts index 00d4068..a660dce 100644 --- a/src/prompts/13-askCheckAndDownloadFiles.ts +++ b/src/prompts/12-askCheckAndDownloadFiles.ts @@ -2,7 +2,7 @@ import { checkbox, confirm } from "@inquirer/prompts"; import { consola } from "consola"; import path from "pathe"; -import { resolveProjectConflicts } from "~/prompts/12-askToResolveProjectConflicts"; +import { resolveProjectConflicts } from "~/prompts/11-askToResolveProjectConflicts"; import { cloneAndCopyFiles } from "~/prompts/utils/cloneAndCopyFiles"; import { checkFileExists } from "~/prompts/utils/fileUtils"; import { getCurrentWorkingDirectory } from "~/prompts/utils/fs"; diff --git a/src/prompts/14-showCongratulationMenu.ts b/src/prompts/13-showCongratulationMenu.ts similarity index 100% rename from src/prompts/14-showCongratulationMenu.ts rename to src/prompts/13-showCongratulationMenu.ts diff --git a/src/prompts/utils/app.ts b/src/prompts/utils/app.ts index eebbf9a..43d7337 100644 --- a/src/prompts/utils/app.ts +++ b/src/prompts/utils/app.ts @@ -3,6 +3,7 @@ import type { MainMenuItem } from "~/prompts/utils/with"; import metadata from "~/prompts/utils/metadata"; import { productCategories } from "~/prompts/utils/products"; +import { REPO_SHORT_URLS } from "~/settings"; export function slugify(str: string) { return str @@ -27,7 +28,7 @@ type IconName = const socialLinks = { discord: "https://discord.gg/Pb8uKbwpsJ", facebook: "https://facebook.com/groups/bleverse", - github: "https://github.com/blefnk/relivator-nextjs-template", + github: REPO_SHORT_URLS.relivatorGithubLink, githubAccount: "https://github.com/blefnk", twitter: "https://x.com/blefnk", }; @@ -203,7 +204,7 @@ export const siteConfig = { socialLinks: { discord: "https://discord.gg/Pb8uKbwpsJ", facebook: "https://facebook.com/groups/bleverse", - github: "https://github.com/blefnk/relivator-nextjs-template", + github: REPO_SHORT_URLS.relivatorGithubLink, githubAccount: "https://github.com/blefnk", twitter: "https://x.com/blefnk", }, diff --git a/src/prompts/utils/installTemplate.ts b/src/prompts/utils/downloadGitRepo.ts similarity index 95% rename from src/prompts/utils/installTemplate.ts rename to src/prompts/utils/downloadGitRepo.ts index af2931e..af90956 100644 --- a/src/prompts/utils/installTemplate.ts +++ b/src/prompts/utils/downloadGitRepo.ts @@ -6,7 +6,7 @@ import { getCurrentWorkingDirectory } from "~/prompts/utils/fs"; import { initializeGitRepository } from "~/prompts/utils/git"; import { isDev } from "~/settings"; -export async function installTemplate( +export async function downloadGitRepo( name: string, template: string, deps: boolean, diff --git a/src/prompts/utils/downloadI18nFiles.ts b/src/prompts/utils/downloadI18nFiles.ts index ec24ff4..f01a1d4 100644 --- a/src/prompts/utils/downloadI18nFiles.ts +++ b/src/prompts/utils/downloadI18nFiles.ts @@ -3,7 +3,12 @@ import fs from "fs-extra"; import path from "pathe"; import { cloneAndCopyFiles } from "~/prompts/utils/cloneAndCopyFiles"; -import { DEBUG, FILE_PATHS, FILES_TO_DOWNLOAD, REPO_URLS } from "~/settings"; +import { + DEBUG, + FILE_PATHS, + FILES_TO_DOWNLOAD, + REPO_FULL_URLS, +} from "~/settings"; // Function to download i18n layout.tsx and page.tsx files export async function downloadI18nFiles( @@ -65,7 +70,7 @@ export async function downloadI18nFiles( FILES_TO_DOWNLOAD, targetDir, true, - REPO_URLS.i18nRepo, + REPO_FULL_URLS.relivatorGithubLink, tempRepoDir, ); } diff --git a/src/prompts/utils/handleReplacements.ts b/src/prompts/utils/handleStringReplacements.ts similarity index 88% rename from src/prompts/utils/handleReplacements.ts rename to src/prompts/utils/handleStringReplacements.ts index c6de7ef..05b8745 100644 --- a/src/prompts/utils/handleReplacements.ts +++ b/src/prompts/utils/handleStringReplacements.ts @@ -1,9 +1,9 @@ -// handleReplacements.ts +// handleStringReplacements.ts import { extractRepoInfo } from "~/prompts/utils/extractRepoInfo"; import { replaceStringsInFiles } from "~/prompts/utils/replaceStringsInFiles"; -export async function handleReplacements( +export async function handleStringReplacements( targetDir: string, template: string, projectName: string, diff --git a/src/settings.ts b/src/settings.ts index 4464e1c..86cb5b9 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -29,9 +29,12 @@ const args = process.argv.slice(2); export const isDev = args.includes("--dev"); -// URL configurations for repository links -export const REPO_URLS = { - i18nRepo: "https://github.com/blefnk/relivator", // Repo for i18n files +export const REPO_FULL_URLS = { + relivatorGithubLink: "https://github.com/blefnk/relivator-nextjs-template", +}; + +export const REPO_SHORT_URLS = { + relivatorGithubLink: "blefnk/relivator-nextjs-template", }; // Path settings for important files and directories