From 5a0ddf71f50f7de2e3e3001fa68492cd0d5f5964 Mon Sep 17 00:00:00 2001 From: Martin Sosic Date: Tue, 22 Sep 2020 14:55:16 +0200 Subject: [PATCH] Set node version of generated project to current LTS version. --- waspc/data/Generator/templates/server/package.json | 4 ++-- waspc/run | 4 ++-- waspc/src/Generator/Common.hs | 4 ++-- waspc/src/Generator/ServerGenerator.hs | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/waspc/data/Generator/templates/server/package.json b/waspc/data/Generator/templates/server/package.json index d92dfd816..164c4228d 100644 --- a/waspc/data/Generator/templates/server/package.json +++ b/waspc/data/Generator/templates/server/package.json @@ -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", diff --git a/waspc/run b/waspc/run index 27a6c815b..a9761e451 100755 --- a/waspc/run +++ b/waspc/run @@ -38,7 +38,7 @@ print_usage () { "Builds the project." print_usage_cmd "test" \ "Builds the project and executes tests." - print_usage_cmd "exec " \ + print_usage_cmd "wasp " \ "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" diff --git a/waspc/src/Generator/Common.hs b/waspc/src/Generator/Common.hs index d5a97070e..dacf8ac73 100644 --- a/waspc/src/Generator/Common.hs +++ b/waspc/src/Generator/Common.hs @@ -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 diff --git a/waspc/src/Generator/ServerGenerator.hs b/waspc/src/Generator/ServerGenerator.hs index 04cd13266..69f69ea4c 100644 --- a/waspc/src/Generator/ServerGenerator.hs +++ b/waspc/src/Generator/ServerGenerator.hs @@ -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|])