diego3g / electron-typescript-react

:electron: An Electron boilerplate including TypeScript, React, Jest and ESLint.
1.45k stars 295 forks source link

Create a project generator for the boilerplate #16

Closed wilgnne closed 3 years ago

wilgnne commented 4 years ago

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
diego3g commented 4 years ago

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?

wilgnne commented 4 years ago

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:

felipsbreno commented 4 years ago

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 .

solrachix commented 4 years ago

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.

image

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:

  1. The code will always be updated;
  2. Reduces the size of the CLI considerably

Disadvantages:

  1. The User must have GIT installed, to make the clone

image

Note: Obviously both methods require yarn or npm installed

sorry for my english, he is not so good; _;)

Ghosts commented 4 years ago

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

diego3g commented 3 years ago

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!