From d841474dac65eac2858a8a03c1d5947911a7e615 Mon Sep 17 00:00:00 2001 From: Hugo Bernier Date: Sat, 11 Mar 2023 21:40:55 -0500 Subject: [PATCH] Added container and updated readme --- .../.devcontainer/devcontainer.json | 39 +++++++++++++++++++ .../.devcontainer/spfx-startup.sh | 33 ++++++++++++++++ samples/react-quick-links/README.md | 2 +- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 samples/react-quick-links/.devcontainer/devcontainer.json create mode 100644 samples/react-quick-links/.devcontainer/spfx-startup.sh diff --git a/samples/react-quick-links/.devcontainer/devcontainer.json b/samples/react-quick-links/.devcontainer/devcontainer.json new file mode 100644 index 000000000..5c924ea0b --- /dev/null +++ b/samples/react-quick-links/.devcontainer/devcontainer.json @@ -0,0 +1,39 @@ +// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer +{ + "name": "SPFx 1.15.2", + "image": "docker.io/m365pnp/spfx:1.15.2", + // Set *default* container specific settings.json values on container create. + "settings": {}, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "editorconfig.editorconfig", + "dbaeumer.vscode-eslint" + ], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 4321, + 35729 + ], + "portsAttributes": { + "4321": { + "protocol": "https", + "label": "Manifest", + "onAutoForward": "silent", + "requireLocalPort": true + }, + // Not needed for SPFx>= 1.12.1 + // "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-quick-links/.devcontainer/spfx-startup.sh b/samples/react-quick-links/.devcontainer/spfx-startup.sh new file mode 100644 index 000000000..456d6aea8 --- /dev/null +++ b/samples/react-quick-links/.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-quick-links/README.md b/samples/react-quick-links/README.md index 0fb856d66..ebd2960c7 100644 --- a/samples/react-quick-links/README.md +++ b/samples/react-quick-links/README.md @@ -75,7 +75,7 @@ There are still loads of ideas that I would love to see implemented, but right n | ------------------------------------------------------------------------------------------------------------------------------------- | ---- | | Drag 'n drop | ✅ | | Dynamic property pane | ✅ | -| Demonstrate PnP reusable consols | ✅ | +| Demonstrate PnP reusable controls | ✅ | | Styling Fluent UI | ✅ | | Audience targeting | ❌ | | Several layouts | ❌ |