-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from zisra/dev
(refactor): Use Nitro web server
- Loading branch information
Showing
22 changed files
with
5,949 additions
and
2,431 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,7 @@ | ||
node_modules | ||
*.log* | ||
.nitro | ||
.cache | ||
.output | ||
.env | ||
dist |
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,3 @@ | ||
dist | ||
.output | ||
node-modules |
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,50 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
}, | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
], | ||
ignorePatterns: ["public/*", "dist/*", "/*.js", "/*.ts"], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "./tsconfig.json", | ||
tsconfigRootDir: "./", | ||
}, | ||
settings: { | ||
"import/resolver": { | ||
typescript: { | ||
project: "./tsconfig.json", | ||
}, | ||
}, | ||
}, | ||
plugins: ["@typescript-eslint", "import", "prettier"], | ||
rules: { | ||
"no-underscore-dangle": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"no-console": "off", | ||
"@typescript-eslint/no-this-alias": "off", | ||
"import/prefer-default-export": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": ["error"], | ||
"no-restricted-syntax": "off", | ||
"import/no-unresolved": ["error", { ignore: ["^virtual:"] }], | ||
"consistent-return": "off", | ||
"no-continue": "off", | ||
"no-eval": "off", | ||
"no-await-in-loop": "off", | ||
"no-nested-ternary": "off", | ||
"prefer-destructuring": "off", | ||
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
ts: "never", | ||
tsx: "never", | ||
}, | ||
] | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,52 @@ | ||
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: 'npm' | ||
|
||
- name: Install npm packages | ||
run: npm install | ||
|
||
- name: Prepare for linting | ||
run: npm run prepare | ||
|
||
- name: Run ESLint | ||
run: npm run 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: 'npm' | ||
|
||
- name: Install npm packages | ||
run: npm install | ||
|
||
- name: Build Project | ||
run: npm run build |
This file was deleted.
Oops, something went wrong.
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,55 @@ | ||
name: Docker Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Get version | ||
id: package-version | ||
uses: martinbeentjes/npm-get-version-action@main | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=auto | ||
tags: | | ||
type=semver,pattern={{version}},value=v${{ steps.package-version.outputs.current-version }} | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
context: . | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: ${{ steps.meta.outputs.tags }} |
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,30 @@ | ||
name: Release | ||
|
||
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 | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.package-version.outputs.current-version }} | ||
release_name: Bot v${{ steps.package-version.outputs.current-version }} | ||
draft: false | ||
prerelease: false |
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
node_modules | ||
dist | ||
*.log* | ||
.nitro | ||
.cache | ||
.output | ||
.env | ||
dist |
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"editorconfig.editorconfig" | ||
] | ||
"recommendations": ["dbaeumer.vscode-eslint", "editorconfig.editorconfig"] | ||
} |
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,19 @@ | ||
FROM node:18-alpine as base | ||
WORKDIR /app | ||
|
||
# Build layer | ||
FROM base as build | ||
|
||
COPY package-lock.json package.json ./ | ||
RUN npm install --frozen-lockfile | ||
COPY . . | ||
RUN npm run build | ||
|
||
# Production layer | ||
FROM base as production | ||
|
||
EXPOSE 3000 | ||
ENV NODE_ENV=production | ||
COPY --from=build /app/.output ./.output | ||
|
||
CMD ["node", ".output/server/index.mjs"] |
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 |
---|---|---|
@@ -1,3 +1,17 @@ | ||
# Cloudflare worker proxy | ||
# simple-proxy | ||
|
||
Simple http proxy in a cloudflare worker. | ||
Simple reverse proxy to bypass CORS, used by [movie-web](https://movie-web.app). | ||
|
||
features: | ||
- Deployable on many platforms - thanks to nitro | ||
- header rewrites - read and write protected headers | ||
- bypass CORS - always allows browser to send requests through it | ||
|
||
supported platforms: | ||
- cloudflare workers | ||
- nodejs | ||
|
||
## Todos: | ||
- [ ] release with multi platform | ||
- [ ] Easy deploy to cloudflare button (just needs CI) | ||
- [ ] Test on cloudflare |
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 @@ | ||
//https://nitro.unjs.io/config | ||
export default defineNitroConfig({ | ||
noPublicDir: true, | ||
srcDir: "./src" | ||
}); |
Oops, something went wrong.