Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Repo Setup #1

Merged
merged 2 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
114 changes: 109 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,112 @@
{
"extends": ["next/core-web-vitals", "prettier"],
"plugins": ["prettier"],
"ignorePatterns": ["**/dist/*.js", "/docs/**", "/out/**"],
"plugins": ["prettier", "@typescript-eslint", "import"],
"parserOptions": {
"project": "./tsconfig.json"
},
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/recommended",
"plugin:import/typescript",
"next/core-web-vitals",
"prettier"
],
"ignorePatterns": [
"**/dist/*",
"/docs/**",
"/out/**",
"**/jest.config.js",
"**/next.config.js",
"**/postcss.config.js",
"**/tailwind.config.js"
],
"rules": {
"prettier/prettier": "error"
}
"prettier/prettier": "error",
"import/order": [
"warn",
{
"groups": ["builtin", "external", "internal", ["parent", "sibling"]],
"pathGroupsExcludedImportTypes": ["builtin"],
"newlines-between": "never",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"import/no-empty-named-blocks": "error",
"import/no-mutable-exports": "error",
"import/no-cycle": "error",
"import/extensions": [
"warn",
"always",
{
"ts": "never",
"tsx": "never",
"js": "never",
"jsx": "never",
"mjs": "never"
}
],
"import/newline-after-import": "warn",
"import/no-anonymous-default-export": "warn",
"import/no-default-export": "error",
"@typescript-eslint/consistent-type-imports": [
"warn",
{
"prefer": "type-imports",
"fixStyle": "inline-type-imports",
"disallowTypeAnnotations": false
}
],
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": {
"attributes": false
}
}
],
"import/no-duplicates": [
"error",
{
"prefer-inline": true
}
],
// false negatives
"import/namespace": ["off"],
"no-empty-pattern": "off",
// make sure to `await` inside try…catch
"@typescript-eslint/return-await": ["error", "in-try-catch"],
"@typescript-eslint/no-confusing-void-expression": [
"error",
{ "ignoreArrowShorthand": true }
],
// empty interfaces are fine, e.g. React component that extends other component, but with no additional props
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/array-type": [
"warn",
{ "default": "array-simple", "readonly": "array-simple" }
],
// allow unused vars prefixed with `_`
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }
],
// numbers and booleans are fine in template strings
"@typescript-eslint/restrict-template-expressions": [
"error",
{ "allowNumber": true, "allowBoolean": true }
],
"react/no-unescaped-entities": "off"
},
"overrides": [
{
"files": ["app/**/*.ts?(x)"],
"rules": {
"import/no-default-export": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion .eslintrc.json.license
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project

SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down Expand Up @@ -28,11 +28,11 @@ jobs:
actions: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript-typescript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript-typescript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
12 changes: 2 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -21,19 +21,11 @@ jobs:
permissions:
contents: read
checks: write
nextjsgithubpages:
name: Deploy Next.js site to GitHub Pages
needs: buildandtest
uses: StanfordBDHG/.github/.github/workflows/nextjs-github-pages.yml@v2
permissions:
contents: read
pages: write
id-token: write
dockerimage:
name: Docker Build and Push
uses: StanfordBDHG/.github/.github/workflows/docker-build-and-push.yml@v2
with:
imageName: stanfordbdhg/nextjstemplate
imageName: stanfordbdhg/engagehfwebfrontend
environment: package
permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/monthly-markdown-link-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -10,7 +10,7 @@ name: Monthly Markdown Link Check

on:
schedule:
- cron: "0 8 1 * *"
- cron: '0 8 1 * *'

jobs:
markdown_link_check:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

**/dist
node_modules
2 changes: 1 addition & 1 deletion .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
// This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
//
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
//
Expand Down
9 changes: 5 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -15,6 +15,7 @@ authors:
- family-names: 'Ravi'
given-names: 'Vishnu'
orcid: 'https://orcid.org/0000-0003-0359-1275'
title: 'NextJSTemplate'
doi: '10.5281/zenodo.10052055'
url: 'https://github.com/StanfordBDHG/NextJSTemplate'
- family-names: 'Arkadiusz'
given-names: 'Bachorski'
title: 'ENGAGE-HF Web Frontend'
url: 'https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend'
4 changes: 2 additions & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!--

This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project

SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)

SPDX-License-Identifier: MIT

-->

# Stanford Biodesign Digital Health Next.js Template Contributors
# Stanford Biodesign Digital Health ENGAGE-HF open-source project

- [Paul Schmiedmayer](https://github.com/PSchmiedmayer)
- [Vishnu Ravi](https://github.com/vishnuravi)
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
# Based on the docker file found at https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile.
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
Expand Down
29 changes: 9 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
<!--

This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project

SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)

SPDX-License-Identifier: MIT

-->

# Biodesign Digital Health Next.js Template
# Stanford Biodesign Digital Health ENGAGE-HF Web Frontend

[![Build and Test](https://github.com/StanfordBDHG/NextJSTemplate/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/StanfordBDHG/NextJSTemplate/actions/workflows/build-and-test.yml)
[![Deployment](https://github.com/StanfordBDHG/NextJSTemplate/actions/workflows/main.yml/badge.svg)](https://github.com/StanfordBDHG/NextJSTemplate/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/StanfordBDHG/NextJSTemplate/graph/badge.svg?token=dfQW5eZ2up)](https://codecov.io/gh/StanfordBDHG/NextJSTemplate)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10052055.svg)](https://doi.org/10.5281/zenodo.10052055)
[![Build and Test](https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend/actions/workflows/build-and-test.yml)
[![Deployment](https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend/actions/workflows/main.yml/badge.svg)](https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/StanfordBDHG/ENGAGE-HF-Web-Frontend/graph/badge.svg?token=PsKyNz7Woe)](https://codecov.io/gh/StanfordBDHG/ENGAGE-HF-Web-Frontend)

## How To Use This Template
## How To Use ENGAGE-HF Web Frontend

The template repository contains a template for a Next.js project providing automated GitHub Actions and setups for code linting, testing & test coverage reports, docker deployments, a docker compose setup, local packages for modular deployment, and documentation generation & deployment.

Follow these steps to customize it to your needs:

1. Rename the Next.js project.
2. Modify, add, or remove the local packages found at `/packages/*` to separate code into smaller modules.
3. Add dependencies and edit the project in `/app` and the local Node packages.

The main application is automatically deployed to https://stanfordbdhg.github.io/NextJSTemplate/.

The documentation of the local packages is automatically deployed to https://stanfordbdhg.github.io/NextJSTemplate/docs.
The ENGAGE-HF Web Frontend repository contains a Next.js project providing automated GitHub Actions and setups for code linting, testing & test coverage reports, docker deployments, a docker compose setup, local packages for modular deployment.

## Getting Started

Expand Down Expand Up @@ -73,12 +62,12 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next

## License

This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordBDHG/NextJSTemplate/tree/main/LICENSES) for more information.
This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend/tree/main/LICENSES) for more information.

## Contributors

This project is developed as part of the Stanford Byers Center for Biodesign at Stanford University.
See [CONTRIBUTORS.md](https://github.com/StanfordBDHG/NextJSTemplate/tree/main/CONTRIBUTORS.md) for a full list of all Next.js Template contributors.
See [CONTRIBUTORS.md](https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend/tree/main/CONTRIBUTORS.md) for a full list of all contributors.

![Stanford Byers Center for Biodesign Logo](https://raw.githubusercontent.com/StanfordBDHG/.github/main/assets/biodesign-footer-light.png#gh-light-mode-only)
![Stanford Byers Center for Biodesign Logo](https://raw.githubusercontent.com/StanfordBDHG/.github/main/assets/biodesign-footer-dark.png#gh-dark-mode-only)
2 changes: 1 addition & 1 deletion app/favicon.ico.license
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project

SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)

Expand Down
2 changes: 1 addition & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*

This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project

SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)

Expand Down
6 changes: 3 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
// This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
//
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
//
Expand All @@ -11,8 +11,8 @@ import type { ReactNode } from 'react'
import './globals.css'

export const metadata: Metadata = {
title: 'Next.js Template',
description: 'Stanford Biodesign Digital Health Next.js Template',
title: 'ENGAGE-HF Web Frontend',
description: 'Stanford Biodesign Digital Health ENGAGE-HF Web Frontend',
}

interface RootLayoutProps {
Expand Down
10 changes: 5 additions & 5 deletions app/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project
// This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
//
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
//
Expand All @@ -11,11 +11,11 @@ import '@testing-library/jest-dom'
import Home from './page'

describe('Home Component', () => {
it('renders the Stanford Biodesign Digital Health Next.js Template heading', () => {
it('renders the Stanford Biodesign Digital Health ENGAGE-HF Web Frontend heading', () => {
render(<Home />)

const headingElement = screen.getByText(
/Welcome to the Stanford Biodesign Digital Health Next.js Template/i,
/Welcome to the Stanford Biodesign Digital Health ENGAGE-HF Web Frontend/i,
)

expect(headingElement).toBeInTheDocument()
Expand All @@ -24,9 +24,9 @@ describe('Home Component', () => {
it('renders the Stanford Biodesign Logo', () => {
render(<Home />)

const imageElement = screen.getByAltText(
const imageElement: HTMLImageElement = screen.getByAltText(
'Stanford Biodesign Logo',
) as HTMLImageElement
)

expect(imageElement).toBeInTheDocument()
expect(imageElement.src).toContain('stanfordbiodesign.png')
Expand Down
Loading
Loading