<commit_before>import request from 'request';
import {Observable} from 'rxjs';
import fs from 'fs';

const githubSearchQuery = `cycle+OR+cyclejs+language%3AJavaScript+created%3A>2014-11-01+stars%3A>3&type=Repositories&sort=stars&order=desc`;

function githubApiSearch (query) {
  return `https://api.github.com/search/repositories?q=${query}`;
}

function githubSearch (query) {
  return `https://github.com/search?q=${query}`;
}

const requestOptions = {
  url: githubApiSearch(githubSearchQuery),
  headers: {
    'User-Agent': 'cycle-ecosystem'
  }
};

Observable.bindCallback(request)(requestOptions)
  .map(([error, response]) => JSON.parse(response.body).items)
  .map(toMarkdown)
  .forEach(updateReadme);

function toMarkdown (searchResults) {
  return `
# cycle-ecosystem
What are the most popular libraries for Cycle.js?

| Name     | Description       | Stars |
| -------- | ----------------- | ------|
${searchResults.map(toMarkdownEntry).join('\n')}

Auto generated by update.js by [searching Github](${githubSearch(githubSearchQuery)}).

Last updated at ${new Date().toString()}.
`;
}

function toMarkdownEntry (result) {
  return `| [${result.full_name}](${result.html_url}) | ${result.description} | ${result.stargazers_count} |`;
}

function updateReadme (markdown) {
  fs.writeFile('./README.md', markdown);
}<commit_msg>Remove timestamp (so that commits only get made if list changes)<commit_after>import request from 'request';
import {Observable} from 'rxjs';
import fs from 'fs';

const githubSearchQuery = `cycle+OR+cyclejs+language%3AJavaScript+created%3A>2014-11-01+stars%3A>3&type=Repositories&sort=stars&order=desc`;

function githubApiSearch (query) {
  return `https://api.github.com/search/repositories?q=${query}`;
}

function githubSearch (query) {
  return `https://github.com/search?q=${query}`;
}

const requestOptions = {
  url: githubApiSearch(githubSearchQuery),
  headers: {
    'User-Agent': 'cycle-ecosystem'
  }
};

Observable.bindCallback(request)(requestOptions)
  .map(([error, response]) => JSON.parse(response.body).items)
  .map(toMarkdown)
  .forEach(updateReadme);

function toMarkdown (searchResults) {
  return `
# cycle-ecosystem
What are the most popular libraries for Cycle.js?

| Name     | Description       | Stars |
| -------- | ----------------- | ------|
${searchResults.map(toMarkdownEntry).join('\n')}

Auto generated by update.js by [searching Github](${githubSearch(githubSearchQuery)}).
`;
}

function toMarkdownEntry (result) {
  return `| [${result.full_name}](${result.html_url}) | ${result.description} | ${result.stargazers_count} |`;
}

function updateReadme (markdown) {
  fs.writeFile('./README.md', markdown);
}
{'fraction_non_alphanumeric': 0.17907669396872672, 'fraction_numerical': 0.008935219657483246, 'mean_word_length': 4.8540305010893245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6553813', 'n_tokens_mistral': 908, 'n_tokens_neox': 874, 'n_words': 163}