FormidableLabs / builder-init

A project generator for builder archetypes.
MIT License
12 stars 2 forks source link

Adds archetype downloads + installation. #15

Closed ryan-roemer closed 8 years ago

ryan-roemer commented 8 years ago

At long last, builder-init is (hopefully) ready for prime time!

Overview

We use a process spawn of npm pack to do the heavy lifting for downloading archetype tarballs from file, npm, git, etc. We then expand the tarballs in a temp directory and process them into an outputted project.

This should work:

$ builder-init FormidableLabs/builder-react-component#chore-init-install

from the parallel PR https://github.com/FormidableLabs/builder-react-component/pull/33

Usage

$ builder-init -h
Usage:

  builder-init [flags] <archetype>

Flags:

  --help
  --version

Examples: 

`builder-init` can install templates from any source that `npm` can, e.g.:

  (npm)    builder-init builder-react-component
  (npm)    builder-init builder-react-component@0.2.0
  (github) builder-init FormidableLabs/builder-react-component
  (github) builder-init FormidableLabs/builder-react-component#v0.2.0
  (git)    builder-init git+ssh://git@github.com:FormidableLabs/builder-react-component.git
  (git)    builder-init git+ssh://git@github.com:FormidableLabs/builder-react-component.git#v0.2.0
  (file)   builder-init /FULL/PATH/TO/builder-react-component

Sample Flow

$ builder-init FormidableLabs/builder-react-component#chore-init-install
builder-react-component-0.1.4.tgz
[builder-init] Preparing templates for: builder-react-component
? Package / GitHub project name (e.g., 'whiz-bang-component') green-button
? GitHub organization name (e.g., 'AcmeCorp') GreenCorp
? Package description The Green Button!
? License date 2016
? License organization (e.g., you or your company) GreenCorp
? Destination directory to write green-button

[builder-init] Wrote files:
 - green-button/.babelrc
 - green-button/.builderrc
 - green-button/.editorconfig
 - green-button/.travis.yml
 - green-button/CONTRIBUTING.md
 - green-button/LICENSE.txt
 - green-button/README.md
 - green-button/package.json
 - green-button/.gitignore
 - green-button/.npmignore
 - green-button/demo/app.jsx
 - green-button/demo/index.html
 - green-button/src/index.js
 - green-button/src/components/green-button.jsx
 - green-button/test/client/main.js
 - green-button/test/client/test.html
 - green-button/test/client/spec/components/green-button.spec.jsx

[builder-init] New builder-react-component project is ready at: green-button

Review

Admittedly, this PR is a biggie, so appreciate any review we can get here. However, the bulk of the line changes are in the tests, and we've now got pretty comprehensive coverage of some awkward corner cases that can arise.

/cc @coopy @benbayard @chaseadamsio @exogen @boygirl @zachhale @kenwheeler @jstrimpel @baer

ryan-roemer commented 8 years ago

I've reproduced and am checking out node 4+ CI failures.

UPDATE: Node 4+ can't require from a mocked filesystem. Updated with a test stub, fixed, and rebased.

ryan-roemer commented 8 years ago

Coveralls Note: CI decrease is acceptable as it's user prompts for destination that we normally mock out anyways. I'll leave the red lines for now and we can add coverage / tickets if needed later.

rgerstenberger commented 8 years ago

Aside from some confusion on the docs, this looks good. I'd like another reviewer to look over the process and fs code chunks in case I missed a potential problem deep in node.

coopy commented 8 years ago

This is a metric ton of good work! Tested out the binary, worked like a charm. :+1: :100: :shipit:

ryan-roemer commented 8 years ago

@rgerstenberger @coopy -- Thanks for the review! Rebasing and going for the merge!

Everyone else -- post-merge review welcome!

ryan-roemer commented 8 years ago

Released as builder-init@0.0.1!

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-5.5%) to 92.562% when pulling 3daf91376172a5b874312d51a6ac238238516f25 on chore-init-install-final into 1cc6241c93e91654ad9a3e6b7341c811649f7cb9 on master.