Repo setup

This commit is contained in:
mrjvs 2023-08-23 13:54:26 +02:00
parent c852a33cc1
commit bfcf6d0568
21 changed files with 1866 additions and 0 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
.env
config.json
dist
.git
.vscode

6
.editorconfig Normal file
View File

@ -0,0 +1,6 @@
[*]
end_of_line = lf
insert_final_newline = true
indent_size = 2
indent_style = space

32
.eslintrc.js Normal file
View File

@ -0,0 +1,32 @@
module.exports = {
env: {
node: true,
},
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
argsIgnorePattern: '^_',
},
],
},
};

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

3
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,3 @@
* @movie-web/core
.github @binaryoverload

1
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@ -0,0 +1 @@
Please visit the [main document at primary repository](https://github.com/movie-web/movie-web/blob/dev/.github/CODE_OF_CONDUCT.md).

1
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1 @@
Please visit the [main document at primary repository](https://github.com/movie-web/movie-web/blob/dev/.github/CONTRIBUTING.md).

14
.github/SECURITY.md vendored Normal file
View File

@ -0,0 +1,14 @@
# Security Policy
## Supported Versions
The movie-web maintainers only support the latest version of movie-web published at https://movie-web.app.
This published version is equivalent to the master branch.
Support is not provided for any forks or mirrors of movie-web.
## Reporting a Vulnerability
There are two ways you can contact the movie-web maintainers to report a vulnerability:
- Email [security@movie-web.app](mailto:security@movie-web.app)
- Report the vulnerability in the [movie-web Discord server](https://discord.movie-web.app)

6
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,6 @@
This pull request resolves #XXX
- [ ] I have read and agreed to the [code of conduct](https://github.com/movie-web/movie-web/blob/dev/.github/CODE_OF_CONDUCT.md).
- [ ] I have read and complied with the [contributing guidelines](https://github.com/movie-web/movie-web/blob/dev/.github/CONTRIBUTING.md).
- [ ] What I'm implementing was assigned to me and is an [approved issue](https://github.com/movie-web/movie-web/issues?q=is%3Aopen+is%3Aissue+label%3Aapproved). For reference, please take a look at our [GitHub projects](https://github.com/movie-web/movie-web/projects).
- [ ] I have tested all of my changes.

63
.github/workflows/linting_testing.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: Linting and Testing
on:
push:
branches:
- master
- dev
pull_request:
jobs:
linting:
name: Run Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install Yarn packages
run: yarn install
- name: Run ESLint
run: yarn lint
building:
name: Build project
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install Yarn packages
run: yarn install
- name: Build Project
run: yarn build
docker:
name: Build docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build
uses: docker/build-push-action@v4

51
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Deploying
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package-version.outputs.current-version }}
release_name: Backend v${{ steps.package-version.outputs.current-version }}
draft: false
prerelease: false
registry:
name: Push to registry
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build
uses: docker/build-push-action@v4
with:
tags: |
backend:latest
backend:v${{ steps.package-version.outputs.current-version }}

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
node_modules
.env
config.json
dist

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
20

4
.prettierrc.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
trailingComma: 'all',
singleQuote: true
};

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "editorconfig.editorconfig"]
}

8
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:18-alpine
WORKDIR /app
# install dependencies
COPY package*.json ./
RUN npm ci
# build source
COPY . ./
RUN npm run build
# start server
EXPOSE 80
ENV CONF_SERVER__PORT=80
ENV NODE_ENV=production
CMD ["npm", "run", "start"]

32
package.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "backend",
"version": "1.0.0",
"private": true,
"homepage": "https://github.com/movie-web/backend",
"engines": {
"node": ">=18"
},
"scripts": {
"dev": "nodemon -r tsconfig-paths/register src/main.ts",
"build": "npm run build:pre && npm run build:compile",
"start": "node dist/main.js",
"lint": "eslint --ext .ts,.js,.json,.tsx src/",
"lint:fix": "eslint --fix --ext .ts,.js,.json,.tsx src/",
"build:pre": "rimraf dist/",
"build:compile": "tsc && tsc-alias"
},
"devDependencies": {
"@types/node": "^20.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"nodemon": "^3.0.1",
"rimraf": "^5.0.1",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.7",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.6"
}
}

1
src/main.ts Normal file
View File

@ -0,0 +1 @@
console.log("hello world")

24
tsconfig.json Normal file
View File

@ -0,0 +1,24 @@
{
"ts-node": {
"files": true
},
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"rootDir": "src",
"baseUrl": "src",
"experimentalDecorators": true,
"isolatedModules": false,
"emitDecoratorMetadata": true,
"strict": true,
"paths": {
"@*": ["./*"]
}
},
"lib": ["es6"],
"include": ["src/"]
}

1589
yarn.lock Normal file

File diff suppressed because it is too large Load Diff