Fix authenticated editorial dashboard missing Vite page entry
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-14 12:04:52 +02:00
parent 203c8f9193
commit dd20e74703
12 changed files with 74 additions and 17 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ const Page = load('../../resources/js/pages/structures/competitiveness.tsx', {
PortalApiError: Error,
},
'../management/shared': { button: '', control: '' },
'../management/editorial-workflow': {
'@/lib/editorial-states': {
states: {
draft: 'Rascunho',
approved: 'Aprovado',
@@ -0,0 +1,13 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
test('compiled dashboard remains a resolvable page entry for authenticated full HTML', () => {
const manifestPath=process.env.EDITORIAL_BUILD_MANIFEST || fileURLToPath(new URL('../../public/build/manifest.json',import.meta.url));
const manifest=JSON.parse(fs.readFileSync(manifestPath,'utf8'));
const key='resources/js/pages/management/editorial-workflow.tsx';
assert.ok(manifest[key], 'Dashboard page entry missing; a shared chunk cannot satisfy the server-rendered Vite directive');
assert.equal(manifest[key].isDynamicEntry || manifest[key].isEntry, true);
assert.ok(fs.existsSync(path.join(path.dirname(manifestPath),manifest[key].file)));
});
@@ -7,7 +7,7 @@ import {renderToStaticMarkup} from 'react-dom/server';
import ts from 'typescript';
const require=createRequire(import.meta.url), module={exports:{}};
const code=ts.transpileModule(fs.readFileSync(new URL('../../resources/js/pages/management/editorial-workflow.tsx',import.meta.url),'utf8'),{compilerOptions:{module:ts.ModuleKind.CommonJS,jsx:ts.JsxEmit.ReactJSX}}).outputText;
new Function('require','module','exports',code)(name=>name==='@inertiajs/react'?{Link:({href,children,...props})=>React.createElement('a',{href,...props},children),router:{}}:name==='./shared'?{Management:({title,children})=>React.createElement('main',null,React.createElement('h1',null,title),children),Field:({label,children})=>React.createElement('label',null,label,children),button:'',control:''}:require(name),module,module.exports);
new Function('require','module','exports',code)(name=>name==='@/lib/editorial-states'?{states:{}}:name==='@inertiajs/react'?{Link:({href,children,...props})=>React.createElement('a',{href,...props},children),router:{}}:name==='./shared'?{Management:({title,children})=>React.createElement('main',null,React.createElement('h1',null,title),children),Field:({label,children})=>React.createElement('label',null,label,children),button:'',control:''}:require(name),module,module.exports);
const base={items:{data:[],current_page:1,last_page:1},notices:[],resourceAccess:true,opportunitiesUrl:'/opportunities-qa',opportunityPending:2,clustersUrl:'/clusters-qa',nativePending:{clusters:3,territories:0,zones:0},subjectsUrl:'/subjects-qa',territorialUrl:'/territories-qa',demographyUrl:'/demography-qa'};
test('dashboard groups authorised activities once with contextual counts and an empty notification state',()=>{
const html=renderToStaticMarkup(React.createElement(module.exports.default,base));
+1 -1
View File
@@ -49,7 +49,7 @@ new Function('require', 'module', 'exports', code)(
control: '',
button: '',
};
if (name === './editorial-workflow')
if (name === '@/lib/editorial-states')
return {
states: {
draft: 'Rascunho',