fix(admin-ui): changelog build context — copy script + CI before_script
This commit is contained in:
@@ -309,6 +309,16 @@ docker-admin-ui:
|
|||||||
SVC: ordinis-admin-ui
|
SVC: ordinis-admin-ui
|
||||||
DOCKERFILE: ordinis-admin-ui/Dockerfile
|
DOCKERFILE: ordinis-admin-ui/Dockerfile
|
||||||
BUILD_CONTEXT: ordinis-admin-ui/
|
BUILD_CONTEXT: ordinis-admin-ui/
|
||||||
|
# docs/changelog.md — single source of truth для public changelog (read'ится
|
||||||
|
# mkdocs/Diplodoc для /docs/changelog.html AND admin-ui WhatsNewButton).
|
||||||
|
# admin-ui Docker build context = ordinis-admin-ui/ (sibling, не parent) —
|
||||||
|
# copy file в src/ перед docker build.
|
||||||
|
#
|
||||||
|
# Suffix `-public` — case-insensitive FS macOS dev: `changelog.md` ≡
|
||||||
|
# `CHANGELOG.md` (existing internal file) → overwrite. Linux CI обычно
|
||||||
|
# case-sensitive, но единообразное имя минимизирует local/CI drift.
|
||||||
|
before_script:
|
||||||
|
- cp docs/changelog.md ordinis-admin-ui/src/changelog-public.md
|
||||||
script:
|
script:
|
||||||
- *publish_script
|
- *publish_script
|
||||||
# Раньше был path-filter, но это создавало дыру: если backend менялся, а
|
# Раньше был path-filter, но это создавало дыру: если backend менялся, а
|
||||||
|
|||||||
@@ -3,3 +3,8 @@ dist
|
|||||||
.vite
|
.vite
|
||||||
*.log
|
*.log
|
||||||
.env.local
|
.env.local
|
||||||
|
|
||||||
|
# Generated by predev/prebuild scripts (copied from ../docs/changelog.md).
|
||||||
|
# Single source of truth — `docs/changelog.md`. См. scripts/copy-changelog.mjs.
|
||||||
|
# NOT `changelog.md` (case-insensitive FS collides с internal CHANGELOG.md).
|
||||||
|
/src/changelog-public.md
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
"version": "2.14.0",
|
"version": "2.14.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"copy-changelog": "node scripts/copy-changelog.mjs",
|
||||||
|
"predev": "node scripts/copy-changelog.mjs",
|
||||||
|
"prebuild": "node scripts/copy-changelog.mjs",
|
||||||
|
"pretest": "node scripts/copy-changelog.mjs",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview --host 0.0.0.0 --port 4173",
|
"preview": "vite preview --host 0.0.0.0 --port 4173",
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
/**
|
||||||
|
* Copy `docs/changelog.md` → `ordinis-admin-ui/src/changelog-public.md`.
|
||||||
|
*
|
||||||
|
* Why: public CHANGELOG лежит в `docs/` (single source of truth, читается
|
||||||
|
* mkdocs/Diplodoc для /docs/changelog.html). admin-ui WhatsNewButton тоже
|
||||||
|
* импортирует его через Vite `?raw`, но Docker build context = admin-ui/,
|
||||||
|
* `docs/` снаружи. Скрипт вызывается через `predev` / `prebuild` npm
|
||||||
|
* hooks — копирует файл в admin-ui/src/ перед start'ом vite.
|
||||||
|
*
|
||||||
|
* В CI копию делает `.gitlab-ci.yml` `docker-admin-ui:before_script:` —
|
||||||
|
* перед docker build файл уже в context'е, Dockerfile `COPY . .` подхватит.
|
||||||
|
*
|
||||||
|
* **Critical name choice:** `changelog-public.md`, не `changelog.md`. macOS
|
||||||
|
* по умолчанию case-insensitive filesystem (APFS / HFS+) — `changelog.md` ≡
|
||||||
|
* `CHANGELOG.md` ≡ existing internal CHANGELOG.md → overwrite. Suffix
|
||||||
|
* `-public` устраняет конфликт + явно показывает purpose. Plus файл живёт
|
||||||
|
* в `src/` (не root) чтобы Vite `?raw` ресолвил по relative path без `..`.
|
||||||
|
*
|
||||||
|
* `src/changelog-public.md` — generated, gitignored.
|
||||||
|
*/
|
||||||
|
import { copyFileSync, existsSync, mkdirSync } from 'node:fs'
|
||||||
|
import { dirname, resolve } from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
|
const SRC = resolve(__dirname, '..', '..', 'docs', 'changelog.md')
|
||||||
|
const DST = resolve(__dirname, '..', 'src', 'changelog-public.md')
|
||||||
|
|
||||||
|
if (!existsSync(SRC)) {
|
||||||
|
console.error(`copy-changelog: source missing ${SRC}`)
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdirSync(dirname(DST), { recursive: true })
|
||||||
|
copyFileSync(SRC, DST)
|
||||||
|
console.log(`copy-changelog: ${SRC} → ${DST}`)
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
// Public CHANGELOG (human-readable, без commit hashes / scope prefixes,
|
// Public CHANGELOG (human-readable, без commit hashes / scope prefixes).
|
||||||
// curated handler-friendly text). Lives в `docs/changelog.md` чтобы single
|
// Single source of truth — `docs/changelog.md` (читается mkdocs/Diplodoc
|
||||||
// source of truth для public-facing changelog был один (docs build тоже
|
// для /docs/changelog.html). Copy step (scripts/copy-changelog.mjs)
|
||||||
// его публикует на /docs/changelog.html через Diplodoc).
|
// генерит `src/changelog-public.md` перед dev/build/test, .gitlab-ci.yml
|
||||||
|
// делает то же перед docker build admin-ui.
|
||||||
|
//
|
||||||
|
// Filename `changelog-public.md` (не `changelog.md`!) — macOS APFS/HFS+
|
||||||
|
// case-insensitive: `changelog.md` ≡ `CHANGELOG.md` (existing internal
|
||||||
|
// semantic-release-generated file) → overwrite. Suffix устраняет конфликт.
|
||||||
//
|
//
|
||||||
// Internal CHANGELOG (semantic-release auto-generated, с commit hashes для
|
// Internal CHANGELOG (semantic-release auto-generated, с commit hashes для
|
||||||
// engineering team) — `ordinis-admin-ui/CHANGELOG.md`. Не bundled в UI.
|
// engineering team) — `ordinis-admin-ui/CHANGELOG.md`. Не bundled в UI.
|
||||||
// eslint-disable-next-line import/no-unresolved -- Vite ?raw query resolved at build
|
// eslint-disable-next-line import/no-unresolved -- Vite ?raw query resolved at build
|
||||||
import changelogRaw from '../../../../docs/changelog.md?raw'
|
import changelogRaw from '../../changelog-public.md?raw'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parsed CHANGELOG entry — one version block from semantic-release output.
|
* Parsed CHANGELOG entry — one version block from semantic-release output.
|
||||||
|
|||||||
@@ -74,12 +74,6 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 5173,
|
port: 5173,
|
||||||
fs: {
|
|
||||||
// Allow importing files outside admin-ui (e.g. ../docs/changelog.md
|
|
||||||
// для WhatsNewButton — single source of truth для public changelog
|
|
||||||
// живёт в docs/ чтобы mkdocs тоже его publish'ил).
|
|
||||||
allow: ['..'],
|
|
||||||
},
|
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: process.env.VITE_API_PROXY ?? 'http://localhost:8080',
|
target: process.env.VITE_API_PROXY ?? 'http://localhost:8080',
|
||||||
|
|||||||
Reference in New Issue
Block a user