Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an example library #15

Open
scottnath opened this issue Oct 1, 2015 · 6 comments
Open

an example library #15

scottnath opened this issue Oct 1, 2015 · 6 comments

Comments

@scottnath
Copy link
Member

@rebmullin @conortm @nikkiana @e2tha-e @sergesemashko @beynya

I have set up a library, which imports rebecca's pattern library as an example.

Library setup with imported library

My pattern library (PL) incorporates @rebmullin's pattern library, which is here:
https://github.com/rebmullin/rebecca-pattern-library

You can see the PatternLab instance from this library here:
http://scottnath.github.io/scottnath-pattern-library/

And where Rebecca's pattern was imported here:
http://scottnath.github.io/scottnath-pattern-library/?p=molecules-rebecca

The way I imported Rebecca's PL, was to run this statement:
npm install git+ssh://[email protected]:rebmullin/rebecca-pattern-library.git --save

Which:

  1. imported rebecca's PL into my local node_modules for scottnath-pattern-library
  2. added rebecca's PL into my package.json file (because the --save flag was added to the statement above)
...
  "dependencies": {
    "pattern-library": "^0.1.2",
    "rebeccaPatternLibrary-pattern-library": "git+ssh://[email protected]/rebmullin/rebecca-pattern-library.git"
  }
...

Then, I needed to add Rebecca's PL to my config file:

npmPatternRepos:
  -
    name: 'base' # short name for this library
    repoDir: 'pattern-library' # directory name for this library
# templates imported into pattern lab after it is installed by composer
  -
    name: 'rebecca' # short name for this library
    repoDir: 'rebeccaPatternLibrary-pattern-library' # directory name for this library
# templates imported into pattern lab after it is installed by composer

Odd directory name

Notice that the directory name above is rebeccaPatternLibrary-pattern-library. This is what comes from the second question when setting up a new pattern library with the generator:
"What is the name of the GitHub repository?"
you want this name to reflect the actual repo url.

Your response to this question eventually writes to your pattern library's package.json file. You can see that Rebecca's repo name is different in her package.json file:
https://github.com/rebmullin/rebecca-pattern-library/blob/master/package.json#L2
That name entry in the package.json file is what tells NPM how to name the imported package's directory.

@rebmullin
Copy link
Contributor

hey @scottnath - this is good to know. i think this info should go in the wiki or readme tho.. or is there an actual issue here that you are trying to fix?

@scottnath
Copy link
Member Author

@rebmullin it should be both actually.
cc: @conortm @nikkiana @e2tha-e @sergesemashko @beynya

I think the question's wording on the generator should probably change and there should be something in the readme to explain how it works. Would love some help to get these answers without confusion.

The goals of the questions

  1. We need to have a title for this pattern library

This is really only used in one place, the final library readme file

# <%= libraryname %> Pattern Library

  1. We need to know the repository name

This is required in two places:

  • package.json

      "name": "<%= reponame %>",
    
  • config.yml

    # the github repository for this pattern library
    githubrepo: <%= reponame %>
    

Current wording:

question 1:

? What is the name of this Project? (scottnath pattern library)

in this one, the text inside the parenthesis is taken from the name of the directory in which you've run yo pattern-library.

question 2:

? What is the name of the GitHub repository? (scottnathPatternLibrary-pattern-library)

in this question, the parenthesis text takes whatever answer comes from question 1 and adds "-pattern-library" to it.

So...those are confusing :-) Suggestions?

@rebmullin
Copy link
Contributor

hey @scottnath

To me these questions are not super confusing so not sure if i am missing something. But i see how the attaching of the ‘pattern-library’ and ultimately changing the repo name can be.
Anyway, I don’t really know that these questions are that much better but here are some small suggestions along with README suggestions for this part:

GENERATOR QUESTIONS:

Pattern Library Project Name? ([current dir name])
Is this Project set up on Github yet?
YES:
Github Repo Name (need exact repo name) *: // make required or update the default so it doesn't smush the name together and add pattern-library - is there a reason it does this??
NO: (goes to next question / step)

GENERATOR README:

Setting PL Generator up:

Pattern Library Project Name? - This name will used as the Title of the README as in [Project Name] Pattern Library

Is this Project set up on Github yet?
YES: If you’re linking to github you must explicily type in the github repo. This name will be added to the config.yml and package.son files so that it can be shared with other PL repos and pushed to github pages (github pages too right?) //something like this not sure if this is all right
NO: directions on how to add afterwards..

@scottnath
Copy link
Member Author

@rebmullin

This is a good direction. Maybe instead of 3 questions it could be:

2. If this pattern library will be uploaded to GitHub, please provide the repository name:

How to change the readme text to reflect that? An explanation of how to get the repo name?

if your github repo url is github.com/organization/org-pattern-library, then your repository name is "org-pattern-library"

or something like that?

@rebmullin
Copy link
Contributor

@scottnath -yeh I think that sounds good. Altho i am just thinking technically it doesn't have to be added to Github to become a repo - i mean is it a possibility that we would be adding outside of nbc patterns? - but yeh i think we're on the right track. So maybe something like this:
if this pattern library is already a repo (on Github, etc), please provide the repo name:

otherwise:
if this pattern library has been added to Github, please provide the repo name:

Also i like that readme update that you have for this. i think that makes it pretty clear what should be added.

@scottnath
Copy link
Member Author

@rebmullin excellent. Can you please change the generator and readme?

For the generator, it is the main app generator. The specific lines which make up the second question start here:

message: 'What is the name of the GitHub repository?',

Instructions on creating user interactions are here:
http://yeoman.io/authoring/user-interactions.html

I think you'll want to make this second question not required and have no default answer.

I also like your text for the first one "Pattern Library Project Name? ([current dir name])" if you can change that too.

PLEASE change this so it is totally clear

instructions for readme on files to change without a repo added

"how to add your github repository to your pattern library"

(see: how to get your repository name)

This is required in two places:

package.json

"name": "YOUR-REPOSITORY-NAME",

config.yml

# the github repository for this pattern library
githubrepo: YOUR-REPOSITORY-NAME

thank you!
Scott

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants