Giter Site home page Giter Site logo

Comments (10)

minicuper avatar minicuper commented on July 4, 2024

Ok, I will think how to implement this

from generator-derby.

mattbrun avatar mattbrun commented on July 4, 2024

Hoping to help, I'll post here what I did to implement multiple apps by hand.
For example, wanting a boom app aside the app app I did the following:

  • add boom dir with index.js in src/, copied from src/app/index.js
  • add boom dir with index.css in styles/, copied from styles/app/index.css
  • add boom dir with index.html and home.html in views/, copied from views/app/*.html
  • replace the "app" word of src/boom/index.js with the "boom" word
  • change the path in the .get() route in src/boom/index.js
  • add require('./src/boom') in the apps array in server.js

And that was enough, at least for me.

Some considerations:

  • My guess is that the yeoman command might be yo derby:app
  • I think all the files to generate the app are already there, maybe they just need to be extrapolated in their own template directory
  • I'd be more than happy to help build this feature, but I never built a yeoman module (shouldn't be that hard starting from the existing one...), and I'm in a kind of super busy period, so don't expect that too soon... :(

from generator-derby.

minicuper avatar minicuper commented on July 4, 2024

I think about the issue too. And I'm going to split the generator internally into project-level generating and app-level generating. The two stuff will be still in yo derby.

If you start it inside an empty folder it generates a project with app. But if you start it inside an existing project it will create only a new app.

from generator-derby.

mattbrun avatar mattbrun commented on July 4, 2024

@zag2art I didn't know you may split a single yeoman command into multiple commands which may be called one after another. That makes sense, and I really like you're ideas of splitting things up!

From what I understood there will be one commad which does multiple things in a smart way. But what if you actually put the app generation code in another command and then call it from the project generation command?
In this way when you call 'yo derby' it calls the project and the app generation code, when you call 'yo derby:app' it just can just generate the app.

In this way:

  • generator features are pretty straight forward to learn and there are no hidden things or side-effects like behaviours
  • we don't have to check for files in directories, or checking in which dir we are, or whatsoever...
  • each "module" does one thing, and you call the app module inside the project module
  • my guess is that the code would be simpler and easier to maintain

What do you think?

from generator-derby.

minicuper avatar minicuper commented on July 4, 2024

Unfortunately yo derby = yo derby:app in yeoman because app is a default generator. Look here. I tried to find the way to change the behavior (here the code) but at the moment didn't find the answer.

from generator-derby.

mattbrun avatar mattbrun commented on July 4, 2024

Ok, I didn't know the alias story.
So, from my point of view, there might be two possibilities:

  • Following your idea of generating different things based on where we are. Maybe searching for the .yo-rc.json file might help, because it should be in the root of the project as stated here at the end. Howeever there might be a case corner: the first time we generate the project, which is in an empty dir;
  • accept an app name parameter for the yo derby command. In this way yo derby bootstrap the project in the current empty dir, and yo derby boom creates the boom app in the apps dir.

I'm not trying to avoid your original idea, I'm just trying to understand if there's a simpler way to do it :)

from generator-derby.

mattbrun avatar mattbrun commented on July 4, 2024

Another possibile solution: accept a parameter name for bot the project or the app generation, but add a --app parameter to generate an app.

from generator-derby.

minicuper avatar minicuper commented on July 4, 2024

Hmm, I like the second suggestion. Think yo derby boom is quite expressive. Anyway we need to start somewhere.

from generator-derby.

mattbrun avatar mattbrun commented on July 4, 2024

I agree

from generator-derby.

minicuper avatar minicuper commented on July 4, 2024

Add this feature.

from generator-derby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.