Search posts, tags, users, and pages
How do you create new npm packages? All files manually? Or use some automation?
I’ve sat down a number of times and automated the process. I’ve made yeoman generators, I’ve made my own custom tools and scripts to automate the process. They were all shit, every last one was a waste of time and I threw them all out almost immediately.
Automation can improve a lot of things, but it can also get in the way of reevaluation. I’m constantly changing my mind about different tools. For example, since Prettier came out I've gone back and forth several times the value of adding it to every project. I’ve done this with tons of things.
A couple years ago I would setup a dozen or so tools for every single project I started. Babel, ESLint, Gulp, Browserify, Uglify, Mocha/Chai/Sinon, Karma, Travis, Code Climate, Istanbul. For most projects, I didn’t get value out of any of them.
Today, I’ve trimmed all of that down to two tools: Flow & Jest. Everything else is left out until I have a concrete need for it.
Starting a new project looks like this:
git init project && cd project
yarn init
yarn add --dev jest flow-bin
yarn flow init
flow-typed install jest@21
touch README.md LICENSE index.js test.js .travis.yml .gitignore
I paste the content for the LICENSE and .travis.yml, I make a couple edits to the package.json and add node_modules and *.log to .gitignore and I start working. It takes me less than a minute every time. When I’m done I run:
hub create user/repo -d "description"
npm version major
npm publish
git push origin master --follow-tags
I wait until a need for a tool arises before I add it. I don’t add Babel even though I use Flow because I can just use the /*: comment */ syntax which is fine.
I don’t really try to optimize my workflow with all sorts of automation, keyboard shortcuts, and fancy tools. If I’m not getting enough value out of something I cut it, even if I once thought it was awesome.