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

props or just variable #38

Closed
hueitan opened this issue Apr 29, 2014 · 15 comments
Closed

props or just variable #38

hueitan opened this issue Apr 29, 2014 · 15 comments

Comments

@hueitan
Copy link
Contributor

hueitan commented Apr 29, 2014

In the template file

for example

{
  "name": "<%= slugname %>",
  "version": "0.0.0",
  "main": "lib/<%= slugname %>.js",
  "description": "<%= props.description %>",<% if (props.homepage) { %>
  "homepage": "<%= props.homepage %>",<%}%>
  "bugs": "<%= repoUrl %>/issues",
  "author": {
    "name": "<%= props.authorName %>",
    "email": "<%= props.authorEmail %>"<% if (props.authorUrl) { %>,
    "url": "<%= props.authorUrl %>"<% } %>
  }
}

In this case we have variable slugname props.homepage

Can we select just one type

  1. all using props
    or
  2. all using variable (assign all props to a variable, let props.authorName => authorName)

Easier for maintenance.

Thanks

@hemanth
Copy link
Member

hemanth commented Apr 29, 2014

I would vote for all props.

@hueitan
Copy link
Contributor Author

hueitan commented Apr 29, 2014

One question.

How do I support variable like safeSlugname ? That's not from props.

@hemanth
Copy link
Member

hemanth commented Apr 29, 2014

In what scenario it won't be from props? As of now it's slugified props.name

@hueitan
Copy link
Contributor Author

hueitan commented Apr 30, 2014

safeSlugname is original from slugname which is from the props

But sometimes we need other variables which are not being given by user in props

In my opinion, maybe variable is cool enough.

In the template, we don't need <% props.xxxx %> props again. Just use <% xxxx %>

But we need to assign the variable from props in the index.js, that's the trouble works.

@hemanth
Copy link
Member

hemanth commented Apr 30, 2014

In that case the variables are a good solution.

What says @sindresorhus @SBoudrias ?

@hemanth hemanth mentioned this issue May 9, 2014
9 tasks
@hueitan
Copy link
Contributor Author

hueitan commented Jun 17, 2014

Total 10 props, I think more than 10 will cause dislike 😢

var prompts = [{
      name: 'description',
      message: 'Description',
      default: 'The best module ever.'
    }, {
      name: 'homepage',
      message: 'Homepage'
    }, {
      name: 'license',
      message: 'License',
      default: 'MIT'
    }, {
      name: 'githubUsername',
      message: 'GitHub username'
    }, {
      name: 'authorName',
      message: 'Author\'s Name'
    }, {
      name: 'authorEmail',
      message: 'Author\'s Email'
    }, {
      name: 'authorUrl',
      message: 'Author\'s Homepage'
    }, {
      name: 'keywords',
      message: 'Key your keywords (comma to split)'
    }, {
      name: 'cli',
      message: 'Do you need cli tools?',
      default: 'yes'
    }, {
      name: 'browser',
      message: 'Do you need browserify?',
      default: 'yes'
    }];

@hemanth
Copy link
Member

hemanth commented Jun 17, 2014

We could just stick on the github user name or author name and skip email and URL?

@hueitan
Copy link
Contributor Author

hueitan commented Jun 17, 2014

I think email is still needed.
But url and author name can retrieve from user name

@hemanth
Copy link
Member

hemanth commented Jun 17, 2014

👍 So be it?

Update: @huei90 Lets reduce it to bare minimal.

@faustman
Copy link

Hi guys,
how your affairs with this task?

I want fix some trailing spaces in package.json.
Should I wait when you finish this task?

@hemanth
Copy link
Member

hemanth commented Sep 24, 2014

@faustman Go ahead, this is yet to be finalized.

@hueitan
Copy link
Contributor Author

hueitan commented Dec 8, 2014

@faustman Go Ahead!

@hemanth
Copy link
Member

hemanth commented Dec 8, 2014

@huei90 If you notice the latest _package.json expect keywords all of them are props.

@faustman
Copy link

no action from me,
no more trailing spaces since 6adf1f4

@hemanth
Copy link
Member

hemanth commented Dec 12, 2014

👍

@hemanth hemanth closed this as completed Dec 12, 2014
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

3 participants