perf: 프로필 프런트엔드 자산을 커밋 단위로 공유한다

정적 운영 빌드에서 프로필별 base와 API 설정을 런타임 JSON으로 분리하고, 공용 Vite 번들과 sourcemap을 한 번만 생성·게시한다. Preview와 기존 정적 artifact의 전환 호환 경계는 유지한다.
This commit is contained in:
2026-08-22 17:54:43 +00:00
parent ecc8721238
commit ade543f936
24 changed files with 628 additions and 79 deletions
@@ -6,6 +6,7 @@ import {
buildProfileFrontendCommands,
buildProfileMigrationCommand,
buildProcessDefinitions,
buildSharedProfileFrontendCommands,
buildWorkspaceCommands,
planProfileReconcile,
resolveResetLifecycleStatus,
@@ -464,3 +465,43 @@ describe('buildProfileFrontendCommands', () => {
);
});
});
describe('buildSharedProfileFrontendCommands', () => {
const buildCommitSha = '0123456789abcdef0123456789abcdef01234567';
it('uses one profile-neutral relative-asset build cache key for every profile', () => {
const commands = buildSharedProfileFrontendCommands(
'/srv/sammo/worktrees/0123456789abcdef',
buildCommitSha,
{
NODE_OPTIONS: '--max-old-space-size=1536',
PROFILE_FRONTEND_BUILD_NODE_OPTIONS: '--max-old-space-size=2048',
VITE_APP_BASE_PATH: '/che',
VITE_GAME_API_URL: '/che/api/trpc',
VITE_GAME_SSE_URL: '/che/api/events',
VITE_GAME_PROFILE: 'che',
VITE_GATEWAY_API_URL: '/gateway/api/trpc',
},
'/srv/sammo/controller'
);
expect(commands).toHaveLength(1);
expect(commands[0]?.env).toMatchObject({
NODE_OPTIONS: '--max-old-space-size=2048',
VITE_ASSET_BASE_PATH: './',
VITE_BUILD_COMMIT_SHA: buildCommitSha,
VITE_GATEWAY_API_URL: '/gateway/api/trpc',
});
expect(commands[0]?.env).not.toHaveProperty('VITE_APP_BASE_PATH');
expect(commands[0]?.env).not.toHaveProperty('VITE_GAME_API_URL');
expect(commands[0]?.env).not.toHaveProperty('VITE_GAME_SSE_URL');
expect(commands[0]?.env).not.toHaveProperty('VITE_GAME_PROFILE');
expect(commands[0]?.args).toContain('--cache-dir=/srv/sammo/controller/.turbo/release-cache');
});
it('rejects a non-commit shared build version', () => {
expect(() => buildSharedProfileFrontendCommands('/srv/sammo/worktrees/main', 'main')).toThrow(
'Shared profile frontend build requires a full commit SHA.'
);
});
});