Next.js: `next init` as a separate module?

Created on 26 Dec 2016  路  21Comments  路  Source: vercel/next.js

I don't want next init to stagnate, be opinionated, etc. The solution is perhaps to remove it.

How would you all feel about making next init an optional, installable command that comes from a different package?

npm install -g next-init

It would expose a global bin next-init. The cool thing about making it a separate module is that we can iterate on it independently, and add more features frequently.

Some ideas for the future.

next-init --preact --glamor
next-init --inferno --styletron

If anyone would be interested in leading this project, please let me know as well

Another discussion I'll open later is to take the same approach for compiling a next app into static files, via next-export.

good first issue

Most helpful comment

How about a yeoman script?

All 21 comments

How about a yeoman script?

I haven't looked at that yet, but if it satisfies our need to support "flags", and it's well supported, easy to use, easy to get started with, it sounds like a winner!

@rauchg it support tags and many more cool features.

@rauchg i would love to be part of this project, should i create a draft?
Maybe next-new would be a better name for creating new projects. We could add an --init option for creating the new project in the current dir.

@ntwcklng you're absolutely welcome to. next-new is a great name as well. Maybe it could even install a nn alias :D

But as said above, it'd be interesting to compare pros/cons of nn as a yo extension vs standalone

Awesome!
For me the standalone module would win the race. Its the standard-zeit-way - straightforward and lightweight:

$ npm install -g next-new
$ nn my-new-blog --glamor
> created my-new-blog (with: glamor)
> run `$ cd my-new-blog && npm start` to get startet

With Yeoman you have to install 2 global dependencies.

Could look like this: https://github.com/ntwcklng/next-new

nn2

Any other opinions? I would love to see that thing in production 馃槃

@ntwcklng that looks pretty neat 馃槃

@rauchg @arunoda As we all know Segment made create-next-app (https://open.segment.com/create-next-app) which is pretty neat. Maybe we should remove next init and leave this in userland?

I'm with @timneutkens, create-next-app it's awesome, it's integrated with yarn create and allow the user to start from an example so it's possible to keep adding examples and CNA it's going to have more and more options.

@timneutkens I like that idea. Yeah send a PR :)

Do you want to recommend yarn create next-app my-project or create-next-app in next -h? Or remove init command without any explaination about how to start a next project?

Lets just log out a message that it's deprecated and you can use create-next-app.

I'm interested in this issue. First of all, I love that using create-next-app for zero-configuration setup like create-react-app but It's not enough opened to folks who want to make own version of next app. As I know that create-next-app doesn't support templates(like vue-cli) or generators in the outside world(like yeoman or webpack).

How about using vue-cli template system. Conceptually, It's very similar to yo/yeoman-generator but rather than simple and straight in terms of using templates. For example, supporting github repo directly. It make next init to be more less opinionated in my point of view. I would like to make PoC version for this, any thought?

@ragingwind I like the idea 馃憤, though most people will just want to start off using one of the examples though, and create-next-app provides that. It also has a default similar to next init, which is fine. What you're proposing can obviously be an external tool though 馃憣 We're basically just removing bloat from the next codebase 馃憤

@timneutkens I see that the point of removing init from next. Have you guys decided to use create-next-app with next.js example instead of next init? Then I'm concern that

  • examples is great but It downloads only static files from the repo, which can't be combinable as a whole of an app. For example, next-init --preact --glamor
  • No template and prompting mean that there are no any custom configurations even project-name in package.json. The user need to fix every time as it is generated. It's so bothering to me

@ragingwind it's currently the only Next.js generator out there, both ways, next init was never documented, and the deprecation message is only for when people use it. It's still their decision to use create-next-app (or not) 馃槃 I'd love to see what you're proposing though, combining examples would be amazing 馃憣

@timneutkens I understand that this issue good for beginner :0 I will show off the another generator

@ragingwind 馃憤 馃挴

@timneutkens I've made a PoC version of next-init https://www.npmjs.com/package/next-init Please take a look

Was this page helpful?
0 / 5 - 0 ratings