-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make files cleaner and rm some comments
- Loading branch information
Showing
13 changed files
with
35 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,10 @@ | ||
import { consola } from "consola"; | ||
import path from "pathe"; | ||
|
||
import { askAppName } from "~/prompts/05-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 { downloadI18nFiles } from "~/prompts/utils/downloadI18nFiles"; | ||
import { getCurrentWorkingDirectory } from "~/prompts/utils/fs"; | ||
import { handleStringReplacements } from "~/prompts/utils/handleStringReplacements"; | ||
import { downloadGitRepo } from "~/prompts/utils/downloadGitRepo"; | ||
import { moveAppToLocale } from "~/prompts/utils/moveAppToLocale"; | ||
import { isDev, REPO_SHORT_URLS } from "~/settings"; | ||
import { askProjectDetails } from "~/prompts/04-askProjectDetails"; | ||
import { REPO_SHORT_URLS } from "~/settings"; | ||
|
||
export async function justInstallRelivator() { | ||
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 username = await askUserName(); | ||
const domain = await askAppDomain(); | ||
const git = await askGitInitialization(); | ||
const deps = await askInstallDependencies("justInstallRelivator"); | ||
|
||
const confirmed = await askSummaryConfirmation( | ||
template, | ||
appName, | ||
username, | ||
domain, | ||
git, | ||
deps, | ||
); | ||
|
||
if (!confirmed) { | ||
consola.info("Project creation process was canceled."); | ||
return; | ||
} | ||
|
||
await downloadGitRepo(appName, template, deps, git); | ||
|
||
const cwd = getCurrentWorkingDirectory(); | ||
const targetDir = isDev | ||
? path.join(cwd, "..", appName) | ||
: path.join(cwd, appName); | ||
|
||
await handleStringReplacements( | ||
targetDir, | ||
template, | ||
appName, | ||
username, | ||
domain, | ||
); | ||
|
||
const shouldAddI18n = await askInternationalizationSetup(); | ||
|
||
if (shouldAddI18n) { | ||
await moveAppToLocale(targetDir); | ||
await downloadI18nFiles(targetDir, isDev); | ||
} | ||
const message = `Let's create your brand-new web app using the ${template} starter! After that, you can customize everything however you like.`; | ||
|
||
await askCheckAndDownloadFiles(targetDir, appName); | ||
await showCongratulationMenu(targetDir, deps, template, targetDir); | ||
await askProjectDetails(template, message, "justInstallRelivator", false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,10 @@ | ||
import { consola } from "consola"; | ||
import path from "pathe"; | ||
|
||
import { askAppName } from "~/prompts/05-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 { downloadI18nFiles } from "~/prompts/utils/downloadI18nFiles"; | ||
import { getCurrentWorkingDirectory } from "~/prompts/utils/fs"; | ||
import { handleStringReplacements } from "~/prompts/utils/handleStringReplacements"; | ||
import { downloadGitRepo } from "~/prompts/utils/downloadGitRepo"; | ||
import { moveAppToLocale } from "~/prompts/utils/moveAppToLocale"; | ||
import { isDev } from "~/settings"; | ||
import { askProjectDetails } from "~/prompts/04-askProjectDetails"; | ||
import { REPO_SHORT_URLS } from "~/settings"; | ||
|
||
export async function buildOwnRelivator() { | ||
consola.info( | ||
"Let's build your own Relivator from scratch! We'll use the blefnk/versator-nextjs-template as a starting point.", | ||
); | ||
|
||
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, | ||
appName, | ||
githubUser, | ||
website, | ||
git, | ||
deps, | ||
); | ||
|
||
if (!confirmed) { | ||
consola.info("Project creation process was canceled."); | ||
return; | ||
} | ||
|
||
await downloadGitRepo(appName, template, deps, git); | ||
|
||
const cwd = getCurrentWorkingDirectory(); | ||
const targetDir = isDev | ||
? path.join(cwd, "..", appName) | ||
: path.join(cwd, appName); | ||
|
||
await handleStringReplacements( | ||
targetDir, | ||
template, | ||
appName, | ||
githubUser, | ||
website, | ||
); | ||
|
||
const enableI18n = await askInternationalizationSetup(); | ||
const template = REPO_SHORT_URLS.versatorGithubLink; | ||
|
||
if (enableI18n) { | ||
await moveAppToLocale(targetDir); | ||
await downloadI18nFiles(targetDir, isDev); | ||
} | ||
const message = `Let's build your own Relivator from scratch! We'll use the ${template} as a starting point.`; | ||
|
||
await askCheckAndDownloadFiles(targetDir, appName); | ||
await showCongratulationMenu(targetDir, deps, template, targetDir); | ||
await askProjectDetails(template, message, "buildOwnRelivator", true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.