Download patch.mjs from dshunt/next18-anniversary-patch: direct link, hf CLI and curl.
- Browser
- Download file 2.62 kB
-
https://huggingface.co/datasets/dshunt/next18-anniversary-patch/resolve/main/patch.mjs
- Command line
-
hf download hf://datasets/dshunt/next18-anniversary-patch/patch.mjs
-
curl -L -o patch.mjs https://huggingface.co/datasets/dshunt/next18-anniversary-patch/resolve/main/patch.mjs
2.62 kB
| import fs from 'fs'; | |
| let a = fs.readFileSync('src/App.tsx','utf8'); | |
| const subs = [ | |
| ["import { usePartnerStore } from './hooks/usePartnerStore';", | |
| "import { usePartnerStore } from './hooks/usePartnerStore';\nimport Onboarding from './components/Onboarding';"], | |
| [" const [celebrationDay, setCelebrationDay] = useState<number | null>(null);", | |
| " const [celebrationDay, setCelebrationDay] = useState<number | null>(null);\n const [setupComplete, setSetupComplete] = useState(() => loadState('setupComplete', false));\n useEffect(() => { saveState('setupComplete', setupComplete); }, [setupComplete]);"], | |
| [" const handleSelectDay = useCallback((day: number) => {\n setCompletedDays(prev => { const next = new Set(prev); if (!next.has(day)) { next.add(day); setCelebrationDay(day); } return next; });\n }, []);", | |
| " const handleCompleteDay = useCallback((day: number) => {\n setCompletedDays(prev => { const next = new Set(prev); if (!next.has(day)) { next.add(day); setCelebrationDay(day); } return next; });\n }, []);\n\n const handleBeginDay = useCallback((day: number) => {\n const target: Record<number, string> = { 2: 'surveys', 3: 'games', 4: 'prompts', 5: 'media', 6: 'games', 8: 'learning', 9: 'games', 10: 'media', 11: 'learning', 12: 'surveys', 13: 'prompts' };\n document.getElementById(target[day] || 'timeline')?.scrollIntoView({ behavior: 'smooth' });\n }, []);"], | |
| [" if (panicMode) return <DisguisePage onReveal={() => setPanicMode(false)} />;", | |
| " if (!setupComplete) return <Onboarding partnerStore={partnerStore} onComplete={() => setSetupComplete(true)} />;\n if (panicMode) return <DisguisePage onReveal={() => setPanicMode(false)} />;"], | |
| ["<CourseTimeline onSelectDay={handleSelectDay} completedDays={completedDays} />", | |
| "<CourseTimeline onBeginDay={handleBeginDay} onCompleteDay={handleCompleteDay} completedDays={completedDays} />"], | |
| ["<GamesSection />", "<GamesSection partnerStore={partnerStore} />"], | |
| ]; | |
| for (const [o,n] of subs){ | |
| const parts = a.split(o); | |
| if (parts.length === 1){ console.error('PATCH MISS: ' + o.slice(0,70)); process.exit(1); } | |
| a = parts.join(n); | |
| console.log('patched x' + (parts.length-1) + ': ' + o.slice(0,50)); | |
| } | |
| fs.writeFileSync('src/App.tsx', a); | |
| let p = fs.readFileSync('package.json','utf8'); | |
| if (!p.includes('"@capacitor/core": "^8.3.3"')){ console.error('CAPACITOR MISS'); process.exit(1); } | |
| p = p.replace('"@capacitor/core": "^8.3.3"','"@capacitor/core": "^7.0.0"'); | |
| fs.writeFileSync('package.json', p); | |
| console.log('package.json patched: core ^7.0.0 (matches cli ^7.6.4)'); | |
| console.log('All patches applied.'); |