From 40f1f9714ebebdece9a76008acf1e17e5cedba58 Mon Sep 17 00:00:00 2001 From: zomars Date: Mon, 23 May 2022 13:17:43 -0600 Subject: [PATCH] Build fixes --- package.json | 14 +++---- scripts/vercel-deploy.sh | 81 +++++++++++++--------------------------- tsconfig.json | 8 +--- 3 files changed, 34 insertions(+), 69 deletions(-) diff --git a/package.json b/package.json index af6ff39268..ede2ad9f15 100644 --- a/package.json +++ b/package.json @@ -10,19 +10,19 @@ "node": ">=14.19.x" }, "scripts": { - "dev": "next build && PORT=3002 next start", - "dev-real": "PORT=3002 next dev", - "start": "PORT=3002 next start", "build": "next build", - "lint": "next lint", + "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist", + "dev-real": "PORT=3002 next dev", + "dev": "next build && PORT=3002 next start", "lint-fix": "next lint --fix && prettier --write .", + "lint": "next lint", + "prebuild": "cd ../.. && yarn workspace @calcom/prisma generate-schemas", + "start": "PORT=3002 next start", "test": "jest --detectOpenHandles --passWithNoTests", - "type-check": "tsc --pretty --noEmit", - "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist" + "type-check": "tsc --pretty --noEmit" }, "devDependencies": { "@calcom/tsconfig": "*", - "@typescript-eslint/eslint-plugin": "^5.25.0", "babel-jest": "^28.1.0", "jest": "^28.1.0", "node-mocks-http": "^1.11.0" diff --git a/scripts/vercel-deploy.sh b/scripts/vercel-deploy.sh index 2c801645a1..0de5b672b4 100755 --- a/scripts/vercel-deploy.sh +++ b/scripts/vercel-deploy.sh @@ -1,27 +1,24 @@ # github submodule repo addresses without https:// prefix -BRANCH_TO_CLONE="-b feat/api-keys" - -# This didn't work ¯\_(ツ)_/¯ -# declare -A remotes=( -# ["apps/website"]="github.com/calcom/website" -# ["apps/api"]="github.com/calcom/api" -# ) +BRANCH_TO_CLONE="" +SUBMODULE_GITHUB=github.com/calcom/api +SUBMODULE_PATH=apps/api +COMMIT=$VERCEL_GIT_COMMIT_SHA if [ "$VERCEL_GIT_COMMIT_SHA" == "" ]; then - echo "Error: VERCEL_GIT_COMMIT_SHA is empty" - exit 0 + echo "Error: VERCEL_GIT_COMMIT_SHA is empty" + exit 0 fi # github access token is necessary # add it to Environment Variables on Vercel if [ "$GITHUB_ACCESS_TOKEN" == "" ]; then - echo "Error: GITHUB_ACCESS_TOKEN is empty" - exit 0 + echo "Error: GITHUB_ACCESS_TOKEN is empty" + exit 0 fi # We add an exception to test on staging if [ "$VERCEL_GIT_COMMIT_REF" == "staging" ]; then - BRANCH_TO_CLONE="-b $VERCEL_GIT_COMMIT_REF" + BRANCH_TO_CLONE="-b $VERCEL_GIT_COMMIT_REF" fi # stop execution on error - don't let it build if something goes wrong @@ -38,52 +35,26 @@ git clone $BRANCH_TO_CLONE https://$GITHUB_ACCESS_TOKEN@github.com/calcom/cal.co echo "Cloned" -# get submodule commit -output=$(git submodule status --recursive) # get submodule info +# set up an empty temporary work directory +rm -rf tmp || true # remove the tmp folder if exists +mkdir tmp # create the tmp folder +cd tmp # go into the tmp folder -# Extract each submodule commit hash and path -submodules=$(echo "$output" | sed "s/ /,/g") +# checkout the current submodule commit +git init # initialise empty repo +git remote add $SUBMODULE_PATH https://$GITHUB_ACCESS_TOKEN@$SUBMODULE_GITHUB # add origin of the submodule +git fetch --depth=1 $SUBMODULE_PATH $COMMIT # fetch only the required version +git checkout $COMMIT # checkout on the right commit -for submodule in $submodules; do - IFS=',' read -ra submodule_parts <<<"$submodule" - COMMIT=$(echo ${submodule_parts[0]} | sed "s/-/ /g") - SUBMODULE_PATH=${submodule_parts[1]} - echo "COMMIT: $COMMIT SUBMODULE_PATH: $SUBMODULE_PATH" +# move the submodule from tmp to the submodule path +cd .. # go folder up +rm -rf tmp/.git # remove .git +mv tmp/* $SUBMODULE_PATH/ # move the submodule to the submodule path - # This should be a hash table but couldn't make it work ¯\_(ツ)_/¯ - # SUBMODULE_GITHUB=$remotes[$SUBMODULE_PATH] - if [ "$SUBMODULE_PATH" == "apps/website" ]; then - SUBMODULE_GITHUB=github.com/calcom/website - fi +# clean up +rm -rf tmp # remove the tmp folder - if [ "$SUBMODULE_PATH" == "apps/api" ]; then - SUBMODULE_GITHUB=github.com/calcom/api - COMMIT=$VERCEL_GIT_COMMIT_SHA - fi - - echo "Submodule init" - - # set up an empty temporary work directory - rm -rf tmp || true # remove the tmp folder if exists - mkdir tmp # create the tmp folder - cd tmp # go into the tmp folder - - # checkout the current submodule commit - git init # initialise empty repo - git remote add $SUBMODULE_PATH https://$GITHUB_ACCESS_TOKEN@$SUBMODULE_GITHUB # add origin of the submodule - git fetch --depth=1 $SUBMODULE_PATH $COMMIT # fetch only the required version - git checkout $COMMIT # checkout on the right commit - - # move the submodule from tmp to the submodule path - cd .. # go folder up - rm -rf tmp/.git # remove .git - mv tmp/* $SUBMODULE_PATH/ # move the submodule to the submodule path - - # clean up - rm -rf tmp # remove the tmp folder -done - -git diff --quiet HEAD^ HEAD ':!/apps/docs/*' ':!/apps/website/*' ':!/apps/web/*' +git diff --quiet HEAD^ HEAD ':!/apps/docs/*' ':!/apps/website/*' ':!/apps/web/*' ':!/apps/swagger/*' ':!/apps/console/*' echo "✅ - Build can proceed" -exit 1 \ No newline at end of file +exit 1 diff --git a/tsconfig.json b/tsconfig.json index 26060017f9..2714b86c1c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,12 +9,6 @@ "@/*": ["*"] } }, - "include": [ - "next-env.d.ts", - "../../packages/types/*.d.ts", - "../../packages/types/next-auth.d.ts", - "**/*.ts", - "**/*.tsx" - ], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules", "templates", "auth"] }