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

Use npms.io to fetch data + use Github to store list through Travis-CI #52

Merged
merged 2 commits into from
Dec 1, 2016
Merged

Use npms.io to fetch data + use Github to store list through Travis-CI #52

merged 2 commits into from
Dec 1, 2016

Conversation

zckrs
Copy link
Member

@zckrs zckrs commented Nov 23, 2016

This PR groups the previously commit about use npms.io to fetch data (c928917) and adds a feature to store list of generators as JSON on Github to avoid dependency with a tiers server (9a08537).

Changes

yeoman-generator-list

Each build on Travis-CI for yeoman-generator-list will execute query on npms.io to store some informations about the generators.
If build succeed (and others conditions) we push a commit with the JSON list on a orphan branch of yeoman-generator-list (named cache-generators-list)

yeoman.github.io (PR)

We would like get the latest version of list (example).

To accomplished:

  • we use Github API to get the latest SHA commit
  • to avoid the rate limit by Github (60req/hour) we store in localstorage the SHA with a updatedDate
  • we use RawGit with this SHA to serve file through MaxCDN and set proper headers

How to update the list

  • Each succeed build on master branch will create and push a new fresh list
  • We can contact Travis-CI to enable and configure a daily Cron Job
  • In complementary we can trigger a new build by Travis-CI API curl -s -X POST -H "Travis-API-Version: 3" -H "Authorization: token secret_token_here" -H "Content-Type: application/json" -d '{"request":{"branch":"master"}}' https://api.travis-ci.org/repo/yeoman%2Fyeoman-generator-list/requests (rate limit: 10req/hour)

* 2eb02cd Use npms.io API to fetch infos
* de27539 Use xo directly
* 50207f0 Cleanup description
* 360b788 Use p-map to fetch infos package
* fb1968d Travis use NodeJS 6
* 282b0ea Fetching info for packages split into group of 250 elements
@eddiemonge
Copy link
Member

I am not ok with using travis to host the list as its not a true cdn and doesn't give all the benefits cloud storage does. the rest looks ok. working on moving the "build" system somewhere else so it can deploy easier

@zckrs
Copy link
Member Author

zckrs commented Nov 23, 2016

Travis don't host the list who use on site.
He just create and push the list.

At end Github host the list. See https://github.com/zckrs/yeoman-generator-list/commits/cache-generators-list

@eddiemonge
Copy link
Member

Right, we have had problems hosting on github. its not as fast, reliable or good as gcdn

@zckrs
Copy link
Member Author

zckrs commented Nov 23, 2016

Totally true and that why I use http://rawgit.com

RawGit serves raw files directly from GitHub with proper Content-Type headers.
No traffic limits or throttling. Files are served via MaxCDN's super fast global CDN.

@SBoudrias
Copy link
Member

I think generating the list from Travis is good idea. We can talk about where we want to push the json list itself further.

@zckrs can you setup the new process to run on a test branch with hourly build from Travis. We could leave it there for a week to make sure it runs fine and does correctly update the list every hour. I think that'd give us more confidence in relying on this new flow to generate the json list.

@zckrs
Copy link
Member Author

zckrs commented Nov 24, 2016

Done.

You can view commits here https://github.com/yeoman/yeoman-generator-list/commits/cache-generators-list
pushed by Travis here https://travis-ci.org/yeoman/yeoman-generator-list/builds

Do you want I run the gh-pages of my fork of yeoman.github.io?

* b00e751 Host list generator on Github through TravisCI
* fe9ff89 Cleans unused code
* 9bab2c3 Edit to work with upstream master
@mischah
Copy link
Member

mischah commented Nov 27, 2016

Hej @zckrs,

your solution seems to work like a charm 💖

I just wonder if its possible to make less noise?

In the Gitter room:
image

An on my Github homepage:
image

Yours, Michael

@zckrs
Copy link
Member Author

zckrs commented Nov 28, 2016

Right I use my personal access token to push commit.

I would like find a solution to avoid this noise.

Maybe we should use a specifc user (https://github.com/yeoman-bot) but external to organization.

Or create a new repo to store data

@diegohaz
Copy link

Is this accurate? One of my generators isn't in the list anymore (https://github.com/diegohaz/generator-rest) and another is shown with 0 stars even though the repository has 300+ (https://github.com/diegohaz/arc, the generator code is in another branch).

@zckrs
Copy link
Member Author

zckrs commented Nov 28, 2016

@diegohaz
2016-11-28 12-38-53
2016-11-28 12-42-47

0 stars because npms.io not return a github object https://api.npms.io/v2/package/generator-arc

You can compare your generator-arc with https://github.com/kriasoft/react-static-boilerplate who have a Yeoman generator in another branch.

@zckrs
Copy link
Member Author

zckrs commented Nov 28, 2016

FYI about accuracy npms.io

Whenever a new version is published it gets analyzed instantly, otherwise its each 15 days

@diegohaz
Copy link

diegohaz commented Nov 28, 2016

I see. generator-react-static has the github object; generator-arc and generator-react-fullstack, also from kriasoft, hasn't. But I don't understand why.

I was thinking that's because generator-arc isn't fully released (it doesn't work properly yet) and npms.io might test it somehow. But this is also happening to react-fullstack...

@diegohaz
Copy link

Maybe @satazor can help with this?

@zckrs
Copy link
Member Author

zckrs commented Nov 28, 2016

@diegohaz Better open issue on npms repo

@SBoudrias
Copy link
Member

@zckrs a git user is only an email and a name. It doesn't need to have an account on github. For yeoman.io we set it up as such https://github.com/yeoman/yeoman.github.io/blob/source/.travis.yml#L33

@zckrs
Copy link
Member Author

zckrs commented Nov 28, 2016

True but to have a personal access token we need a account registered currently is mine https://github.com/yeoman/yeoman-generator-list/pull/52/files#diff-354f30a63fb0907d4ad57269548329e3R11

@SBoudrias
Copy link
Member

@zckrs yes, that's required, but it doesn't link commits to your account.

@zckrs
Copy link
Member Author

zckrs commented Nov 28, 2016

Any commits are linked to my account but activities yes. This is the problem of @mischah

@mischah
Copy link
Member

mischah commented Nov 28, 2016

@SBoudrias How did you set up the token for this:
https://github.com/yeoman/generator/blob/master/.travis.yml#L19

@SBoudrias
Copy link
Member

You need to create an oauth token https://github.com/settings/developers

@mischah
Copy link
Member

mischah commented Nov 28, 2016

@SBoudrias
Copy link
Member

Exactly like that

@satazor
Copy link

satazor commented Nov 29, 2016

Regarding the issue about these not having a github object, I've answered here: npms-io/npms-analyzer#112

@SBoudrias
Copy link
Member

@zckrs I think this setup looks good for now. Can you merge on master and set it up so it'll work from there?

@zckrs
Copy link
Member Author

zckrs commented Dec 1, 2016

Done.


@mischah about your issue on the spam in Github activites. Can you open a new issue to describe problem and discuss on a possible solution ?

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

Successfully merging this pull request may close these issues.

6 participants