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

Give better instructions on contributing, rethink strategy

Open mattmazzola opened this issue 6 years ago • 1 comments

I wanted to open this up for discussion. I have to say contributing to this repo is quite difficult and it seems we could make it easier with some changes. First lets look at why it's difficult:

Problems:

1. npm install modifies the repo and DELETES git history. If you accidentally run npm install on the cloned repo instead of the testing repo to update a package it will delete the git repo which rmeoves your branches etc and then restoring this is very combersumb

2. Because you can't run npm install you can't update the package-lock.json easily The only way I saw to do this was to update the packages manually in the original repo package json, then clone it locally in to the other directory for testing, run npm install which implicitly regenerates the package-lock.json, and then copy this modified package-lock.json back in to the original repo so I can actually submit the PR without mismatch between package and package-lock which would fail the npm ci

Possible solutions:

1. Give better instructions in contributing (Seems easy enough) It suggest to have two separate folders, one for making changes and another for testing them, but it should explicitly say, "do not run npm install in the repo you're making changes in"

2. Remove package-lock.json? Is package-lock.json providing much value for this repo of this purpose? It seems package-lock.json main purpose was to ensure consistent npm installs, but the entire purpose of this repo is to be a starter for new libraries which would liklely want the latest changes anyways because there is no worry about breaking due to semver issues. Then once the initial npm install has been run it generates new package-lock.json for the consumer and the library is ready to go.

3. Add option or setting to run npm install without affecting repo? I'm not sure if this is possible given it's a postinstall script and i'm not sure if that has access to the params passed to npm install, but I think it should be possible. E.g. npm install --skip-postinstall

4. Perhaps use different strategy for configuring the repo? There is already an npm run semantic-release-prepare command. This default postinstall script could be moved to a npm run prepare so it's explicit and isolated. I realize this is maybe step backwards in user experience of only having to run npm install but it is simple enough and only one extra command and since this repo is intended for devs it's minimal complexity for them.

Another alternative is to use npm create* as suggested here: https://github.com/alexjoverm/typescript-library-starter/issues/135

mattmazzola avatar Jun 05 '18 05:06 mattmazzola

@mattmazzola you're right about mostly everything. I thought about having a kind of CLI as you suggest in point 4, but didn't have the time to do so.

The workflow can be much improved indeed. Would you like to go ahead?

Side thing, would you like me to add you as a collaborator? Honestly I'm having a hard time finding time for this project, some help would be much appreaciated.

alexjoverm avatar Jul 18 '18 18:07 alexjoverm