Create a project generator for the boilerplate
wilgnne opened this issue · 6 comments
I would like to know your opinion about the possibility of creating a project generator for the boilerplate.
Something like
npx create-electron-ts-react my-app
I think it would be create. Do you know if we need only to add a NPM package starting with 'create-' or we need to do something more?
I don’t think so, most of the approaches I’ve seen are cli's created from scratch, but I believe that we can cheat on libraries to help us in this endeavor, or even build our own.
Some articles on the subject are:
Speak devs!
I was thinking with myself today, is there an interface just like the idea of rocketredis, postico or MongoDb Compass, but being able to see data from the bank but not only from a specific but several examples in a software to see data from the mongo and by the same data from postgres .
Hi devs, @diego3g and @wilgnne I've been doing some research and ended up creating this project generator, in two different ways. The two ways, approach differently, each having its advantages and disadvantages! come on.
The two forms, in terms of usability, at the time of production, will be identical! For example, you will run create-electron-app, and an option of available electron templates will appear, like this:
create-electron-app
> typescript-react
The first:
This is the traditional way, most commonly used for these project generators, it basically consists of having a templates folder, where the folders will be placed as a reference, for creating the project!
disadvantage: In my opinion, this disadvantage is due to the fact of the necessary structure! There would have to be a restructuring of the project, or create another repository for the CLI, but there whenever there was an update here, it would have to be reflected there.
The second:
That way, is not something I saw somewhere, I ended up having this idea while developing the first way. It basically consists of an array of objects, like this:
{
name: "typescript-react",
url: "https://github.com/diego3g/electron-typescript-react.git",
config: {
postMessage: 'run yarn dev OR npm run dev'
}
}
I believe that the object itself is already highly explanatory! So, in this way the CLI clones the repository, and then installs all the packages.
Benefits:
- The code will always be updated;
- Reduces the size of the CLI considerably
Disadvantages:
- The User must have ** GIT ** installed, to make the clone
Note: Obviously both methods require yarn or npm installed
sorry for my english, he is not so good; _;)
If you're looking for quick scaffolding off of this repo (using it as a template), degit should work great: https://github.com/Rich-Harris/degit
As we're using this as a repository template inside Github i don't think we should worry about providing an easier way to create new projects as we don't do this all the time, but i would appreciate if we could find a simple way to create a generator like yarn create electron-react-app
.
Thanks!