Skip to content

Commit 364f83a

Browse files
authored
Merge pull request #91 from FBoucher/vnext
This is version 3!
2 parents fc3025e + 639a39a commit 364f83a

127 files changed

Lines changed: 3825 additions & 2109 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Find the Dockerfile at this URL
2+
# https://github.com/Azure/azure-functions-docker/blob/dev/host/4/bullseye/amd64/python/python39/python39-core-tools.Dockerfile
3+
FROM mcr.microsoft.com/azure-functions/python:4-python3.9-core-tools
4+
5+
# Copy library scripts to execute
6+
COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/
7+
8+
# Install Node.js, Azure Static Web Apps CLI and Azure Functions Core Tools
9+
ARG NODE_VERSION="16"
10+
ARG CORE_TOOLS_VERSION="4"
11+
ENV NVM_DIR="/usr/local/share/nvm" \
12+
NVM_SYMLINK_CURRENT=true \
13+
PATH="${NVM_DIR}/current/bin:${PATH}"
14+
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
15+
&& su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1" \
16+
&& su vscode -c "umask 0002 && npm install --cache /tmp/empty-cache -g @azure/static-web-apps-cli" \
17+
&& if [ $CORE_TOOLS_VERSION != "4" ]; then apt-get remove -y azure-functions-core-tools-4 && apt-get update && apt-get install -y "azure-functions-core-tools-${CORE_TOOLS_VERSION}"; fi \
18+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
19+
20+
# [Optional] Uncomment this section to install additional OS packages.
21+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
22+
# && apt-get -y install --no-install-recommends <your-package-list-here>
23+
24+
# [Optional] Uncomment this line to install global node packages.
25+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/azure-static-web-apps
3+
{
4+
"name": "Azure Static Web Apps",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Please look at runtime version support to make sure you're using compatible versions
9+
// https://docs.microsoft.com/en-us/azure/azure-functions/supported-languages#languages-by-runtime-version
10+
"NODE_VERSION": "16",
11+
"CORE_TOOLS_VERSION": "4"
12+
}
13+
},
14+
"forwardPorts": [ 7071, 4280 ],
15+
16+
// Set *default* container specific settings.json values on container create.
17+
"settings": {},
18+
19+
// Add the IDs of extensions you want installed when the container is created.
20+
"extensions": [
21+
"ms-azuretools.vscode-azurefunctions",
22+
"ms-azuretools.vscode-azurestaticwebapps",
23+
"ms-dotnettools.csharp",
24+
"ms-python.python",
25+
"dbaeumer.vscode-eslint",
26+
"ms-dotnettools.blazorwasm-companion",
27+
"eamodio.gitlens"
28+
],
29+
30+
// Use 'postCreateCommand' to run commands after the container is created.
31+
// "postCreateCommand": "node --version",
32+
33+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
34+
"remoteUser": "vscode"
35+
}
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
#!/bin/bash
2+
#-------------------------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5+
#-------------------------------------------------------------------------------------------------------------
6+
#
7+
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/node.md
8+
# Maintainer: The VS Code and Codespaces Teams
9+
#
10+
# Syntax: ./node-debian.sh [directory to install nvm] [node version to install (use "none" to skip)] [non-root user] [Update rc files flag] [install node-gyp deps]
11+
12+
export NVM_DIR=${1:-"/usr/local/share/nvm"}
13+
export NODE_VERSION=${2:-"lts"}
14+
USERNAME=${3:-"automatic"}
15+
UPDATE_RC=${4:-"true"}
16+
INSTALL_TOOLS_FOR_NODE_GYP="${5:-true}"
17+
export NVM_VERSION="0.38.0"
18+
19+
set -e
20+
21+
if [ "$(id -u)" -ne 0 ]; then
22+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
23+
exit 1
24+
fi
25+
26+
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
27+
rm -f /etc/profile.d/00-restore-env.sh
28+
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
29+
chmod +x /etc/profile.d/00-restore-env.sh
30+
31+
# Determine the appropriate non-root user
32+
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
33+
USERNAME=""
34+
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
35+
for CURRENT_USER in ${POSSIBLE_USERS[@]}; do
36+
if id -u ${CURRENT_USER} > /dev/null 2>&1; then
37+
USERNAME=${CURRENT_USER}
38+
break
39+
fi
40+
done
41+
if [ "${USERNAME}" = "" ]; then
42+
USERNAME=root
43+
fi
44+
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
45+
USERNAME=root
46+
fi
47+
48+
updaterc() {
49+
if [ "${UPDATE_RC}" = "true" ]; then
50+
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
51+
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
52+
echo -e "$1" >> /etc/bash.bashrc
53+
fi
54+
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
55+
echo -e "$1" >> /etc/zsh/zshrc
56+
fi
57+
fi
58+
}
59+
60+
# Function to run apt-get if needed
61+
apt_get_update_if_needed()
62+
{
63+
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
64+
echo "Running apt-get update..."
65+
apt-get update
66+
else
67+
echo "Skipping apt-get update."
68+
fi
69+
}
70+
71+
# Checks if packages are installed and installs them if not
72+
check_packages() {
73+
if ! dpkg -s "$@" > /dev/null 2>&1; then
74+
apt_get_update_if_needed
75+
apt-get -y install --no-install-recommends "$@"
76+
fi
77+
}
78+
79+
# Ensure apt is in non-interactive to avoid prompts
80+
export DEBIAN_FRONTEND=noninteractive
81+
82+
# Install dependencies
83+
check_packages apt-transport-https curl ca-certificates tar gnupg2 dirmngr
84+
85+
# Install yarn
86+
if type yarn > /dev/null 2>&1; then
87+
echo "Yarn already installed."
88+
else
89+
# Import key safely (new method rather than deprecated apt-key approach) and install
90+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarn-archive-keyring.gpg
91+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
92+
apt-get update
93+
apt-get -y install --no-install-recommends yarn
94+
fi
95+
96+
# Adjust node version if required
97+
if [ "${NODE_VERSION}" = "none" ]; then
98+
export NODE_VERSION=
99+
elif [ "${NODE_VERSION}" = "lts" ]; then
100+
export NODE_VERSION="lts/*"
101+
fi
102+
103+
# Create a symlink to the installed version for use in Dockerfile PATH statements
104+
export NVM_SYMLINK_CURRENT=true
105+
106+
# Install the specified node version if NVM directory already exists, then exit
107+
if [ -d "${NVM_DIR}" ]; then
108+
echo "NVM already installed."
109+
if [ "${NODE_VERSION}" != "" ]; then
110+
su ${USERNAME} -c ". $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION} && nvm clear-cache"
111+
fi
112+
exit 0
113+
fi
114+
115+
# Create nvm group, nvm dir, and set sticky bit
116+
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
117+
groupadd -r nvm
118+
fi
119+
umask 0002
120+
usermod -a -G nvm ${USERNAME}
121+
mkdir -p ${NVM_DIR}
122+
chown :nvm ${NVM_DIR}
123+
chmod g+s ${NVM_DIR}
124+
su ${USERNAME} -c "$(cat << EOF
125+
set -e
126+
umask 0002
127+
# Do not update profile - we'll do this manually
128+
export PROFILE=/dev/null
129+
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash
130+
source ${NVM_DIR}/nvm.sh
131+
if [ "${NODE_VERSION}" != "" ]; then
132+
nvm alias default ${NODE_VERSION}
133+
fi
134+
nvm clear-cache
135+
EOF
136+
)" 2>&1
137+
# Update rc files
138+
if [ "${UPDATE_RC}" = "true" ]; then
139+
updaterc "$(cat <<EOF
140+
export NVM_DIR="${NVM_DIR}"
141+
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
142+
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
143+
EOF
144+
)"
145+
fi
146+
147+
# If enabled, verify "python3", "make", "gcc", "g++" commands are available so node-gyp works - https://github.com/nodejs/node-gyp
148+
if [ "${INSTALL_TOOLS_FOR_NODE_GYP}" = "true" ]; then
149+
echo "Verifying node-gyp OS requirements..."
150+
to_install=""
151+
if ! type make > /dev/null 2>&1; then
152+
to_install="${to_install} make"
153+
fi
154+
if ! type gcc > /dev/null 2>&1; then
155+
to_install="${to_install} gcc"
156+
fi
157+
if ! type g++ > /dev/null 2>&1; then
158+
to_install="${to_install} g++"
159+
fi
160+
if ! type python3 > /dev/null 2>&1; then
161+
to_install="${to_install} python3-minimal"
162+
fi
163+
if [ ! -z "${to_install}" ]; then
164+
apt_get_update_if_needed
165+
apt-get -y install ${to_install}
166+
fi
167+
fi
168+
169+
echo "Done!"

.github/FUNDING.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# These are supported funding model platforms
2-
3-
github: [fboucher]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4-
patreon: # Replace with a single Patreon username
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
otechie: # Replace with a single Otechie username
12-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
1+
# These are supported funding model platforms
2+
3+
github: [fboucher]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- feature/security
7+
pull_request:
8+
types: [opened, synchronize, reopened, closed]
9+
branches:
10+
- feature/security
11+
12+
jobs:
13+
build_and_deploy_job:
14+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15+
runs-on: ubuntu-latest
16+
name: Build and Deploy Job
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
submodules: true
21+
- name: Build And Deploy
22+
id: builddeploy
23+
uses: Azure/static-web-apps-deploy@v1
24+
with:
25+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ICY_COAST_0871EE210 }}
26+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
27+
action: "upload"
28+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
29+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
30+
app_location: "src/client" # App source code path
31+
api_location: "src/api" # Api source code path - optional
32+
output_location: "wwwroot" # Built app content directory - optional
33+
###### End of Repository/Build Configurations ######
34+
35+
close_pull_request_job:
36+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
37+
runs-on: ubuntu-latest
38+
name: Close Pull Request Job
39+
steps:
40+
- name: Close Pull Request
41+
id: closepullrequest
42+
uses: Azure/static-web-apps-deploy@v1
43+
with:
44+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ICY_COAST_0871EE210 }}
45+
action: "close"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- vnext
7+
pull_request:
8+
types: [opened, synchronize, reopened, closed]
9+
branches:
10+
- vnext
11+
12+
jobs:
13+
build_and_deploy_job:
14+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15+
runs-on: ubuntu-latest
16+
name: Build and Deploy Job
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
submodules: true
21+
- name: Build And Deploy
22+
id: builddeploy
23+
uses: Azure/static-web-apps-deploy@v1
24+
with:
25+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_LEMON_FOREST_06C374B0F }}
26+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
27+
action: "upload"
28+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
29+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
30+
app_location: "src/TinyBlazorAdmin" # App source code path
31+
api_location: "src/AdminApi" # Api source code path - optional
32+
output_location: "wwwroot" # Built app content directory - optional
33+
###### End of Repository/Build Configurations ######
34+
35+
close_pull_request_job:
36+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
37+
runs-on: ubuntu-latest
38+
name: Close Pull Request Job
39+
steps:
40+
- name: Close Pull Request
41+
id: closepullrequest
42+
uses: Azure/static-web-apps-deploy@v1
43+
with:
44+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_LEMON_FOREST_06C374B0F }}
45+
action: "close"

0 commit comments

Comments
 (0)