upgrade: adopt V8.31.1 (theme 1.3/1.4 redesigns, editor deep-canvas, guided launch, component library)
Overlay 190 upstream items (V8.22→8.31) preserving trade-pro theme, registry tests, and design docs. Re-applied full patch set on identical anchors (discovery/env_for/blocks.css/type-mapping/locale-override/ theme_color/frontend entries/test_theme_pro_v3 mods) plus compose pins. Verified: theme suites 35/35; dual-baseline full run 415 passed vs pristine 386+29 ours, FAILED-set diff EMPTY (same 10 Windows env fails). Live: container 8.31.1-dev.1 healthy, hesupipe 192 entries intact, trade-pro build 203 pages 0 errors. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/* V8.27: pure journey model. Display only server-observed milestones as complete. */
|
||||
(function(root,factory){
|
||||
const api=factory();
|
||||
if(typeof module==='object'&&module.exports)module.exports=api;
|
||||
else root.SiteForgeJourney=api;
|
||||
})(typeof window!=='undefined'?window:this,function(){
|
||||
'use strict';
|
||||
const successful=new Set(['complete','completed','done','success']);
|
||||
const active=new Set(['queued','running','retrying']);
|
||||
function parse(t){const d=Date.parse(t||'');return Number.isFinite(d)?d:null}
|
||||
function plan(input){
|
||||
const site=input?.site||null, entries=input?.entries||[], builds=input?.builds||[], jobs=input?.jobs||[], history=input?.delivery?.history||[];
|
||||
if(!site)return {ready:false,steps:[],next:null,completed:0,hasBuild:false,live:false};
|
||||
const userEntries=entries.filter(e=>e.source!=='starter' && e.status!=='draft');
|
||||
const manuallyEditedHome=entries.some(e=>e.route==='/'&&e.status!=='draft'&&e.source==='starter'&&parse(e.updated_at)!==null&&parse(e.created_at)!==null&&parse(e.updated_at)>parse(e.created_at)+1000);
|
||||
const hasContent=userEntries.length>0||manuallyEditedHome;
|
||||
const lastBuild=builds.filter(x=>successful.has(x.status)).sort((a,b)=>(parse(b.created_at)||0)-(parse(a.created_at)||0))[0]||null;
|
||||
const anyRunning=jobs.some(x=>active.has(x.state));
|
||||
const changeTimes=[site.updated_at,...entries.filter(e=>e.status!=='draft').map(e=>e.updated_at)].map(parse).filter(x=>x!==null);
|
||||
const changedAfterBuild=!!lastBuild&&changeTimes.some(x=>{const built=parse(lastBuild.created_at);return built!==null&&x>built+1000});
|
||||
const hasBuild=!!lastBuild;
|
||||
const live=history.some(x=>x.target==='production' && !!x.release_id && !x.is_rollback);
|
||||
const domain=Boolean((site.domain||'').trim());
|
||||
const steps=[
|
||||
{id:'site',label:'创建网站',hint:'网站已经建立,基础资料可以随时修改。',view:'settings',done:true,optional:false},
|
||||
{id:'content',label:'准备网站内容',hint:hasContent?'已有人工添加的正式内容。':'添加页面、产品或导入旧站内容。新建时自带的示例首页不代表内容已准备好。',view:site.mode==='migration'?'import':'content',done:hasContent,optional:false},
|
||||
{id:'design',label:'调整网站样式',hint:'可视化修改页面、页眉、导航和手机布局;设计需人工确认。',view:'design',done:false,optional:true},
|
||||
{id:'build',label:'生成并预览网站',hint:anyRunning?'后台正在生成,请在构建页面查看结果。':!hasBuild?'生成静态页面后,再检查预览与质量报告。':changedAfterBuild?'已有构建版本,但内容可能已更新,请检查是否需要重新构建。':'已有构建版本;仍需人工检查预览、图片和 SEO。',view:'build',done:hasBuild&&!changedAfterBuild,optional:false},
|
||||
{id:'review',label:'审核并正式上线',hint:live?'存在正式发布记录,请核对目标网址是否正确显示。':'正式上线前需要发布条件检查、独立审批与服务器部署。',view:'launch',done:live,optional:false}
|
||||
];
|
||||
const next=steps.find(s=>!s.optional&&!s.done)||steps[4];
|
||||
return {ready:true,steps,next,completed:steps.filter(s=>!s.optional&&s.done).length,hasBuild,changedAfterBuild,live,domain,anyRunning};
|
||||
}
|
||||
return {plan};
|
||||
});
|
||||
Reference in New Issue
Block a user