Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate template via command line #22

Open
joshuaalpuerto opened this issue Jun 11, 2018 · 10 comments
Open

Generate template via command line #22

joshuaalpuerto opened this issue Jun 11, 2018 · 10 comments
Labels

Comments

@joshuaalpuerto
Copy link
Owner

No description provided.

@jlcastrillon91
Copy link

It would be really nice to have this working, I guess using commander.js as interface might work

@joshuaalpuerto
Copy link
Owner Author

@jlcastrillon91 Yes I was so busy at work and don't have enough time to implement this. Before I was going to implement it with plopjs because of the code template and generators. I've heard commanderjs and the documentation looks good.

One thing though, I don't think they have code generator from a template w/c is what I need for this.

Thoughts?

@rhm-fyayc
Copy link

https://cookiecutter.readthedocs.io/en/latest/ can be useful to you. I am giving in a try

An example
https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs

@joshuaalpuerto
Copy link
Owner Author

Hey @rhm-fyayc this looks good. However, This adds dependency(python). W/c I think is a big overhead since this is running with node. What do you think?

@rhm-fyayc
Copy link

rhm-fyayc commented Feb 15, 2019

I don't see as a dependency @joshuaalpuerto, because it is not packaged together with your project. It is a tool, such as brew, visual studio code or pip (which is also in python)

What you need it is a project that is going to work as your project structure, your baseline. Then, every time you need to start a new project you ask to create the new project based on that template.

I have forked your project to show you, check it here

https://github.com/rhm-fyayc/node-ddd-boilerplate

you can try like this

cookiecutter gh:rhm-fyayc/node-ddd-boilerplate

@joshuaalpuerto
Copy link
Owner Author

Oh I see now what you mean. I have a different goal in mind. What I want is to generate a module inside this boilerplate. Like how react-boilerplate is doing.

screen shot 2019-02-15 at 9 41 05 pm

Since staring a new module is boilerplaty and requires you to create this files.

├── app/
├── domain/
├── infra/
|   ├── database
|   |   └── models
|   ├── sequelize
|   |   └── migrations
|   ├── sequelize
|   |   └── migrations
|   ├── repo
├── interfaces/  

I can create and connect my module real fast by creating templates from those files and generate them when developer opt-in.

@rhm-fyayc
Copy link

rhm-fyayc commented Feb 15, 2019

I got your point.

If what the developer chooses has the output in the same file, you can achieve that with cookiecutter.

Example: if the developer opt-in to have a container component means to change the content of some files, that is possible. However, if this requires to create a different set of files, I think it is then not the best tool.

I don't use react framework, so I don't know the impact. But as amentioned, if it just modifies the content of some files in the basic structure, you can achieve that in some minutes with cookiecuter.

@joshuaalpuerto
Copy link
Owner Author

The thing about this issue is that the developer already have this boilerplate and want to generate a new module like roles

├── interfaces/
|   ├── modules
|   |   └── user
|   |   └── company
|   |   └── roles // <-- new module

The way I understand cookiecutter is that it will generate this boilerplate instead of the module inside it. So thats different use-case (Please correct me).

it is not packaged together with your project.

Again my use-case is to generate module inside this boilerplate. So I want my dependencies to be the same. Am looking to implement plopjs w/c I really think the best for this. However I just don't have time yet.

@rhm-fyayc
Copy link

rhm-fyayc commented Feb 16, 2019

I didn't know plopjs, but it seems to cover a broader and complex range of scenarios than cookiecutter.

If I understood it correctly, to achieve your use case with cookiecutter, each module (considering that can be seen as a template) would require a new repo for the template, not your project, meaning doesn't look the best tool for the job :-)

@Sofyrus
Copy link

Sofyrus commented Nov 14, 2020

Tried to have this feature now , please checkout the PR here #67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants