S19: establish engineering repository
This commit is contained in:
10
templates/frontend/frontend/Dockerfile
Normal file
10
templates/frontend/frontend/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM node:24-alpine AS build
|
||||
WORKDIR /workspace
|
||||
COPY . .
|
||||
RUN npm ci && npm run lint && npm test && npm run build
|
||||
FROM nginxinc/nginx-unprivileged:1.28-alpine AS runtime
|
||||
EXPOSE 8080
|
||||
FROM runtime AS prebuilt
|
||||
COPY dist/ /usr/share/nginx/html/
|
||||
FROM runtime AS standalone
|
||||
COPY --from=build /workspace/dist/ /usr/share/nginx/html/
|
||||
3
templates/frontend/frontend/build.mjs
Normal file
3
templates/frontend/frontend/build.mjs
Normal file
@@ -0,0 +1,3 @@
|
||||
import { mkdir, copyFile } from 'node:fs/promises';
|
||||
await mkdir('dist', { recursive: true });
|
||||
await copyFile('index.html', 'dist/index.html');
|
||||
1
templates/frontend/frontend/index.html
Normal file
1
templates/frontend/frontend/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><meta charset="utf-8"><title>@PROJECT@</title><h1>@PROJECT@</h1></html>
|
||||
1
templates/frontend/frontend/package-lock.json
generated
Normal file
1
templates/frontend/frontend/package-lock.json
generated
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"@PROJECT@-frontend","version":"1.0.0","lockfileVersion":3,"requires":true,"packages":{"":{"name":"@PROJECT@-frontend","version":"1.0.0"}}}
|
||||
4
templates/frontend/frontend/package.json
Normal file
4
templates/frontend/frontend/package.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@PROJECT@-frontend", "version": "1.0.0", "private": true,
|
||||
"scripts": {"lint": "node --check build.mjs", "test": "node --test test.mjs", "build": "node build.mjs"}
|
||||
}
|
||||
4
templates/frontend/frontend/test.mjs
Normal file
4
templates/frontend/frontend/test.mjs
Normal file
@@ -0,0 +1,4 @@
|
||||
import { test } from 'node:test';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import assert from 'node:assert/strict';
|
||||
test('starter page identifies the project', async () => { assert.match(await readFile('index.html', 'utf8'), /@PROJECT@/); });
|
||||
Reference in New Issue
Block a user