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

clone typings repo using github auth #118

Open
unional opened this issue Jun 29, 2016 · 16 comments
Open

clone typings repo using github auth #118

unional opened this issue Jun 29, 2016 · 16 comments

Comments

@unional
Copy link
Collaborator

unional commented Jun 29, 2016

No description provided.

@Sweetchuck
Copy link

How can I turn off the automatic github repo cloning?
I even can't try out the yo typings command, because it every time fails to clone a non-exists repository.

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

What's the error you are seeing? Do you know why it does not exist?

Let me know which package you try to type so I can see if there is a bug somewhere.

In the mean time you can disable it by -skip-git.

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

Or -skipGit. I forgot how yo translate the options from cli to code. I think either should work

@Sweetchuck
Copy link

Sweetchuck commented Jul 13, 2016

Zsh $ yo --version
1.8.4
Zsh $ npm list -g | grep generator-typings
├─┬ [email protected]
Zsh $ yo typings --help
Usage:
  yo typings:app [options] [<typingsName>]

Options:
  -h,   --help             # Print the generator's options and usage
        --skip-cache       # Do not remember prompt answers             Default: false
        --skip-install     # Do not automatically install dependencies  Default: false
        --update-template  # Update template                            Default: false
        --debug            # Print debug info                           Default: false

Arguments:
  typingsName  # If specified, this will be used as the <repositoryName> and the repo will be created under this folder  Type: String  Required: false

An the other problem is that during the process it deletes the current directory.

mkdir foo
cd foo
yo typings

At the end of the command the foo directory is not exists

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

Try --skip-git. It is not documented

@Sweetchuck
Copy link

OK. This command did the job :-)
yo typings --skip-cache --skipGit --skip-git
I don't know which option name is valid --skipGit or --skip-git but none of them documented (see the help output above)

@Sweetchuck
Copy link

I think the git cloning should not be the default behaviour.

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

I'll look into the directory being deleted issue. What you are doing is a basic workflow.

Can you show me what it prints out?

@Sweetchuck
Copy link

Sweetchuck commented Jul 13, 2016

➜ andor@landaree~/tmp
Zsh $ mkdir -p yo-tpl-test/foo/bar
➜ andor@landaree~/tmp
Zsh $ cd yo-tpl-test/foo/bar 
➜ andor@landaree~/tmp/yo-tpl-test/foo/bar
Zsh $ yo typings

     _-----_     ╭──────────────────────────╮
    |       |    │      Welcome to the      │
    |--(o)--|    │    sensational typings   │
   `---------´   │        generator!        │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 


I'll be creating the typings repository under the current folder

To begin, I need to know a little bit about the source you are typings for.
? Where can I get it from? cannot be downloaded
? What is the name of the package? asd
? Enter the homepage of the package (if any)
? How can the package be used? (Press <space> to select)CommonJS Module
? Where can the package be used? (Press <space> to select)Native NodeJS

Good, now about the typings itself...
Based on your configured template, ...
repository: foo/bar
Github username: Sweetchuck
license: MIT
license signature: Sweetchuck
test framework: blue-tape
? Does it look good to you? Yes
Cloning into '/home/andor/tmp/yo-tpl-test/foo/bar'...
using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/foo/bar.git/'

events.js:159
      throw err;
      ^

Error: Uncaught, unspecified "error" event. (Cloning into '/home/andor/tmp/yo-tpl-test/foo/bar'...
using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/foo/bar.git/'
)
    at emit (events.js:157:17)
    at Immediate._onImmediate (/home/andor/.nvm/versions/node/v5.7.1/lib/node_modules/generator-typings/node_modules/yeoman-generator/lib/base.js:438:16)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
➜ andor@landaree~/tmp/yo-tpl-test/foo/bar
Zsh $ ls -la
total 0
➜ andor@landaree~/tmp/yo-tpl-test/foo/bar
Zsh $ cd ..
➜ andor@landaree~/tmp/yo-tpl-test/foo
Zsh $ ls -la
total 0
drwxr-xr-x 2 andor users  6 2016-07-13 21:37 .
drwxr-xr-x 3 andor users 17 2016-07-13 21:37 ..
➜ andor@landaree~/tmp/yo-tpl-test/foo
Zsh $

After the yo ... command the ~/tmp/yo-tpl-test/foo/bar is not exists

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

Yeah do you plan on placing the typings in foo/bar on github? If not, you would say no and configure it to the right place.

The generator expect you to host the typings on github.

@Sweetchuck
Copy link

The problem is that when first I time created the directory structure I hadn't know it should be the same as the already existing repository on the github.

And this message repository: foo/bar doesn't clarify that it should be a github repository.

Sorry but I have to say that the default settings/behaviour is very very miss leading and annoying. The entry barrier is very high.

This was my first experience.
I just wanted to try out to see what kind of project structure will the result be.

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

Thanks for the feedback. That's what #88 is for. The default workflow is aimed to create the repo with least amount of work.

I'm considering to create a --minimal option in the future. But still don't know what should be included in it

@Sweetchuck
Copy link

A template engine should do nothing with my Github credentials.
The generator-typings has more than 400 dependencies.
Can you control all of them in security aspect?

The maximum this package should do is that echo a message to the stdout:

Based on your configuration run the following commands:
git init
git remote add origin https://github.com/foo/typed-bar.git

Or something like that.

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/foo/bar.git/'

events.js:159
      throw err;
      ^

Error: Uncaught, unspecified "error" event. (Cloning into '/home/andor/tmp/yo-tpl-test/foo/bar'...
using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
using qt5ct plugin
Pass a valid window to KWallet::Wallet::openWallet().
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/foo/bar.git/'
)
    at emit (events.js:157:17)
    at Immediate._onImmediate (/home/andor/.nvm/versions/node/v5.7.1/lib/node_modules/generator-typings/node_modules/yeoman-generator/lib/base.js:438:16)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

This is probably inside git itself.
The generator calls simple-git's clone for that:
https://github.com/typings/generator-typings/blob/master/generators/app/createGitCommands.js#L78
Which in turns calling cli git, AFAIK.

The maximum this package should do is that echo a message to the stdout:

Please see the README: https://github.com/typings/generator-typings#usage

The generator-typings has more than 400 dependencies.

Most dependencies comes from yeoman-generator, not dependencies of generator-typings itself.

@Sweetchuck
Copy link

Sweetchuck commented Jul 13, 2016

Most dependencies comes from yeoman-generator, not dependencies of generator-typings itself.

At the end no mater where those dependencies came from.

Please see the README: https://github.com/typings/generator-typings#usage

Like I sad before, by default a template engine should not care about my VCS workflow. Just copy files from location A to location B, rename if it is necessary and change the content based on the configuration. Nothing more.

How many of the other generator-* packages want to clone git repositories?

@unional
Copy link
Collaborator Author

unional commented Jul 13, 2016

Would this message works better?

Good, now about the typings itself...
Based on your configured template, ...
repository: https://github.com/foo/bar.git  # <-- here
Github username: unional
license: MIT
license signature: unional
test framework: blue-tape

At the end no matter where those dependencies came from

yeoman-generator is the base class for ALL generator code. I cannot skip that as long as I'm writing yo generator.

Like I said before, by default a template engine should not care about my VCS workflow.

Ok. In this regards generator-typings is not really a template engine. It does a lot more than that. It reads the npm/bower package, install npm and typings and so on.

My ultimate goal is to just run a command and get the whole typings repo setup, including testing. And then once that is done, I can do yo typings:publish or typings publish to create a PR on https://github.com/typings/registry

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