From 1c6a0a60236cd8637c880406b8a30fec66b798ba Mon Sep 17 00:00:00 2001 From: Hugo Bernier Date: Sat, 10 Feb 2024 13:04:17 -0500 Subject: [PATCH] Added missing sample.json, devcontainer, updated readme --- .../.devcontainer/devcontainer.json | 38 ++++++ .../.devcontainer/spfx-startup.sh | 33 ++++++ samples/react-personal-tools-list/README.md | 92 +++++--------- .../assets/sample.json | 112 ++++++++++++++++++ 4 files changed, 215 insertions(+), 60 deletions(-) create mode 100644 samples/react-personal-tools-list/.devcontainer/devcontainer.json create mode 100644 samples/react-personal-tools-list/.devcontainer/spfx-startup.sh create mode 100644 samples/react-personal-tools-list/assets/sample.json diff --git a/samples/react-personal-tools-list/.devcontainer/devcontainer.json b/samples/react-personal-tools-list/.devcontainer/devcontainer.json new file mode 100644 index 000000000..86168112a --- /dev/null +++ b/samples/react-personal-tools-list/.devcontainer/devcontainer.json @@ -0,0 +1,38 @@ +{ + "name": "SPFx 1.18.0", + "image": "docker.io/m365pnp/spfx:1.18.0", + "customizations": { + "vscode": { + "extensions": [ + "editorconfig.editorconfig", + "dbaeumer.vscode-eslint" + ] + } + }, + "forwardPorts": [ + 4321, + 35729, + 5432 + ], + "portsAttributes": { + "4321": { + "protocol": "https", + "label": "Manifest", + "onAutoForward": "silent", + "requireLocalPort": true + }, + "5432": { + "protocol": "https", + "label": "Workbench", + "onAutoForward": "silent" + }, + "35729": { + "protocol": "https", + "label": "LiveReload", + "onAutoForward": "silent", + "requireLocalPort": true + } + }, + "postCreateCommand": "bash .devcontainer/spfx-startup.sh", + "remoteUser": "node" +} \ No newline at end of file diff --git a/samples/react-personal-tools-list/.devcontainer/spfx-startup.sh b/samples/react-personal-tools-list/.devcontainer/spfx-startup.sh new file mode 100644 index 000000000..456d6aea8 --- /dev/null +++ b/samples/react-personal-tools-list/.devcontainer/spfx-startup.sh @@ -0,0 +1,33 @@ +echo +echo -e "\e[1;94mInstalling Node dependencies\e[0m" +npm install + +## commands to create dev certificate and copy it to the root folder of the project +echo +echo -e "\e[1;94mGenerating dev certificate\e[0m" +gulp trust-dev-cert + +# Convert the generated PEM certificate to a CER certificate +openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer + +# Copy the PEM ecrtificate for non-Windows hosts +cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem + +## add *.cer to .gitignore to prevent certificates from being saved in repo +if ! grep -Fxq '*.cer' ./.gitignore + then + echo "# .CER Certificates" >> .gitignore + echo "*.cer" >> .gitignore +fi + +## add *.pem to .gitignore to prevent certificates from being saved in repo +if ! grep -Fxq '*.pem' ./.gitignore + then + echo "# .PEM Certificates" >> .gitignore + echo "*.pem" >> .gitignore +fi + +echo +echo -e "\e[1;92mReady!\e[0m" + +echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********" \ No newline at end of file diff --git a/samples/react-personal-tools-list/README.md b/samples/react-personal-tools-list/README.md index 7f0864417..e50dc9cf3 100644 --- a/samples/react-personal-tools-list/README.md +++ b/samples/react-personal-tools-list/README.md @@ -1,9 +1,9 @@ # Personal tools list / "My tools" - ## Summary -This webpart allows users to select tools from a predefined list and save them in their own personalized view. -This webpart has the fundamental functionallity - a great starting point to build upon if you need something more advanced. + +This web part allows users to select tools from a predefined list and save them in their own personalized view. +This web part has the fundamental functionality - a great starting point to build upon if you need something more advanced.