project-name
server/web/app.go
.
From c0be24e0a60124bca2df9918e5f5c3344a38a865 Mon Sep 17 00:00:00 2001 From: Sasha Shpota <5640984+Shpota@users.noreply.github.com> Date: Sat, 3 Jun 2023 12:22:10 +0200 Subject: [PATCH] Vite-based Vue temaplates (#117) --- .github/workflows/build.yml | 6 +- .github/workflows/verify-templates.yml | 29 ++- static/generated.go | 189 ++++++++---------- .../src/app/tech/tech.component.html | 2 +- templates/mongo.Dockerfile | 2 +- templates/mysql.Dockerfile | 2 +- templates/postgres.Dockerfile | 2 +- templates/vue.webapp/.env.development | 2 - templates/vue.webapp/.env.local | 2 + templates/vue.webapp/.env.production | 3 +- templates/vue.webapp/.eslintrc.cjs | 11 + templates/vue.webapp/.vscode/extensions.json | 3 + templates/vue.webapp/babel.config.js | 5 - templates/vue.webapp/index.html | 13 ++ templates/vue.webapp/jsconfig.json | 19 -- templates/vue.webapp/package.json | 47 ++--- templates/vue.webapp/public/index.html | 16 -- templates/vue.webapp/src/App.vue | 25 +-- .../vue.webapp/src/components/TechItems.vue | 2 +- templates/vue.webapp/vite.config.js | 17 ++ templates/vue.webapp/vue.config.js | 4 - transform/go.mod | 2 +- 22 files changed, 177 insertions(+), 226 deletions(-) delete mode 100644 templates/vue.webapp/.env.development create mode 100644 templates/vue.webapp/.env.local create mode 100644 templates/vue.webapp/.eslintrc.cjs create mode 100644 templates/vue.webapp/.vscode/extensions.json delete mode 100644 templates/vue.webapp/babel.config.js create mode 100644 templates/vue.webapp/index.html delete mode 100644 templates/vue.webapp/jsconfig.json delete mode 100644 templates/vue.webapp/public/index.html create mode 100644 templates/vue.webapp/vite.config.js delete mode 100644 templates/vue.webapp/vue.config.js diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd806bd..c01faf0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,5 @@ name: build -on: [push, pull_request] +on: [push] jobs: test: @@ -9,7 +9,7 @@ jobs: - name: Set up Go 1.19 uses: actions/setup-go@v1 with: - go-version: 1.19 + go-version: 1.20 id: go - name: Check out uses: actions/checkout@v2 @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - go: [ 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18 ] + go: [ 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 ] steps: - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v1 diff --git a/.github/workflows/verify-templates.yml b/.github/workflows/verify-templates.yml index 1b33020..95c9ce3 100644 --- a/.github/workflows/verify-templates.yml +++ b/.github/workflows/verify-templates.yml @@ -1,7 +1,6 @@ name: verify-templates on: push: - pull_request: schedule: - cron: '0 14 * * *' jobs: @@ -18,7 +17,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.18 + go-version: 1.20 - name: Checkout project uses: actions/checkout@v2 - name: Generate application @@ -29,8 +28,28 @@ jobs: run: timeout 60 bash -c 'until curl -s localhost:8080/api/technologies | grep Go > /dev/null; do sleep 1; done' - name: Check availability of frontend run: | - npm i domcurl - timeout 60 bash -c 'until ./node_modules/domcurl/index.js http://localhost:8080 | grep Go > /dev/null; do sleep 1; done' + npm i puppeteer + cat > index.js << EOF + const puppeteer = require('puppeteer'); + (async () => { + try { + const browser = await puppeteer.launch({headless: "new"}); + const page = await browser.newPage(); + await page.goto('http://localhost:8080'); + page.on('console', (message) => { + console.log('Console ' + message.type().toUpperCase() + ': ' + message.text()); + }); + await page.waitForSelector('.technologies', { timeout: 60000 }); + const content = await page.content(); + console.log(content); + await browser.close(); + } catch (error) { + console.error('Error:', error); + throw error; + } + })(); + EOF + node index.js - name: Stop application run: cd app && docker-compose down - if: always() + if: always() \ No newline at end of file diff --git a/static/generated.go b/static/generated.go index 42ec186..e587e0f 100644 --- a/static/generated.go +++ b/static/generated.go @@ -496,7 +496,7 @@ import { HttpClientModule } from '@angular/common/http'; }) export class AppModule { } `, - "angular.webapp/src/app/tech/tech.component.html": `
server/web/app.go
.