Skip to content

Commit

Permalink
Sort results by GitHub stars
Browse files Browse the repository at this point in the history
Also, since we now need a GH repo for every library, make the name a link to the repo
  • Loading branch information
rictic committed Feb 10, 2022
1 parent 525c0ec commit de27398
Show file tree
Hide file tree
Showing 26 changed files with 130 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/index.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ limitations under the License.
<div class="level-item has-text-centered">
<div>
<p class="heading">Library</p>
<h3 class="title">{{fullName}} <span class="library-version">{{results.libraryVersion}}</span></h3>
<h3 class="title"><a href="{{repo.html_url}}">{{fullName}}</a> <span
class="library-version">{{results.libraryVersion}}</span></h3>
</div>
</div>
<div class="level-item has-text-centered">
Expand Down
10 changes: 10 additions & 0 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,24 @@ const out = render({ libraries: buildContext(libraries) });

function buildContext(libraries) {
return libraries.map(library => {
const repo = require(path.resolve(
__dirname,
"libraries",
library,
"results/repo.json"
));

return {
name: library,
fullName: libraryMap[library],
repo,
results: getTestResults(library),
issues: getIssues(library),
summary: getSummary(library),
aliases: aliasMap[library] || [],
};
}).sort((a, b) => {
return b.repo.stargazers_count - a.repo.stargazers_count
});
}

Expand Down
8 changes: 8 additions & 0 deletions docs/styles/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ p a {
text-decoration: underline;
}

.title a {
color: rgb(74, 74, 74);
}

.title a:hover {
color: #00796b;
}

.section {
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
Expand Down
13 changes: 12 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const util = require("util");
const exec = util.promisify(require("child_process").exec);
const ora = require("ora");
const chai = require("chai");
const fetch = require("node-fetch");

/**
* Supported options:
Expand Down Expand Up @@ -56,7 +57,8 @@ libraries = libraries
testsPath: join(__dirname, "libraries", name),
metaPath: join(__dirname, "libraries", name, "meta"),
resultsPath: join(__dirname, "libraries", name, "results"),
docsPath: join(__dirname, "docs", "libraries", name)
docsPath: join(__dirname, "docs", "libraries", name),
packageJson: require(join(__dirname, "libraries", name, "package.json"))
};
});

Expand Down Expand Up @@ -106,6 +108,7 @@ async function runTests() {
}
try {
await verifyResults(library);
await fetchMetadata(library);
await cleanDocs(library);
await copyDocs(library);
spinner.succeed(`${library.name}`);
Expand All @@ -119,6 +122,14 @@ async function runTests() {
return failed;
}

async function fetchMetadata(library) {
const repoMeta = (await (await fetch(`https://api.github.com/repos/${library.packageJson.library_repo}`)).json());
const stargazers_count = repoMeta.stargazers_count;
const html_url = repoMeta.html_url;
const repoJson = JSON.stringify({ stargazers_count, html_url });
fs.writeFileSync(join(library.resultsPath, "repo.json"), repoJson);
}

/**
* Verify the tests generated results and all other required files are present
* before copying things over to the docs site.
Expand Down
1 change: 1 addition & 0 deletions libraries/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=@angular/core karma start",
"build": "npm run test"
},
"library_repo": "angular/angular",
"devDependencies": {
"@types/mocha": "9.0.0",
"@types/node": "17.0.17",
Expand Down
1 change: 1 addition & 0 deletions libraries/angularjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=angular karma start",
"build": "npm run test"
},
"library_repo": "angular/angular.js",
"devDependencies": {
"angular-mocks": "1.8.2",
"babel-core": "6.26.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/dio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=dio.js karma start",
"build": "npm run test"
},
"library_repo": "dyo/dyo",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=@dojo/framework karma start",
"build": "npm run test; DIST=../../docs/libraries/dojo && mkdir -p $DIST && cp -r ./meta $DIST/meta && cp -r ./results $DIST/results"
},
"library_repo": "dojo/framework",
"dependencies": {
"@dojo/framework": "8.0.0",
"@webcomponents/webcomponentsjs": "2.6.0"
Expand Down
1 change: 1 addition & 0 deletions libraries/hybrids/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=hybrids karma start",
"build": "npm run test"
},
"library_repo": "hybridsjs/hybrids",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "7.1.5",
Expand Down
1 change: 1 addition & 0 deletions libraries/hyperapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=hyperapp karma start",
"build": "npm run test"
},
"library_repo": "jorgebucaran/hyperapp",
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
Expand Down
1 change: 1 addition & 0 deletions libraries/hyperhtml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=hyperhtml karma start",
"build": "npm run test"
},
"library_repo": "WebReflection/hyperHTML",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=lit karma start",
"build": "npm run test"
},
"library_repo": "lit/lit",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/mithril/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=mithril karma start",
"build": "npm run test"
},
"library_repo": "MithrilJS/mithril.js",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/omi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=omi karma start",
"build": "npm run test"
},
"library_repo": "Tencent/omi",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/polymer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=@polymer/polymer karma start",
"build": "npm run test"
},
"library_repo": "polymer/polymer",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "7.1.5",
Expand Down
1 change: 1 addition & 0 deletions libraries/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=preact karma start",
"build": "npm run test"
},
"library_repo": "preactjs/preact",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
3 changes: 2 additions & 1 deletion libraries/react-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=react karma start",
"build": "npm run test"
},
"library_repo": "facebook/react",
"devDependencies": {
"@babel/preset-react": "^7.16.0",
"babel-core": "6.26.3",
Expand All @@ -23,4 +24,4 @@
"react": "^0.0.0-experimental-575791925-20211213",
"react-dom": "^0.0.0-experimental-575791925-20211213"
}
}
}
1 change: 1 addition & 0 deletions libraries/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=react karma start",
"build": "npm run test"
},
"library_repo": "facebook/react",
"devDependencies": {
"@babel/preset-react": "^7.16.0",
"babel-core": "6.26.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/riot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=riot karma start",
"build": "npm run test"
},
"library_repo": "riot/riot",
"devDependencies": {
"@riotjs/compiler": "6.1.3",
"@riotjs/webpack-loader": "6.0.0",
Expand Down
1 change: 1 addition & 0 deletions libraries/skate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=skatejs karma start",
"build": "npm run test"
},
"library_repo": "solidjs/solid",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "7.1.5",
Expand Down
3 changes: 2 additions & 1 deletion libraries/stencil/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=@stencil/core karma start",
"build": "rm -rf ./dist/ ./results/ && stencil build && npm run test"
},
"library_repo": "ionic-team/stencil",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand All @@ -20,4 +21,4 @@
"@stencil/core": "2.13.0",
"@webcomponents/webcomponentsjs": "2.6.0"
}
}
}
1 change: 1 addition & 0 deletions libraries/surplus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=surplus karma start",
"build": "npm run test"
},
"library_repo": "adamhaile/surplus",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
1 change: 1 addition & 0 deletions libraries/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=svelte karma start",
"build": "npm run test"
},
"library_repo": "sveltejs/svelte",
"devDependencies": {
"@babel/core": "7.17.2",
"@babel/plugin-transform-runtime": "7.17.0",
Expand Down
1 change: 1 addition & 0 deletions libraries/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "cross-env LIBRARY_NAME=vue karma start",
"build": "npm run test"
},
"library_repo": "vuejs/vue",
"devDependencies": {
"babel-core": "6.26.3",
"babel-loader": "8.2.3",
Expand Down
Loading

0 comments on commit de27398

Please sign in to comment.