Personally, and I don’t mean to be argumentative, but I think the question is too broad to produce a useful answer.
Learning the fretboard is only relative to the musical end you’re trying to achieve - the best method to get to the point of being able to do recreate (not improvise) fast Yngwie runs (which are mostly scalar/diatonic) is going to be different than the method to be able to improvise over Coltrane’s 26-2 in a communicative way with a band in a live setting.
Even getting more granular, within each genre or even piece of music we only need to know the fretboard well enough for that task.
And going further than that, there are stages of awareness. It’s great to know the fretboard, but there’s no limit to how well you can know it or visualize it. For example, I feel like I can do a lot, but I know that if you asked me sight-transpose a 4 part bach chorale into all 12 keys without writing anything down you’d be waiting quite a while.
I know that might not seem like a particularly helpful or pleasant answer, but I think we achieve a lot more with music/guitar when we get really specific about what we’re trying to accomplish - what the end goal is, and personally I feel strongly that a lot of practice plans get misdirected by not having a clear endpoint, and discussions of what is best become a little meaningless without a tangible objective being established.