-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Closes #16 * Basic scaffolding for a new function app, including dev container. Will add testing and code architecture stuff with first function implementation, in #7 . * Added eslint
- Loading branch information
Showing
14 changed files
with
315 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/PatientTestsApi/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
#------------------------------------------------------------------------------------------------------------- | ||
|
||
FROM node:12 | ||
|
||
# Avoid warnings by switching to noninteractive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# The node image includes a non-root user with sudo access. Use the "remoteUser" | ||
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs | ||
# will be updated to match your local UID/GID (when using the dockerFile property). | ||
# See https://aka.ms/vscode-remote/containers/non-root-user for details. | ||
ARG USERNAME=node | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Configure apt and install packages | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ | ||
# | ||
# Verify git and needed tools are installed | ||
&& apt-get -y install \ | ||
git \ | ||
iproute2 \ | ||
procps \ | ||
curl \ | ||
apt-transport-https \ | ||
gnupg2 \ | ||
lsb-release \ | ||
# | ||
# Install Azure Functions, .NET Core, and Azure CLI | ||
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \ | ||
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \ | ||
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \ | ||
&& apt-get update \ | ||
&& apt-get install -y azure-cli dotnet-sdk-3.1 | ||
|
||
RUN npm i -g azure-functions-core-tools@3 --unsafe-perm true | ||
|
||
# Install Terraform | ||
RUN wget https://releases.hashicorp.com/terraform/0.12.21/terraform_0.12.21_linux_amd64.zip \ | ||
&& unzip terraform_0.12.21_linux_amd64.zip \ | ||
&& mv terraform /usr/local/bin/ \ | ||
&& rm terraform_0.12.21_linux_amd64.zip | ||
|
||
|
||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \ | ||
groupmod --gid $USER_GID $USERNAME \ | ||
&& usermod --uid $USER_UID --gid $USER_GID $USERNAME \ | ||
&& chown -R $USER_UID:$USER_GID /home/$USERNAME; \ | ||
fi \ | ||
# [Optional] Add add sudo support for non-root user | ||
&& apt-get install -y sudo \ | ||
&& echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
# | ||
# Install eslint and typescript | ||
&& npm install -g typescript eslint \ | ||
# | ||
# Clean up | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Switch back to dialog for any ad-hoc use of apt-get | ||
ENV DEBIAN_FRONTEND=dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at | ||
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/azure-functions-node-10 | ||
{ | ||
"name": "Azure Functions & Node.js 12", | ||
"dockerFile": "Dockerfile", | ||
"appPort": 7071, | ||
|
||
// Use 'settings' to set *default* container specific settings.json values on container create. | ||
// You can edit these settings after create using File > Preferences > Settings > Remote. | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash" | ||
}, | ||
|
||
// Uncomment the next line to run commands after the container is created. | ||
// "postCreateCommand": "npm install", | ||
|
||
// Uncomment the next line to have VS Code connect as an existing non-root user in the container. | ||
// On Linux, by default, the container user's UID/GID will be updated to match your local user. See | ||
// https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist. | ||
// "remoteUser": "node", | ||
|
||
// Add the IDs of extensions you want installed when the container is created in the array below. | ||
"extensions": [ | ||
"ms-azuretools.vscode-azurefunctions", | ||
"dbaeumer.vscode-eslint", | ||
"42crunch.vscode-openapi", | ||
"arjun.swagger-viewer", | ||
"alexkrechik.cucumberautocomplete", | ||
"mauve.terraform", | ||
"ms-vscode.vscode-typescript-tslint-plugin", | ||
"quicktype.quicktype", | ||
"hbenl.vscode-mocha-test-adapter" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# don't ever lint node_modules | ||
node_modules | ||
# don't lint build output (make sure it's set to your correct build folder name) | ||
dist | ||
# don't lint nyc coverage output | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"env": { | ||
"browser": false, | ||
"commonjs": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"standard" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2018 | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"semi": "off", | ||
"quotes": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
bin | ||
obj | ||
csx | ||
.vs | ||
edge | ||
Publish | ||
|
||
*.user | ||
*.suo | ||
*.cscfg | ||
*.Cache | ||
project.lock.json | ||
|
||
/packages | ||
/TestResults | ||
|
||
/tools/NuGet.exe | ||
/App_Data | ||
/secrets | ||
/data | ||
.secrets | ||
appsettings.json | ||
local.settings.json | ||
|
||
node_modules | ||
dist | ||
|
||
# Local python packages | ||
.python_packages/ | ||
|
||
# Python Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"ms-azuretools.vscode-azurefunctions" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Attach to Node Functions", | ||
"type": "node", | ||
"request": "attach", | ||
"port": 9229, | ||
"preLaunchTask": "func: host start" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"azureFunctions.deploySubpath": ".", | ||
"azureFunctions.postDeployTask": "npm install", | ||
"azureFunctions.projectLanguage": "TypeScript", | ||
"azureFunctions.projectRuntime": "~3", | ||
"debug.internalConsoleOptions": "neverOpen", | ||
"azureFunctions.preDeployTask": "npm prune", | ||
"workbench.colorCustomizations": { | ||
"activityBar.activeBackground": "#3399ff", | ||
"activityBar.activeBorder": "#bf0060", | ||
"activityBar.background": "#3399ff", | ||
"activityBar.foreground": "#15202b", | ||
"activityBar.inactiveForeground": "#15202b99", | ||
"activityBarBadge.background": "#bf0060", | ||
"activityBarBadge.foreground": "#e7e7e7", | ||
"statusBar.background": "#007fff", | ||
"statusBar.border": "#007fff", | ||
"statusBar.foreground": "#e7e7e7", | ||
"statusBarItem.hoverBackground": "#3399ff", | ||
"titleBar.activeBackground": "#007fff", | ||
"titleBar.activeForeground": "#e7e7e7", | ||
"titleBar.border": "#007fff", | ||
"titleBar.inactiveBackground": "#007fff99", | ||
"titleBar.inactiveForeground": "#e7e7e799" | ||
}, | ||
"peacock.color": "#007fff", | ||
"eslint.lintTask.enable": true, | ||
"eslint.lintTask.options": ". --ext .ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "func", | ||
"command": "host start", | ||
"problemMatcher": "$func-watch", | ||
"isBackground": true, | ||
"dependsOn": "npm build" | ||
}, | ||
{ | ||
"type": "shell", | ||
"label": "npm build", | ||
"command": "npm run build", | ||
"dependsOn": "npm install", | ||
"problemMatcher": "$tsc" | ||
}, | ||
{ | ||
"type": "shell", | ||
"label": "npm install", | ||
"command": "npm install" | ||
}, | ||
{ | ||
"type": "shell", | ||
"label": "npm prune", | ||
"command": "npm prune --production", | ||
"dependsOn": "npm build", | ||
"problemMatcher": [] | ||
}, | ||
{ | ||
"type": "eslint", | ||
"problemMatcher": [ | ||
"$eslint-stylish" | ||
], | ||
"label": "eslint: lint whole folder" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"version": "2.0", | ||
"extensionBundle": { | ||
"id": "Microsoft.Azure.Functions.ExtensionBundle", | ||
"version": "[1.*, 2.0.0)" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "patienttestsapi", | ||
"version": "", | ||
"description": "", | ||
"scripts": { | ||
"test": "echo \"No tests yet...\"", | ||
"build": "tsc" | ||
}, | ||
"author": "", | ||
"devDependencies": { | ||
"@azure/functions": "^1.2.0", | ||
"@types/node": "^13.13.5", | ||
"@typescript-eslint/eslint-plugin": "^2.31.0", | ||
"@typescript-eslint/parser": "^2.31.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"resolveJsonModule": true, | ||
"module": "commonjs", | ||
"target": "ES2019", | ||
"outDir": "dist", | ||
"rootDir": ".", | ||
"sourceMap": true, | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"moduleResolution": "node", | ||
"typeRoots": ["./node_modules/@types"], | ||
"types": [ | ||
"node" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"version": "2.0", | ||
"extensionBundle": { | ||
"id": "Microsoft.Azure.Functions.ExtensionBundle", | ||
"version": "[1.*, 2.0.0)" | ||
} | ||
} |