From b0a7c1ffd726477112256a71cfce1362802bec2b Mon Sep 17 00:00:00 2001 From: pookmish Date: Mon, 18 Mar 2024 20:46:24 -0700 Subject: [PATCH] Improve gitpod setup (#124) --- .env.example | 12 ++--- .gitpod.yml | 101 +++++++++++++++++++++++++++++++++---- next.config.js | 3 ++ package.json | 16 +++--- yarn.lock | 132 ++++++++++++++++++++++++------------------------- 5 files changed, 173 insertions(+), 91 deletions(-) diff --git a/.env.example b/.env.example index 096de1ca..54c5b260 100644 --- a/.env.example +++ b/.env.example @@ -2,14 +2,14 @@ NEXT_PUBLIC_DRUPAL_BASE_URL=https://library-dev.sites-pro.stanford.edu NEXT_PUBLIC_SITE_NAME=Local Environment # Grab these from the Vercel Environment Variables. -#DRUPAL_DRAFT_CLIENT=CLIENT -#DRUPAL_DRAFT_SECRET=SECRET -#DRUPAL_PREVIEW_SECRET=SECRET -#DRUPAL_REVALIDATE_SECRET=SECRET +#DRUPAL_DRAFT_CLIENT=DRUPAL_DRAFT_CLIENT +#DRUPAL_DRAFT_SECRET=DRUPAL_DRAFT_SECRET +#DRUPAL_PREVIEW_SECRET=DRUPAL_PREVIEW_SECRET +#DRUPAL_REVALIDATE_SECRET=DRUPAL_REVALIDATE_SECRET # LibApps credentials. -#LIBGUIDE_CLIENT_ID=ID -#LIBGUIDE_CLIENT_SECRET=SECRET +#LIBGUIDE_CLIENT_ID=LIBGUIDE_CLIENT_ID +#LIBGUIDE_CLIENT_SECRET=LIBGUIDE_CLIENT_SECRET # To build every page when running `yarn build`, change this to 'true' (prod environment). BUILD_COMPLETE=false \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 0a660359..a6c06ac2 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,10 +1,91 @@ -mainConfiguration: https://github.com/SU-SWS/ace-sulgryphon -github: - prebuilds: - master: true - branches: false - pullRequests: true - pullRequestsFromForks: false - addCheck: false - addComment: false - addBadge: true + +additionalRepositories: + - url: https://github.com/SU-SWS/ace-stanfordlagunita/ + checkoutLocation: back +checkoutLocation: front +ports: + - name: database + description: Mysql database + port: 3306 + onOpen: ignore + visibility: private + - port: 33060 + onOpen: ignore + visibility: private + - name: drupal + description: Drupal backend + port: 8001 + onOpen: ignore + visibility: public + - name: frontend + description: NextJS frontend + port: 3000 + onOpen: ignore + visibility: public + - port: 8002-9999 + onOpen: ignore +image: pookmish/drupal8ci:gitpod +tasks: + - name: Drupal Prep + init: > + eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) && + cd /workspace/back && + rm -rf config/default && + mkdir -p config/default && + touch config/default/core.extension.yml && + composer install --no-interaction && + mkdir -p blt && + cp .gitpod/blt.yml blt/local.blt.yml && + find docroot/sites/ -name 'local*' | xargs rm -rf && + export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` && + export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} && + blt blt:telemetry:disable --no-interaction && + blt settings && + blt drupal:install --site=library -n && + drush @library.local cset system.theme default claro -y && + cd /workspace/front && + cp .env.example .env.local && + sed -i 's/#DRUPAL_REVALIDATE_SECRET/DRUPAL_REVALIDATE_SECRET/' .env.local && + sed -i 's/#DRUPAL_PREVIEW_SECRET/DRUPAL_PREVIEW_SECRET/' .env.local && + yarn install + command: | + cd /workspace/back && + echo 'Restarting Apache' && + eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) && + apache2ctl restart && + gp ports await 8001 && + find docroot -name 'local.drush.yml' | xargs rm && + export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` && + export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} && + echo " docroot/sites/local.sites.php && + blt blt:telemetry:disable --no-interaction && + echo 'Establishing Settings' && + blt settings && + echo 'Logging Into Drupal' && + drush @library.local uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL && + drush @library.local uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL | xargs gp preview --external && + git config core.fileMode false && + echo 'Connecting Drupal to Frontend' && + drush @library.local su-next-connect "$(gp url 3000)" --preview-secret=DRUPAL_PREVIEW_SECRET --revalidation-secret=DRUPAL_REVALIDATION_SECRET && + cd /workspace/front && + yarn install && + sed -i -r "s|NEXT_PUBLIC_DRUPAL_BASE_URL.*|NEXT_PUBLIC_DRUPAL_BASE_URL=$NEXT_PUBLIC_DRUPAL_BASE_URL|g" .env.local && + yarn dev & + gp ports await 3000 && + gp url 3000 | xargs gp preview --external + - name: SSH Keys + before: | + mkdir -p ~/.ssh + if [[ ! -z $SSH_PUBLIC_KEY ]]; then + echo $SSH_PUBLIC_KEY | base64 -d > ~/.ssh/id_rsa.pub && chmod 644 ~/.ssh/id_rsa.pub + fi + if [[ ! -z $SSH_PRIVATE_KEY ]]; then + echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + fi + if [[ ! -z $GITCONFIG ]]; then + echo $GITCONFIG | base64 -d > ~/.gitconfig && chmod 644 ~/.gitconfig + fi + +vscode: + extensions: + - bradlc.vscode-tailwindcss \ No newline at end of file diff --git a/next.config.js b/next.config.js index 9091a95e..2d9d9386 100644 --- a/next.config.js +++ b/next.config.js @@ -11,6 +11,9 @@ module.exports = { protocol: drupalUrl.protocol.replace(':', ''), hostname: drupalUrl.hostname, }, + { + hostname: '**.gitpod.io' + } ], }, eslint: { diff --git a/package.json b/package.json index ae030b45..9eaabc69 100644 --- a/package.json +++ b/package.json @@ -14,15 +14,15 @@ "dependencies": { "@formkit/auto-animate": "^0.8.1", "@heroicons/react": "^2.1.1", - "@mui/base": "^5.0.0-beta.38", + "@mui/base": "^5.0.0-beta.39", "@next/third-parties": "^14.1.3", "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/typography": "^0.5.10", - "@tanstack/react-query": "^5.25.0", - "@types/node": "^20.11.25", - "@types/react": "^18.2.64", + "@tanstack/react-query": "^5.28.4", + "@types/node": "^20.11.29", + "@types/react": "^18.2.67", "autoprefixer": "^10.4.18", - "axios": "^1.6.7", + "axios": "^1.6.8", "critters": "^0.0.22", "decanter": "^7.2.0", "graphql": "^16.8.1", @@ -32,7 +32,7 @@ "jsona": "^1.12.1", "next": "^14.1.3", "next-drupal": "^1.6.0", - "postcss": "^8.4.35", + "postcss": "^8.4.36", "react": "^18.2.0", "react-aria": "^3.32.1", "react-dom": "^18.2.0", @@ -43,7 +43,7 @@ "react-stately": "^3.30.1", "react-tiny-oembed": "^1.1.0", "sharp": "^0.33.2", - "tailwind-merge": "^2.2.1", + "tailwind-merge": "^2.2.2", "tailwindcss": "^3.4.1", "typescript": "^5.4.2", "usehooks-ts": "^3.0.1" @@ -53,7 +53,7 @@ "@graphql-codegen/import-types-preset": "^3.0.0", "@graphql-codegen/typescript-graphql-request": "^6.2.0", "@graphql-codegen/typescript-operations": "4.2.0", - "@types/qs": "^6.9.12", + "@types/qs": "^6.9.13", "eslint": "^8.57.0", "eslint-config-next": "^14.1.3", "eslint-plugin-deprecation": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 7ec75e06..6331cdd0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -658,16 +658,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.23.7": - version: 7.23.8 - resolution: "@babel/runtime@npm:7.23.8" - dependencies: - regenerator-runtime: "npm:^0.14.0" - checksum: 10c0/ba5e8fbb32ef04f6cab5e89c54a0497c2fde7b730595cc1af93496270314f13ff2c6a9360fdb2f0bdd4d6b376752ce3cf85642bd6b876969a6a62954934c2df8 - languageName: node - linkType: hard - -"@babel/runtime@npm:^7.23.9": +"@babel/runtime@npm:^7.23.9, @babel/runtime@npm:^7.24.0": version: 7.24.0 resolution: "@babel/runtime@npm:7.24.0" dependencies: @@ -1912,14 +1903,14 @@ __metadata: languageName: node linkType: hard -"@mui/base@npm:^5.0.0-beta.38": - version: 5.0.0-beta.38 - resolution: "@mui/base@npm:5.0.0-beta.38" +"@mui/base@npm:^5.0.0-beta.39": + version: 5.0.0-beta.39 + resolution: "@mui/base@npm:5.0.0-beta.39" dependencies: "@babel/runtime": "npm:^7.23.9" "@floating-ui/react-dom": "npm:^2.0.8" "@mui/types": "npm:^7.2.13" - "@mui/utils": "npm:^5.15.12" + "@mui/utils": "npm:^5.15.13" "@popperjs/core": "npm:^2.11.8" clsx: "npm:^2.1.0" prop-types: "npm:^15.8.1" @@ -1930,7 +1921,7 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 10c0/0a23da4e32da0c157f4a97d5ca6cbf246b5ab4d5f894f903ff33a501e92f6ce13c784db27a03b64bb01dfd14cd726b6bbb90f578b6fcddd1d8ac6f119c42fa54 + checksum: 10c0/cfa73023afe91106476dc477cd567e5a283df237271b15f238292e3c626cfea7ba61eada4706aa8804a7ee75f3494e8679f3d57b213947d8c4a56e020aa08746 languageName: node linkType: hard @@ -1946,9 +1937,9 @@ __metadata: languageName: node linkType: hard -"@mui/utils@npm:^5.15.12": - version: 5.15.12 - resolution: "@mui/utils@npm:5.15.12" +"@mui/utils@npm:^5.15.13": + version: 5.15.13 + resolution: "@mui/utils@npm:5.15.13" dependencies: "@babel/runtime": "npm:^7.23.9" "@types/prop-types": "npm:^15.7.11" @@ -1960,7 +1951,7 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 10c0/ef6be5aa2b3183d6fbc1dccb0697433cb6610ee259e4d157386fe0a4ab9f40d0fd9637496195c811bf49304bb0ead4230a7c034a923b51fc42ebb9529555ad55 + checksum: 10c0/a001cc55833d1df0acfab4c3ec9fdb7c94012000c91ab23ae09745ead381faeef7c845f454ed4d6f5dc472604939158d9ee273ce5fb60f981a13f06233022c00 languageName: node linkType: hard @@ -3690,21 +3681,21 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:5.25.0": - version: 5.25.0 - resolution: "@tanstack/query-core@npm:5.25.0" - checksum: 10c0/2a0f48b45a9ff8add40d559197b7328a2b340976b3f7a6689cc5851fadf4f788f598e7f29769ebccb4477fc269eecb5c63d9bac4a508411577c0a1994236d501 +"@tanstack/query-core@npm:5.28.4": + version: 5.28.4 + resolution: "@tanstack/query-core@npm:5.28.4" + checksum: 10c0/0aca64c0e20c56fb4b6c0497f29613b0eb5c02eb2e2f99f2ed5616d7c119c18259c7171d25f593d00cd50e9ee1d2e629388968fcd53d0aa7fa95d820fc58cf9c languageName: node linkType: hard -"@tanstack/react-query@npm:^5.25.0": - version: 5.25.0 - resolution: "@tanstack/react-query@npm:5.25.0" +"@tanstack/react-query@npm:^5.28.4": + version: 5.28.4 + resolution: "@tanstack/react-query@npm:5.28.4" dependencies: - "@tanstack/query-core": "npm:5.25.0" + "@tanstack/query-core": "npm:5.28.4" peerDependencies: react: ^18.0.0 - checksum: 10c0/6b6e8114bebd1e5dfdc72c6a80a2cad2e93cec6583308df07a943eec551ae04eaba57101330a918051ddf826702951905a711c34e4509dad8606f70dd7b08272 + checksum: 10c0/5ffc31cedea548b697770c018fab7fcd35724caf6cf7d40a7370ef6ffeb2427f510ea9745a92ebd6e74f2c4c39a255eabcd2a181c97b54991563ad842945866e languageName: node linkType: hard @@ -3745,12 +3736,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.11.25": - version: 20.11.25 - resolution: "@types/node@npm:20.11.25" +"@types/node@npm:^20.11.29": + version: 20.11.29 + resolution: "@types/node@npm:20.11.29" dependencies: undici-types: "npm:~5.26.4" - checksum: 10c0/3a65a0469309d503e572a3198d81c9248876236b1bcc0c9943e995cfa536df7ce9a9302638258984877420d1613167a8a82dbfb3a92197319fb79ebebf9abc83 + checksum: 10c0/b839bad64b2d0e2b4a2d09a53c019ac06c732ac66ea88f3a86a9d2f28a789caf8fd56b888f577183459733abfa1b77e4bf6986cde18b2ec63e1939427aa0d387 languageName: node linkType: hard @@ -3761,21 +3752,21 @@ __metadata: languageName: node linkType: hard -"@types/qs@npm:^6.9.12": - version: 6.9.12 - resolution: "@types/qs@npm:6.9.12" - checksum: 10c0/21a74f2b78d0839cee37f1a632f3361352f7dceac9edffd117227a695a13e58e18c138aac1f29403f2408221e678f538ca0b37d55012f8bba96d55905edbfe82 +"@types/qs@npm:^6.9.13": + version: 6.9.13 + resolution: "@types/qs@npm:6.9.13" + checksum: 10c0/0e2dbfb6ee13657cd87742f92c94f1b7a70901452fce477fb9391928165766623581a3229b34fde3e832afbedee509de98984124f38b513ba072d6e193ea06cd languageName: node linkType: hard -"@types/react@npm:^18.2.64": - version: 18.2.64 - resolution: "@types/react@npm:18.2.64" +"@types/react@npm:^18.2.67": + version: 18.2.67 + resolution: "@types/react@npm:18.2.67" dependencies: "@types/prop-types": "npm:*" "@types/scheduler": "npm:*" csstype: "npm:^3.0.2" - checksum: 10c0/ab3ba9597990d08ffd419a5ad28fd22393c7a9a241ae455fb1d5d193d209471aa1909fa7ad016fd8d161eab6d0babba77b013b56a5170bedf78833085b9ee424 + checksum: 10c0/d8c49476ca8c96cbbcd8b1fd1bf881396dbf548fdadb0b6463d0bb262e5013e0a239994842d09e74f9c21dcaf620555bc1f1485f8578b0498af87bc06291f5a2 languageName: node linkType: hard @@ -4333,14 +4324,14 @@ __metadata: languageName: node linkType: hard -"axios@npm:^1.6.7": - version: 1.6.7 - resolution: "axios@npm:1.6.7" +"axios@npm:^1.6.8": + version: 1.6.8 + resolution: "axios@npm:1.6.8" dependencies: - follow-redirects: "npm:^1.15.4" + follow-redirects: "npm:^1.15.6" form-data: "npm:^4.0.0" proxy-from-env: "npm:^1.1.0" - checksum: 10c0/131bf8e62eee48ca4bd84e6101f211961bf6a21a33b95e5dfb3983d5a2fe50d9fffde0b57668d7ce6f65063d3dc10f2212cbcb554f75cfca99da1c73b210358d + checksum: 10c0/0f22da6f490335479a89878bc7d5a1419484fbb437b564a80c34888fc36759ae4f56ea28d55a191695e5ed327f0bad56e7ff60fb6770c14d1be6501505d47ab9 languageName: node linkType: hard @@ -4421,16 +4412,16 @@ __metadata: "@graphql-codegen/typescript-graphql-request": "npm:^6.2.0" "@graphql-codegen/typescript-operations": "npm:4.2.0" "@heroicons/react": "npm:^2.1.1" - "@mui/base": "npm:^5.0.0-beta.38" + "@mui/base": "npm:^5.0.0-beta.39" "@next/third-parties": "npm:^14.1.3" "@tailwindcss/container-queries": "npm:^0.1.1" "@tailwindcss/typography": "npm:^0.5.10" - "@tanstack/react-query": "npm:^5.25.0" - "@types/node": "npm:^20.11.25" - "@types/qs": "npm:^6.9.12" - "@types/react": "npm:^18.2.64" + "@tanstack/react-query": "npm:^5.28.4" + "@types/node": "npm:^20.11.29" + "@types/qs": "npm:^6.9.13" + "@types/react": "npm:^18.2.67" autoprefixer: "npm:^10.4.18" - axios: "npm:^1.6.7" + axios: "npm:^1.6.8" critters: "npm:^0.0.22" decanter: "npm:^7.2.0" eslint: "npm:^8.57.0" @@ -4444,7 +4435,7 @@ __metadata: jsona: "npm:^1.12.1" next: "npm:^14.1.3" next-drupal: "npm:^1.6.0" - postcss: "npm:^8.4.35" + postcss: "npm:^8.4.36" react: "npm:^18.2.0" react-aria: "npm:^3.32.1" react-dom: "npm:^18.2.0" @@ -4455,7 +4446,7 @@ __metadata: react-stately: "npm:^3.30.1" react-tiny-oembed: "npm:^1.1.0" sharp: "npm:^0.33.2" - tailwind-merge: "npm:^2.2.1" + tailwind-merge: "npm:^2.2.2" tailwindcss: "npm:^3.4.1" typescript: "npm:^5.4.2" usehooks-ts: "npm:^3.0.1" @@ -6035,13 +6026,13 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.4": - version: 1.15.4 - resolution: "follow-redirects@npm:1.15.4" +"follow-redirects@npm:^1.15.6": + version: 1.15.6 + resolution: "follow-redirects@npm:1.15.6" peerDependenciesMeta: debug: optional: true - checksum: 10c0/5f37ed9170c9eb19448c5418fdb0f2b73f644b5364834e70791a76ecc7db215246f9773bbef4852cfae4067764ffc852e047f744b661b0211532155b73556a6a + checksum: 10c0/9ff767f0d7be6aa6870c82ac79cf0368cd73e01bbc00e9eb1c2a16fbb198ec105e3c9b6628bb98e9f3ac66fe29a957b9645bcb9a490bb7aa0d35f908b6b85071 languageName: node linkType: hard @@ -8408,14 +8399,14 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.35": - version: 8.4.35 - resolution: "postcss@npm:8.4.35" +"postcss@npm:^8.4.36": + version: 8.4.36 + resolution: "postcss@npm:8.4.36" dependencies: nanoid: "npm:^3.3.7" picocolors: "npm:^1.0.0" - source-map-js: "npm:^1.0.2" - checksum: 10c0/e8dd04e48001eb5857abc9475365bf08f4e508ddf9bc0b8525449a95d190f10d025acebc5b56ac2e94b3c7146790e4ae78989bb9633cb7ee20d1cc9b7dc909b2 + source-map-js: "npm:^1.1.0" + checksum: 10c0/e7c834e31d8f4e8dfd0a427df36fdc7bdc58a16e373551618e2c3ac172019eb816b24f1b4709311ebcade8d3ba31b2d75522d28ef45ecbbeb11eb01f265579fb languageName: node linkType: hard @@ -9289,6 +9280,13 @@ __metadata: languageName: node linkType: hard +"source-map-js@npm:^1.1.0": + version: 1.1.0 + resolution: "source-map-js@npm:1.1.0" + checksum: 10c0/d1f016efe4fcf67fd92e36da0670f2889b13a36cc453329758336450e811c61164376eb451b453b4dd4e89a760f841b0a014942d54f240af31a791829bc0e336 + languageName: node + linkType: hard + "sponge-case@npm:^1.0.1": version: 1.0.1 resolution: "sponge-case@npm:1.0.1" @@ -9520,12 +9518,12 @@ __metadata: languageName: node linkType: hard -"tailwind-merge@npm:^2.2.1": - version: 2.2.1 - resolution: "tailwind-merge@npm:2.2.1" +"tailwind-merge@npm:^2.2.2": + version: 2.2.2 + resolution: "tailwind-merge@npm:2.2.2" dependencies: - "@babel/runtime": "npm:^7.23.7" - checksum: 10c0/14ab965ec897e9377484b7593f7a700dde09b8035b762ad42652622a3ed1f202b203f48c0f235c0b1b38e9390470d94458f6f9010d33a5a18d71b15f38b986a6 + "@babel/runtime": "npm:^7.24.0" + checksum: 10c0/68a5e199848a467aed4f8d1a8d7b6a5b583ff72f1d2801e018bf245eaa41e6564b63ead9e2b708a214cefbd843970c5e0a21754d5f2a20e2c1238e25955685ce languageName: node linkType: hard