Set node version of generated project to current LTS version.

This commit is contained in:
Martin Sosic 2020-09-22 14:55:16 +02:00 committed by Martin Šošić
parent d1c7343392
commit 5a0ddf71f5
4 changed files with 10 additions and 8 deletions

View File

@ -1,3 +1,4 @@
{{={= =}=}}
{
"name": "server",
"version": "0.0.0",
@ -9,8 +10,7 @@
"standard": "standard"
},
"engines": {
"node": "^14.0.0",
"npm": "^6.0.0"
"node": ">={= nodeVersion =}"
},
"dependencies": {
"cookie-parser": "~1.4.4",

View File

@ -38,7 +38,7 @@ print_usage () {
"Builds the project."
print_usage_cmd "test" \
"Builds the project and executes tests."
print_usage_cmd "exec <args>" \
print_usage_cmd "wasp <args>" \
"Builds the project once and runs the wasp executable while forwarding arguments."
print_usage_cmd "ghcid" \
"Runs ghcid, which watches source file changes and reports errors. Does not watch tests."
@ -62,7 +62,7 @@ case $COMMAND in
test)
echo_and_eval "$TEST_CMD"
;;
exec)
wasp)
echo_and_eval "$BUILD_CMD"
echo
echo_and_eval "$EXEC_CMD"

View File

@ -12,8 +12,8 @@ data ProjectRootDir -- ^ Directory where the whole web app project (client, serv
-- | Node version that node packages generated by this generator expect.
-- (major, minor, patch)
nodeVersion :: (Int, Int, Int)
nodeVersion = (14, 5, 0)
nodeVersion = (12, 18, 0) -- Latest LTS version.
nodeVersionAsText :: String
nodeVersionAsText = printf "v%d.%d.%d" major minor patch
nodeVersionAsText = printf "%d.%d.%d" major minor patch
where (major, minor, patch) = nodeVersion

View File

@ -36,7 +36,9 @@ genReadme :: Wasp -> FileDraft
genReadme _ = C.copyTmplAsIs (asTmplFile [P.relfile|README.md|])
genPackageJson :: Wasp -> FileDraft
genPackageJson _ = C.copyTmplAsIs (asTmplFile [P.relfile|package.json|])
genPackageJson _ = C.makeTemplateFD (asTmplFile [P.relfile|package.json|])
(asServerFile [P.relfile|package.json|])
(Just (object ["nodeVersion" .= nodeVersionAsText]))
genNpmrc :: Wasp -> FileDraft
genNpmrc _ = C.makeTemplateFD (asTmplFile [P.relfile|npmrc|])
@ -46,7 +48,7 @@ genNpmrc _ = C.makeTemplateFD (asTmplFile [P.relfile|npmrc|])
genNvmrc :: Wasp -> FileDraft
genNvmrc _ = C.makeTemplateFD (asTmplFile [P.relfile|nvmrc|])
(asServerFile [P.relfile|.nvmrc|])
(Just (object ["nodeVersion" .= nodeVersionAsText]))
(Just (object ["nodeVersion" .= ('v' : nodeVersionAsText)]))
genGitignore :: Wasp -> FileDraft
genGitignore _ = C.makeTemplateFD (asTmplFile [P.relfile|gitignore|])