From 85d878aa3986731a6e5ba9b5223a1a50b35a8ecf Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Tue, 18 Jan 2022 13:17:50 -0800 Subject: [PATCH 01/13] feat: initial codespaces support --- .devcontainer/Dockerfile | 18 ++++++++++++++++++ .devcontainer/devcontainer.json | 31 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..8849aed636 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,18 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.212.0/containers/javascript-node/.devcontainer/base.Dockerfile +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster +ARG VARIANT="16-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends bash-completion + +# [Optional] Uncomment if you want to install an additional version of node using nvm +# ARG EXTRA_NODE_VERSION=10 +# RUN su node -c "umask 0002 && ./usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" + +# [Optional] Uncomment if you want to install more global node modules +# RUN su node -c "npm install -g " +RUN su node -c "npm install -g npm-check-updates" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..e9ce54e0d8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.212.0/containers/javascript-node +{ + "name": "Node.js", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick a Node version: 16, 14, 12. + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local arm64/Apple Silicon. + "args": { "VARIANT": "16-bullseye" } + }, + // Set *default* container specific settings.json values on container create. + "settings": { + "git.enableCommitSigning": true + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "visualstudioexptteam.vscodeintellicode", + "amazonwebservices.aws-toolkit-vscode", + "github.copilot", + "firsttris.vscode-jest-runner" + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "npm ci; cd examples/cdk; npm ci; cd ../../; npm test; npm run init-environment", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "node" +} \ No newline at end of file From b8d7200912f3a9110cc9a0307bed9e190e4889ce Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Tue, 18 Jan 2022 21:27:01 +0000 Subject: [PATCH 02/13] chore: example commit to disable a plugin --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e9ce54e0d8..8e97b55b3e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,7 +18,7 @@ "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "visualstudioexptteam.vscodeintellicode", - "amazonwebservices.aws-toolkit-vscode", + // "amazonwebservices.aws-toolkit-vscode", "github.copilot", "firsttris.vscode-jest-runner" ], From 2bd97c6a398c35da49a668d94898b96b5f1cfdfa Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Tue, 18 Jan 2022 22:42:20 +0000 Subject: [PATCH 03/13] fix: rather use lerna-ci --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8e97b55b3e..4510c438ed 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,7 +24,7 @@ ], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "npm ci; cd examples/cdk; npm ci; cd ../../; npm test; npm run init-environment", + "postCreateCommand": "npm ci; cd examples/cdk; npm run lerna-ci; npm run init-environment", // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "node" From 3364a886846e278f769326f47a195034453a4e18 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Tue, 18 Jan 2022 22:50:14 +0000 Subject: [PATCH 04/13] fix: forgot to remove "cd "to examples --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4510c438ed..a2f17043d7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,7 +24,7 @@ ], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "npm ci; cd examples/cdk; npm run lerna-ci; npm run init-environment", + "postCreateCommand": "npm ci; npm run lerna-ci; npm run init-environment", // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "node" From 16510d2196a515a6c193f344c2c61b10d2283fe4 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Wed, 19 Jan 2022 06:15:54 +0000 Subject: [PATCH 05/13] feat: Add gitpod support --- .devcontainer/devcontainer.json | 4 +++- .gitpod.yml | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .gitpod.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a2f17043d7..ad2ce6b2ea 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,16 +9,18 @@ // Use -bullseye variants on local arm64/Apple Silicon. "args": { "VARIANT": "16-bullseye" } }, + // Set *default* container specific settings.json values on container create. "settings": { "git.enableCommitSigning": true }, + // Add the IDs of extensions you want installed when the container is created. "extensions": [ "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "visualstudioexptteam.vscodeintellicode", - // "amazonwebservices.aws-toolkit-vscode", + "amazonwebservices.aws-toolkit-vscode", "github.copilot", "firsttris.vscode-jest-runner" ], diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000000..b291022d86 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,7 @@ +tasks: + - init: npm ci; npm run lerna-ci; npm run init-environment +vscode: + extensions: + - dbaeumer.vscode-eslint + - esbenp.prettier-vscode + - firsttris.vscode-jest-runner From da65a2ebbdda06c199168a7607e8a6e975a44ef6 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Tue, 18 Jan 2022 22:26:41 -0800 Subject: [PATCH 06/13] chore: move to node 14 for both gitpod and codespaces --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 2 +- .gitpod.yml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8849aed636..eec4d11a54 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,6 @@ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.212.0/containers/javascript-node/.devcontainer/base.Dockerfile # [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster -ARG VARIANT="16-bullseye" +ARG VARIANT="14-bullseye" FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} # [Optional] Uncomment this section to install additional OS packages. diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ad2ce6b2ea..f6ce28c972 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ // Update 'VARIANT' to pick a Node version: 16, 14, 12. // Append -bullseye or -buster to pin to an OS version. // Use -bullseye variants on local arm64/Apple Silicon. - "args": { "VARIANT": "16-bullseye" } + "args": { "VARIANT": "14-bullseye" } }, // Set *default* container specific settings.json values on container create. diff --git a/.gitpod.yml b/.gitpod.yml index b291022d86..8d7050f0ca 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -5,3 +5,5 @@ vscode: - dbaeumer.vscode-eslint - esbenp.prettier-vscode - firsttris.vscode-jest-runner +image: + file: .devcontainer/Dockerfile \ No newline at end of file From 2c2e4ca35c74f5eee522c551eacd08bf2d7cf4a2 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Tue, 18 Jan 2022 22:34:41 -0800 Subject: [PATCH 07/13] fix: gitpod specific way --- .gitpod.Dockerfile | 3 +++ .gitpod.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .gitpod.Dockerfile diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 0000000000..636168236e --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,3 @@ +FROM gitpod/workspace-full:latest +RUN bash -c 'VERSION="v14.18.3" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION' +RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 8d7050f0ca..ce86166a90 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -6,4 +6,4 @@ vscode: - esbenp.prettier-vscode - firsttris.vscode-jest-runner image: - file: .devcontainer/Dockerfile \ No newline at end of file + file: .gitpod.Dockerfile \ No newline at end of file From 96c743d9f9c1b900ca587de9657d3b7785648414 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Wed, 19 Jan 2022 06:43:50 +0000 Subject: [PATCH 08/13] chore: use nvmrc to ease shared config --- .devcontainer/devcontainer.json | 3 ++- .gitpod.Dockerfile | 3 --- .gitpod.yml | 5 ++--- .nvmrc | 1 + 4 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 .gitpod.Dockerfile create mode 100644 .nvmrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f6ce28c972..fb655015c5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,10 +19,11 @@ "extensions": [ "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", + "firsttris.vscode-jest-runner", "visualstudioexptteam.vscodeintellicode", "amazonwebservices.aws-toolkit-vscode", "github.copilot", - "firsttris.vscode-jest-runner" + "ms-azuretools.vscode-docker" ], // Use 'postCreateCommand' to run commands after the container is created. diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile deleted file mode 100644 index 636168236e..0000000000 --- a/.gitpod.Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM gitpod/workspace-full:latest -RUN bash -c 'VERSION="v14.18.3" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION' -RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index ce86166a90..1a8e4f0c47 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,9 +1,8 @@ tasks: - - init: npm ci; npm run lerna-ci; npm run init-environment + - init: nvm install; nvm use; npm ci; npm run lerna-ci; npm run init-environment vscode: extensions: - dbaeumer.vscode-eslint - esbenp.prettier-vscode - firsttris.vscode-jest-runner -image: - file: .gitpod.Dockerfile \ No newline at end of file + - ms-azuretools.vscode-docker \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..3beeadf2c3 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v14.18.3 \ No newline at end of file From 5de9ec1d5197d15d2ccde9a125af59580d300359 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Fri, 21 Jan 2022 23:01:12 +0000 Subject: [PATCH 09/13] docs: comment out docs for gitpod --- .devcontainer/devcontainer.json | 1 - CONTRIBUTING.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fb655015c5..1ba0a138f3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,7 +22,6 @@ "firsttris.vscode-jest-runner", "visualstudioexptteam.vscodeintellicode", "amazonwebservices.aws-toolkit-vscode", - "github.copilot", "ms-azuretools.vscode-docker" ], diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee6ac11b2f..1c4a6b0087 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,7 +108,7 @@ Work your magic. Before starting make sure to check the [Getting Started](#Getti ## Getting Started The following steps describe how to set up the AWS Lambda Powertools (Typescript) repository on your local machine. - +The alternative is to use a Cloud IDE like [Gitpod](https://www.gitpod.io/) or [Codespaces](https://github.com/features/codespaces) for your development. ### Setup From e9fa5fffe3942cac95409841ff892dd810ff2c71 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Sat, 22 Jan 2022 09:36:31 -0800 Subject: [PATCH 10/13] fix: force npm to be 8 --- .devcontainer/Dockerfile | 2 +- .gitpod.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index eec4d11a54..ce1d12e9ca 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -15,4 +15,4 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # [Optional] Uncomment if you want to install more global node modules # RUN su node -c "npm install -g " -RUN su node -c "npm install -g npm-check-updates" +RUN su node -c "npm install -g npm-check-updates npm@next-8" diff --git a/.gitpod.yml b/.gitpod.yml index 1a8e4f0c47..f393a20684 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,5 @@ tasks: - - init: nvm install; nvm use; npm ci; npm run lerna-ci; npm run init-environment + - init: nvm install; nvm use; npm i -g npm@next-8; npm ci; npm run lerna-ci; npm run init-environment vscode: extensions: - dbaeumer.vscode-eslint From 2cd634a890d00976e65f40abe856082ecd558b54 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Sat, 22 Jan 2022 20:39:14 -0800 Subject: [PATCH 11/13] feat: finalize extensions --- .devcontainer/Dockerfile | 7 ++----- .devcontainer/devcontainer.json | 2 ++ .gitpod.yml | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ce1d12e9ca..1a7334ee80 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,9 +3,7 @@ ARG VARIANT="14-bullseye" FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends +# This section to install additional OS packages. RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends bash-completion @@ -13,6 +11,5 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # ARG EXTRA_NODE_VERSION=10 # RUN su node -c "umask 0002 && ./usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" -# [Optional] Uncomment if you want to install more global node modules -# RUN su node -c "npm install -g " +# Global node modules RUN su node -c "npm install -g npm-check-updates npm@next-8" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1ba0a138f3..6d94f3d566 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,6 +22,8 @@ "firsttris.vscode-jest-runner", "visualstudioexptteam.vscodeintellicode", "amazonwebservices.aws-toolkit-vscode", + "ms-vscode.vscode-typescript-tslint-plugin", + "hbenl.vscode-test-explorer", "ms-azuretools.vscode-docker" ], diff --git a/.gitpod.yml b/.gitpod.yml index f393a20684..1450950ac0 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -5,4 +5,6 @@ vscode: - dbaeumer.vscode-eslint - esbenp.prettier-vscode - firsttris.vscode-jest-runner - - ms-azuretools.vscode-docker \ No newline at end of file + - ms-azuretools.vscode-docker + - ms-vscode.vscode-typescript-tslint-plugin + - hbenl.vscode-test-explorer \ No newline at end of file From 98a8381f381f892cfff64408226a565c1be28263 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Sat, 22 Jan 2022 20:53:19 -0800 Subject: [PATCH 12/13] chore: remove ones that don't work --- .devcontainer/devcontainer.json | 3 +-- .gitpod.yml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6d94f3d566..a75d9fc0ae 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,8 +23,7 @@ "visualstudioexptteam.vscodeintellicode", "amazonwebservices.aws-toolkit-vscode", "ms-vscode.vscode-typescript-tslint-plugin", - "hbenl.vscode-test-explorer", - "ms-azuretools.vscode-docker" +\ "ms-azuretools.vscode-docker" ], // Use 'postCreateCommand' to run commands after the container is created. diff --git a/.gitpod.yml b/.gitpod.yml index 1450950ac0..65af352a5a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,4 +7,3 @@ vscode: - firsttris.vscode-jest-runner - ms-azuretools.vscode-docker - ms-vscode.vscode-typescript-tslint-plugin - - hbenl.vscode-test-explorer \ No newline at end of file From 274e3cca253a0cd39635827aeb3b81edd296ea15 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Sat, 22 Jan 2022 20:56:51 -0800 Subject: [PATCH 13/13] fix: container typo --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a75d9fc0ae..b4f8c88210 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,7 +23,7 @@ "visualstudioexptteam.vscodeintellicode", "amazonwebservices.aws-toolkit-vscode", "ms-vscode.vscode-typescript-tslint-plugin", -\ "ms-azuretools.vscode-docker" + "ms-azuretools.vscode-docker" ], // Use 'postCreateCommand' to run commands after the container is created.