From f01973f9c1f2a3eb56938ea536f574be12d95b84 Mon Sep 17 00:00:00 2001 From: Type-Style Date: Fri, 12 Jan 2024 14:03:27 +0100 Subject: [PATCH 1/3] [Task] #6 provide fallback index.html --- httpdocs/index.html | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 httpdocs/index.html diff --git a/httpdocs/index.html b/httpdocs/index.html new file mode 100644 index 00000000..9a20fce2 --- /dev/null +++ b/httpdocs/index.html @@ -0,0 +1,52 @@ + + + + + + Welcome Page + + + +

Welcome

+ + From c19508ff0afd2dc9d8bb73ed69c5ef6d36b07871 Mon Sep 17 00:00:00 2001 From: Type-Style Date: Fri, 12 Jan 2024 14:47:11 +0100 Subject: [PATCH 2/3] [Task] #6 production ready code (m) move httpdocs folder to dist have compile without sourcemaps for faster speed --- .github/workflows/build.yml | 2 +- package.json | 5 ++++- tsconfig.prod.json | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 tsconfig.prod.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 097687ed..57fe368a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: - run: node --version - uses: actions/checkout@v3 - run: npm ci - - run: npm run build --if-present + - run: npm run build:prod --if-present - name: Start server and test server response run: | npm start & diff --git a/package.json b/package.json index c555c50b..7d9bdd96 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "type": "module", "scripts": { - "build": "npx tsc", + "build": "npx tsc && cp -R httpdocs/ dist/", + "build:prod": "npx tsc -p ./tsconfig.prod.json && cp -R httpdocs/ dist/", "start": "node dist/app.js", "dev": "nodemon src/app.ts", "lint": "eslint . --fix" @@ -27,3 +28,5 @@ "express": "^4.18.2" } } + + diff --git a/tsconfig.prod.json b/tsconfig.prod.json new file mode 100644 index 00000000..513a96cc --- /dev/null +++ b/tsconfig.prod.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "sourceMap": false + } +} \ No newline at end of file From 75023b3c52c02d9628a2f866d666c6c7e3cdb513 Mon Sep 17 00:00:00 2001 From: Type-Style Date: Fri, 12 Jan 2024 15:41:34 +0100 Subject: [PATCH 3/3] [Task] #6 create github action for upload when main is updated (#21) --- .github/workflows/ftp.yml | 25 +++++++++++++++++++++++++ .github/workflows/label.yml | 22 ---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/ftp.yml delete mode 100644 .github/workflows/label.yml diff --git a/.github/workflows/ftp.yml b/.github/workflows/ftp.yml new file mode 100644 index 00000000..cf377a48 --- /dev/null +++ b/.github/workflows/ftp.yml @@ -0,0 +1,25 @@ +name: Deploy via ftp +on: + push: + branches: [ "main" ] +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 20 + - name: Install dependencies + run: npm i + - name: Build + run: npm run build:prod + - name: Upload ftp + uses: genietim/ftp-action@releases/v4 + with: + host: ${{ secrets.FTP_SERVER }} + user: ${{ secrets.FTP_USERNAME }} + password: ${{ secrets.FTP_PASSWORD }} + localDir: "dist" diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index 46135690..00000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will triage pull requests and apply a label based on the -# paths that are modified in the pull request. -# -# To use this workflow, you will need to set up a .github/labeler.yml -# file with configuration. For more information, see: -# https://github.com/actions/labeler - -name: Labeler -on: [pull_request_target] - -jobs: - label: - - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - - steps: - - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}"