MoOx / phenomic

DEPRECATED. Please use Next.js instead.
https://nextjs.org
MIT License
3.22k stars 249 forks source link

1.0.0 #925

Closed bloodyowl closed 7 years ago

bloodyowl commented 7 years ago

hi people!

we discussed a lot with @MoOx in the last few weeks, about the current limitations of the solutions and requests you made. I started prototyping a few things and I'm proud to say that the 1.0.0 version will be ready soon. in short, what you should know:

sneak peeks

phenomic-plugin-react query

screen shot 2016-12-21 at 22 25 38

modular!

screen shot 2016-12-21 at 22 06 50

output

screen shot 2016-12-21 at 22 31 10
MoOx commented 7 years ago

falling

😱 Can't wait for the PR

For anyone reading this, feel free to share all your thoughts and questions so we can be sure to address everything.

VinSpee commented 7 years ago

Looking amazing!

Those are two pain-points I have and would love for them to be simplified in some way.

Thanks for the great work, looking forward to upgrading.

bloodyowl commented 7 years ago

@VinSpee

Is this still going to use redux with phenomic's collentionEnhancer?

redux will not be used by default, but as it's going to be modular, you can build a plugin that uses it if you want. enhanceCollection will not be here anymore, the query utility you can use in the higher-order-component will do this just as well

react-router will be kept for now, although there are some complications with where there are going for v4, mainly because the new API doesn't let us analyse routes statically (which we really need to do). we're going to stick with it for now and see what happens next.

the PageContainer will disappear for a simple Renderer. we are going to release a plan to upgrade real soon, and it will be real simple 😊

VinSpee commented 7 years ago

That all sounds fantastic. I'm excited about the direction phenomic is taking! Thanks again!

thangngoc89 commented 7 years ago

Will there be any boilerplate code? Do I have to change a lot of code for upgrading ? (I mean from 1.0.0 and beyond)

bloodyowl commented 7 years ago

What changes:

The content directory root lists collections, for instance:

- content
  - authors
  - blog
  - pages
  - faq

will produce 4 collections: authors, blog, pages & faq. in these directories you can organise as you want.

it's you who decides of URL behaviour in your routing, for instance:

<Route path="/" component={Home} />
<Route path="/blog" component={BlogList} />
<Route path="/blog/post/*" component={BlogPost} collection="blog" />
<Route path="/faq" component={FAQList} />
<Route path="/faq/item/*" component={FAQList} collection="faq"/>
<Route path="/404.html" component={Error404} />
<Route path="*" component={Page} collection="pages" />

In your root components, you can do this to express your data requirements:

module.exports = createContainer(BlogList, {
  posts: query({
    collection: "blog",
  }),
  tags: query({
    collection: "tags",
    filter: "blog",
  }),
})

The only boilerplate you need is to use this as an entry point:

import { Renderer } from "phenomic-react/lib/client"

const app = (
  <Router>
    {/* your routes*/}
  </Router>
)

module.exports = Renderer.render(app)
VinSpee commented 7 years ago

this looks absolutely brilliant. Thanks!

ezralalonde commented 7 years ago

This is really exciting! Thanks!

kuzvac commented 7 years ago

440723_orig

MoOx commented 7 years ago

@bloodyowl Maybe you forget the routes? Do you plan to have default routes?

bloodyowl commented 7 years ago

@MoOx what do you mean?

brianrc commented 7 years ago

This is soo exciting!

How does this differ from next? Any plan for page prefetching with a service worker?

ryandeussing commented 7 years ago

I build a lot of static sites using Jekyll et al and I'm starting to get excited by SPA approaches. Like @brianrc I'd really appreciate a breakdown of the differences between Next.js and Phenomic. I'm trying to determine if one or the other is a good/better fit for statically-served, SPA sites powered by something like NetlifyCMS or Contentful.

I also see some discussion of Phenomic possibly adopting Next.js, so any updates on that would be very helpful as well.

Thanks for any insight you can share!

kennu commented 7 years ago

This looks really exciting. I have been struggling a bit with porting my ~2000 content page website to Phenomic. All kinds of problems happen when building it and development mode is slow.

I hope my page structure will work with the new version. It's like this:

content/<manufacturer>/index.md - Manufacturer page (layout: Manufacturer)
content/<manufacturer>/<product>.md - Product page (layout: Product)

That makes it easy to associate products relationships with manufacturers without adding any extra fields, just by putting them in the right subfolders. I wouldn't mind getting rid of the repetitive layout: fields in all pages though.

ivan-kleshnin commented 7 years ago

@bloodyowl

phenomic will be modular it's not going to rely on webpack to grab content anymore, it's going to be using watchman, leveldb and express under the hood

Are LevelDB and Express are going to be used only for development stage?

Otherwise, I don't understand what is "static" about Phenomic. It's rather an app skeleton or a demo app, than a site generator.

bloodyowl commented 7 years ago

@brianrc @ryandeussing next needs a server-side runtime, Phenomic doesn't, it's a static site generator.

@kennu This use case is interesting, I'll make the collection resolver customisable for this kind of needs.

@ivan-kleshnin These dependencies are only used during development & build

thangngoc89 commented 7 years ago

@ivan-kleshnin Phenomic is a static site generator. It doesn't require any server code to run. And you are right, LevelDB and Express are used for development. Express is used since the first version of Phenomic. @bloodyowl do you have any plan that support generating a site from external data (rest api, graph api,...) without writing a script to generate markdown files from these data first?

ryandeussing commented 7 years ago

I am thinking about rewriting Phenomic using Next.js. [#889]

Sorry to have skated around my question, which is: if this is not happening for 1.0, is it still being considered? Thx.

bloodyowl commented 7 years ago

no, given the shift in modularity it is not an option anymore

kennu commented 7 years ago

Thanks @bloodyowl. I guess my desired use case can be generalized into supporting folder structures, so all 2000 pages don't have to be in one flat folder. The "special" thing is the index.md of each folder, so I can maintain URL structure /manufacturer/ for manufacturers and /manufacturer/product/ for products. I hope it can somehow fit the route definitions.

ivan-kleshnin commented 7 years ago

@bloodyowl @thangngoc89 ok, thanks for clarifications. I'm looking forward for this new version with other people :)

revolunet commented 7 years ago

Hey hey, good to know things are moving forward :)

What to you mean by "soon" for a first RC ? 😄

how do you plan handling .json files or 3rd party data sources ? for example, some "collection" may come from a single json, or a 3rd party db

Tell me if theres any phenomic sprint around :)

bloodyowl commented 7 years ago

I'm currently adding static types (flow) to the prototype I've got, the last big step before an alpha version is decoupling the content fetcher, making it a plugin so that any type of source can work

thangngoc89 commented 7 years ago

@bloodyowl that's awesome. Decoupling the content fetcher is a must. I need more than 1-to-1 map between markdown files and pages.

thangngoc89 commented 7 years ago

@bloodyowl from what I understand, phenomic-react is a plugin which generates a React powered site with Phenomic. If I want to generate an AMP version of the same content, I could write a phenomic-amp plugin is do that write?

AdrianoCahete commented 7 years ago

I'm landing on this project now: Searching for static site generator, from reddit. Reading issues to know if have any problem for my development, i find this issue.

it's going to be using watchman, leveldb and express under the hood

Since the actual version works, the 1.X version will work on Windows? Because watchman is in alpha phase now...

brianrc commented 7 years ago

eek, I'm also on Windows...

MoOx commented 7 years ago

Windows will be supported on the medium/long run, don't worry. We will look how other projects handle this (like flow and react-native - which works on windows for a while)

bloodyowl commented 7 years ago

we'll add chokidar as a fallback

MoOx commented 7 years ago

sane is maybe a better option

DavidWells commented 7 years ago

@bloodyowl what is the ETA on seeing this branch? No rush of course!

I'm just trying to plan out some stuff for our site and am very curious to see + collaborate on the upcoming version.

We have a very serious need to solve some of the looming issues the current version has in regards to supporting larger sites (1000+ pages) and I'd like to help anywhere I can on this!

Thanks! ⊂◉‿◉つ

MoOx commented 7 years ago

I hope to have some time next week (if my life can go back to normal - which isn't the case for the past 3 weeks) to make a feature list and prepare the new branch so we can start opening a usable PR before the end of the month.

bloodyowl commented 7 years ago

Here is the WIP: https://github.com/bloodyowl/PhenomicFuture Doesn't fully work yet, but should be an interesting sneek peak. I know the commit history is a total mess, sorry about that 😅 This way it'll be easier for everyone to track changes and coordinate.

MoOx commented 7 years ago

@bloodyowl let's have a chat asap to start a PR with your work. I will try to get some time this evening (the sooner the better - I will poke you around)

My idea is (since it's a complete reboot):

Tell me if this approach looks good to you. I am starting a checklist anyway.

MoOx commented 7 years ago

⚠️ This list is a total mess for now as I just read the entire source code and listed what I see we should have

“Developer features”

MoOx commented 7 years ago

Obviously, feel free to discuss this list ;)

MoOx commented 7 years ago

It has begun... https://github.com/MoOx/phenomic/pull/936 Feel free to continue the discussion over there!

MoOx commented 7 years ago

Next.js has now a open PR to add next export, time to check again if that's interesting to rely on it.

https://github.com/zeit/next.js/pull/1576

That would be awesome to rely on next which (I think) will have a bright future.

MoOx commented 7 years ago

Relying on next.js is not a priority, we might add a plugin for this later.

MoOx commented 7 years ago

master is a 1.0.0 super pre alpha, we might release an official alpha/beta at the end of the month.