pattern-lab / patternlab-node

The Node version of Pattern Lab
http://patternlab.io
MIT License
2.05k stars 408 forks source link

Implement a CLI Init Project Command #471

Closed bmuenzenmeyer closed 7 years ago

bmuenzenmeyer commented 8 years ago

Implement a project init command as described in: https://github.com/pattern-lab/patternlab-node/issues/281

The landscape of the project has changed but the spirit is correct to me. These are just some initial thoughts. All feedback is welcome.

Default

npm install -g patternlab-node
cd existing/project
`patternlab init`

Default Outcome

existing/project/source/ - empty dirs that match a typical source/ existing/project/public/ existing/project/package.json - a file we supply that supports a local install of PL. this is necessary right? or would it not be if patternlab-node was globally installed. may need to think more about this existing/project/patternlab-config.json - a file we supply that matches what is typically inside edition-node-*/patternlab-config.json

Option Starterkit

patternlab init --kit=starterkit-mustache-demo (as an example)

Option Starterkit Outcome

Same as above, but existing/project/source/ contains the starterkit you specified.

raphaelokon commented 8 years ago

I would probably keep the structure of a project/starterkit separate from the core/cli and questionnaire the user to generate the directories and the adjust patternlab-config.json to the outcome of the user inquiry.

raphaelokon commented 8 years ago

Also: I wouldn't add a --kit but add it as a step in the inquirer.

raphaelokon commented 8 years ago

existing/project/package.json - a file we supply that supports a local install of PL. this is necessary right? or would it not be if patternlab-node was globally installed. may need to think more about this

What is the idea behind this? Making a patternlab project self-contained? Shouldn't that info sit in the patternlab config itself? Not sure. What if patternlab is just part of a bigger module (that's how I use it anyways) that already has a package.json?

bmuenzenmeyer commented 8 years ago

I would probably keep the structure of a project/starterkit separate from the core/cli and questionnaire the user to generate the directories Also: I wouldn't add a --kit but add it as a step in the inquirer.

Sure that would work, where init could potentially inquire to the user if they wish to see which starterkits are available.

adjust patternlab-config.json to the outcome of the user inquiry.

FWIW: we don't store any starterkit info in the patternlab-config.json file today. though I believe PHP does. Today, starterkits are installed in node_modules/ and looked for rather crudely.

What is the idea behind this? Making a patternlab project self-contained?

This is and always will be the primary use case we have aimed to support. The current ecosystem is built with this in mind - from the core to the styleguide kits all coming together in an edition. The creation of a CLI presents a wedge in this ecosystem, as you and I have discussed a bit and you well-illustrated above.

So to me, with the CLI:

  1. it sits as the new API into core for editions.
  2. it's poised to "spawn" self-contained PL instances at a directory of your choosing, or
  3. Pattern Lab can be called within bigger toolchains

You are right, with most of the dependencies of the current editions (especially BrowserSync) moving into core, we probably eliminate the need to drop in a package.json file

raphaelokon commented 8 years ago

Okay … I think you will like the current init implementation :> I am pushing it in a bit.

raphaelokon commented 8 years ago

You can checkout the current init here

bmuenzenmeyer commented 7 years ago

Closing this issue- the other repo is the place to be and good discussion is found there