-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use pre-built tarballs for wasp new -t saas
#3196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
10f0cf5
bcecf82
2e09bda
6cbcfd0
77b189b
962b907
0f5d775
ac9a37e
59b7398
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -438,7 +438,7 @@ Do the non-bold steps when necessary (decide for each step depending on the chan | |
- Check and merge all PRs with the label `merge-before-release`. | ||
- In `StarterTemplates.hs` file, update git tag to new version of Wasp we are about to release (e.g. `wasp-v0.13.1-template`). | ||
- Ensure that all starter templates are working with this new version of Wasp. | ||
Update Wasp version in their main.wasp files, and update their code as neccessary. Finally, in their repos (for those templates that are on Github), create new git tag that is the same as the new one in `StarterTemplates.hs` (e.g. `wasp-v0.13.1-template`). Now, once new wasp release is out, it will immediately be able to pull the correct and working version of the starter templates, which is why all this needs to happen before we release new wasp version. | ||
Update Wasp version in their main.wasp files, and update their code as neccessary. Finally, in their repos (for those templates that are on Github), create new git tag that is the same as the new one in `StarterTemplates.hs` (e.g. `wasp-v0.13.1-template`), and confirm that the GitHub action correctly ran and uploaded a `template.tar.gz` file. Now, once new wasp release is out, it will immediately be able to pull the correct and working version of the starter templates, which is why all this needs to happen before we release new wasp version. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On merging, I will update the release checklist on notion to add this note too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
- Open-saas also falls under this! | ||
- Make sure apps in [examples](/examples) are up to date and using a version compatible with the newest version of Wasp. | ||
- Make sure that Wasp AI (which is part of `waspc` and you can run it with e.g. `wasp new:ai`) is correctly producing apps that work with and use this newest version of Wasp. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ import Wasp.Util.Terminal (styleCode) | |
data StarterTemplate | ||
= -- | Template from a Github repo. | ||
GhRepoStarterTemplate !GhRepo.GithubRepoRef !DirBasedTemplateMetadata | ||
| -- | Template from a named GitHub Release asset. | ||
GhRepoReleaseAssetTemplate !GhRepo.GithubRepoRef !GhRepo.GithubReleaseAssetName !DirBasedTemplateMetadata | ||
| -- | Template from a disk, that comes bundled with wasp CLI. | ||
LocalStarterTemplate !DirBasedTemplateMetadata | ||
| -- | Template that will be dynamically generated by Wasp AI based on user's input. | ||
|
@@ -43,13 +45,15 @@ data DirBasedTemplateMetadata = DirBasedTemplateMetadata | |
|
||
instance Show StarterTemplate where | ||
show (GhRepoStarterTemplate _ metadata) = _name metadata | ||
show (GhRepoReleaseAssetTemplate _ _ metadata) = _name metadata | ||
show (LocalStarterTemplate metadata) = _name metadata | ||
show AiGeneratedStarterTemplate = "ai-generated" | ||
|
||
instance Interactive.IsOption StarterTemplate where | ||
showOption = show | ||
|
||
showOptionDescription (GhRepoStarterTemplate _ metadata) = Just $ _description metadata | ||
showOptionDescription (GhRepoReleaseAssetTemplate _ _ metadata) = Just $ _description metadata | ||
showOptionDescription (LocalStarterTemplate metadata) = Just $ _description metadata | ||
showOptionDescription AiGeneratedStarterTemplate = | ||
Just "🤖 Describe an app in a couple of sentences and have Wasp AI generate initial code for you. (experimental)" | ||
|
@@ -64,6 +68,7 @@ type StartingInstructionsBuilder = String -> String | |
getTemplateStartingInstructions :: String -> StarterTemplate -> String | ||
getTemplateStartingInstructions projectDirName = \case | ||
GhRepoStarterTemplate _ metadata -> _buildStartingInstructions metadata projectDirName | ||
GhRepoReleaseAssetTemplate _ _ metadata -> _buildStartingInstructions metadata projectDirName | ||
LocalStarterTemplate metadata -> _buildStartingInstructions metadata projectDirName | ||
AiGeneratedStarterTemplate -> | ||
unlines | ||
|
@@ -125,8 +130,8 @@ basicStarterTemplate = | |
|
||
openSaasStarterTemplate :: StarterTemplate | ||
openSaasStarterTemplate = | ||
simpleGhRepoTemplate | ||
("open-saas", [reldir|template|]) | ||
simpleGhReleaseAssetTemplate | ||
("open-saas", "template.tar.gz") | ||
( "saas", | ||
"Everything a SaaS needs! Comes with Auth, ChatGPT API, Tailwind, Stripe payments and more." | ||
<> " Check out https://opensaas.sh/ for more details." | ||
|
@@ -159,19 +164,20 @@ openSaasStarterTemplate = | |
styleText :: String -> String | ||
styleText = id | ||
|
||
simpleGhRepoTemplate :: (String, Path' Rel' Dir') -> (String, String) -> StartingInstructionsBuilder -> StarterTemplate | ||
simpleGhRepoTemplate (repoName, tmplPathInRepo) (tmplDisplayName, tmplDescription) buildStartingInstructions = | ||
GhRepoStarterTemplate | ||
Comment on lines
-162
to
-164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to remove the old function, or the linter complained |
||
simpleGhReleaseAssetTemplate :: (String, GhRepo.GithubReleaseAssetName) -> (String, String) -> StartingInstructionsBuilder -> StarterTemplate | ||
simpleGhReleaseAssetTemplate (repoName, assetName) (tmplDisplayName, tmplDescription) buildStartingInstructions = | ||
GhRepoReleaseAssetTemplate | ||
( GhRepo.GithubRepoRef | ||
{ GhRepo._repoOwner = waspGhOrgName, | ||
GhRepo._repoName = repoName, | ||
GhRepo._repoReferenceName = waspVersionTemplateGitTag | ||
} | ||
) | ||
assetName | ||
( DirBasedTemplateMetadata | ||
{ _name = tmplDisplayName, | ||
_description = tmplDescription, | ||
_path = tmplPathInRepo, | ||
_path = [reldir|.|], | ||
infomiho marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
_buildStartingInstructions = buildStartingInstructions | ||
} | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Wasp.Cli.Command.CreateNewProject.StarterTemplates.GhReleaseAsset | ||
( createProjectOnDiskFromGhReleaseAssetTemplate, | ||
) | ||
where | ||
|
||
import Control.Monad.IO.Class (liftIO) | ||
import StrongPath (Abs, Dir, Dir', Path', Rel') | ||
import Wasp.Cli.Command (Command) | ||
import Wasp.Cli.Command.CreateNewProject.Common (throwProjectCreationError) | ||
import Wasp.Cli.Command.CreateNewProject.ProjectDescription (NewProjectAppName, NewProjectName) | ||
import Wasp.Cli.Command.CreateNewProject.StarterTemplates.Templating (replaceTemplatePlaceholdersInTemplateFiles) | ||
import Wasp.Cli.GithubRepo (GithubReleaseAssetName, GithubRepoRef, fetchFolderFromGithubReleaseAssetToDisk) | ||
import Wasp.Project (WaspProjectDir) | ||
|
||
createProjectOnDiskFromGhReleaseAssetTemplate :: | ||
infomiho marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Path' Abs (Dir WaspProjectDir) -> | ||
NewProjectName -> | ||
NewProjectAppName -> | ||
GithubRepoRef -> | ||
GithubReleaseAssetName -> | ||
Path' Rel' Dir' -> | ||
Command () | ||
createProjectOnDiskFromGhReleaseAssetTemplate absWaspProjectDir projectName appName ghRepoRef assetName templatePathInRepo = do | ||
fetchTheTemplateFromGhToDisk >>= either throwProjectCreationError pure | ||
liftIO $ replaceTemplatePlaceholdersInTemplateFiles appName projectName absWaspProjectDir | ||
where | ||
fetchTheTemplateFromGhToDisk = do | ||
liftIO $ fetchFolderFromGithubReleaseAssetToDisk ghRepoRef assetName templatePathInRepo absWaspProjectDir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt like boasting a bit 😁