|
| 1 | +{-# LANGUAGE TupleSections #-} |
| 2 | + |
| 3 | +module Wasp.Cli.Command.CreateNewProject.AvailableTemplates |
| 4 | + ( availableStarterTemplates, |
| 5 | + defaultStarterTemplate, |
| 6 | + ) |
| 7 | +where |
| 8 | + |
| 9 | +import StrongPath (reldir) |
| 10 | +import qualified System.FilePath as FP |
| 11 | +import Wasp.Cli.Command.CreateNewProject.StarterTemplates (StarterTemplate (..), TemplateMetadata (..)) |
| 12 | +import Wasp.Cli.GithubRepo (GithubRepoRef (GithubRepoRef)) |
| 13 | +import qualified Wasp.Cli.GithubRepo as GhRepo |
| 14 | +import Wasp.Util.Terminal (styleCode, styleText) |
| 15 | + |
| 16 | +availableStarterTemplates :: [StarterTemplate] |
| 17 | +availableStarterTemplates = |
| 18 | + [ basicStarterTemplate, |
| 19 | + minimalStarterTemplate, |
| 20 | + openSaasStarterTemplate, |
| 21 | + AiGeneratedStarterTemplate |
| 22 | + ] |
| 23 | + |
| 24 | +defaultStarterTemplate :: StarterTemplate |
| 25 | +defaultStarterTemplate = basicStarterTemplate |
| 26 | + |
| 27 | +{- HLINT ignore minimalStarterTemplate "Redundant $" -} |
| 28 | + |
| 29 | +minimalStarterTemplate :: StarterTemplate |
| 30 | +minimalStarterTemplate = |
| 31 | + BundledStarterTemplate |
| 32 | + { bundledPath = [reldir|minimal|], |
| 33 | + metadata = |
| 34 | + TemplateMetadata |
| 35 | + { _name = "minimal", |
| 36 | + _description = "A minimal starter template that features just a single page.", |
| 37 | + _buildStartingInstructions = \projectDirName -> |
| 38 | + unlines |
| 39 | + [ styleText $ "To run your new app, do:", |
| 40 | + styleCode $ " cd " <> projectDirName, |
| 41 | + styleCode $ " wasp start" |
| 42 | + ] |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | +{- HLINT ignore basicStarterTemplate "Redundant $" -} |
| 47 | + |
| 48 | +basicStarterTemplate :: StarterTemplate |
| 49 | +basicStarterTemplate = |
| 50 | + BundledStarterTemplate |
| 51 | + { bundledPath = [reldir|basic|], |
| 52 | + metadata = |
| 53 | + TemplateMetadata |
| 54 | + { _name = "basic", |
| 55 | + _description = "A basic starter template designed to help you get up and running quickly. It features examples covering the most common use cases.", |
| 56 | + _buildStartingInstructions = \projectDirName -> |
| 57 | + unlines |
| 58 | + [ styleText $ "To run your new app, do:", |
| 59 | + styleCode $ " cd " <> projectDirName, |
| 60 | + styleCode $ " wasp db migrate-dev", |
| 61 | + styleCode $ " wasp start", |
| 62 | + styleText $ "", |
| 63 | + styleText $ "Check the " <> styleCode "README.md" <> " for additional guidance!" |
| 64 | + ] |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | +{- HLINT ignore openSaasStarterTemplate "Redundant $" -} |
| 69 | + |
| 70 | +openSaasStarterTemplate :: StarterTemplate |
| 71 | +openSaasStarterTemplate = |
| 72 | + GhRepoReleaseArchiveTemplate |
| 73 | + { repo = |
| 74 | + GithubRepoRef |
| 75 | + { _repoOwner = "wasp-lang", |
| 76 | + _repoName = "open-saas", |
| 77 | + _repoReferenceName = waspVersionTemplateGitTag |
| 78 | + }, |
| 79 | + archiveName = "template.tar.gz", |
| 80 | + archivePath = [reldir|.|], |
| 81 | + metadata = |
| 82 | + TemplateMetadata |
| 83 | + { _name = "saas", |
| 84 | + _description = |
| 85 | + "Everything a SaaS needs! Comes with Auth, ChatGPT API, Tailwind, Stripe payments and more." |
| 86 | + <> " Check out https://opensaas.sh/ for more details.", |
| 87 | + _buildStartingInstructions = \projectDirName -> |
| 88 | + unlines |
| 89 | + [ styleText $ "To run your new app, follow the instructions below:", |
| 90 | + styleText $ "", |
| 91 | + styleText $ " 1. Position into app's root directory:", |
| 92 | + styleCode $ " cd " <> projectDirName FP.</> "app", |
| 93 | + styleText $ "", |
| 94 | + styleText $ " 2. Run the development database (and leave it running):", |
| 95 | + styleCode $ " wasp db start", |
| 96 | + styleText $ "", |
| 97 | + styleText $ " 3. Open new terminal window (or tab) in that same dir and continue in it.", |
| 98 | + styleText $ "", |
| 99 | + styleText $ " 4. Apply initial database migrations:", |
| 100 | + styleCode $ " wasp db migrate-dev", |
| 101 | + styleText $ "", |
| 102 | + styleText $ " 5. Create initial dot env file from the template:", |
| 103 | + styleCode $ " cp .env.server.example .env.server", |
| 104 | + styleText $ "", |
| 105 | + styleText $ " 6. Last step: run the app!", |
| 106 | + styleCode $ " wasp start", |
| 107 | + styleText $ "", |
| 108 | + styleText $ "Check the README for additional guidance and the link to docs!" |
| 109 | + ] |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | +-- NOTE: As version of Wasp CLI changes, so we should update this tag name here, |
| 114 | +-- and also create it on gh repos of templates. |
| 115 | +-- By tagging templates for each version of Wasp CLI, we ensure that each release of |
| 116 | +-- Wasp CLI uses correct version of templates, that work with it. |
| 117 | +waspVersionTemplateGitTag :: String |
| 118 | +waspVersionTemplateGitTag = "wasp-v0.18-template" |
0 commit comments