typescript-library-starter icon indicating copy to clipboard operation
typescript-library-starter copied to clipboard

Suggestion: separated starter script form codebase

Open gimenete opened this issue 8 years ago • 4 comments

Initially based on the script you have that runs after installing the dependencies, I've created a script that simplifies the process in only one step (it clones the repo and runs the script) and has also the benefit of being outside the codebase.

You can run the script with:

npx github:gimenete/create-typescript-library <dirname>

Repo here: https://github.com/gimenete/create-typescript-library

Besides the library name it also asks for a few other things:

  • What do you want the library to be called?
  • Is this a web app or a Node.js app? Node.js / Webapp
  • Is this a library? Standalone application? Yes / No
  • Do you want to use travis? Yes / No
  • Do you want to use commitizen? Yes / No

Maybe we can remove the embedded script you have in the project and promote using this one. My suggestion is to put this script in your repo in a different branch. Then it will be run like this:

npx github:alexjoverm/typescript-library-starter#script <dirname>

Where script is the branch name.

gimenete avatar Nov 24 '17 10:11 gimenete

Screenshot here:

screen shot 2017-11-24 at 12 31 21

gimenete avatar Nov 24 '17 11:11 gimenete

Hi @gimenete!

That would be great. Currently all scaffolding scripts and deps are in the repo itself, so this idea separates the setup from the working code.

Some thoughts:

  • I'd do it progressively: let's focus first on splitting the setup-related stuff in a separate branch, then we can talk about adding more options.
  • Although npx is great and the preferred option, it could be a good idea to provide instructions to do it just with npm as well.

I'd be happy to work with you or someone else on this. Any PR is more than welcome :)

alexjoverm avatar Dec 04 '17 12:12 alexjoverm

It would be nice to separate the starter code from the deps so any update to the deps could be translated to all libraries started with this starter.

I took this idea from create-react-app that uses react-scripts to hold all its starter logic, then I saw @kentcdodds talking about how PayPal is taking this approach for their starters in this blog post.

I've started to do this in the TypeScript Node Starter and the results are awesome 🙂.

I would love to see this starter going in that direction so my existing libraries could benefit from updates to this project.

Thanks for the great work!

hrajchert avatar Dec 08 '17 14:12 hrajchert

Thanks @hrajchert for the links and the suggestions. This is indeed an exciting feature. I've added the help wanted tag in case someone wants to take care of this issue, otherwise I'll try to have something working when I find some time.

alexjoverm avatar Dec 11 '17 07:12 alexjoverm