Skip to content

Commit

Permalink
setup generated README for convenient updates and to accurately refle…
Browse files Browse the repository at this point in the history
…ct what is supported and contributors: moved variables for extension and contributors into package.json; can be extended for other tasts as-desired; resolves johnmichel#180 johnmichel#179
  • Loading branch information
jimmont committed Oct 8, 2020
1 parent bf2306a commit 93766b6
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 2 deletions.
43 changes: 41 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Detects the JavaScript libraries running on a page",
"main": "library/libraries.js",
"scripts": {
"test": "node test/object-test.js"
"test": "node test/object-test.js",
"release": "node release.js"
},
"repository": {
"type": "git",
Expand All @@ -20,5 +21,43 @@
"bugs": {
"url": "https://github.com/johnmichel/Library-Detector-for-Chrome/issues"
},
"homepage": "https://github.com/johnmichel/Library-Detector-for-Chrome#readme"
"chrome": {
"name": "Library Detector",
"id": "cgaocdmhkmfnkdkbnckgmpopcbpaaejo",
"url": "https://chrome.google.com/webstore/detail/library-detector/cgaocdmhkmfnkdkbnckgmpopcbpaaejo?hl=en"
},
"homepage": "https://github.com/johnmichel/Library-Detector-for-Chrome#readme",
"contributors": [
{"name":"Andrew Bredow","url":"http://andrewbredow.com"},
{"name":"John Michel","url":"https://cowbird.org"},
{"name":"Artem Nezvigin","url":"http://artnez.com)", "comment": "(Multiple library icon concept)"},
{"name":"Karl Swedberg","url":"https://karlswedberg.com/"},
{"name":"Joseph Lust","url":"https://lustforge.com/"},
{"name":"Eliot Sykes","url":"https://www.eliotsykes.com"},
{"name":"John-David Dalton","url":"http://allyoucanleet.com/"},
{"name":"Tan Le","url":"https://github.com/tancnle"},
{"name":"Serkan Yerşen","url":"http://serkan.io/"},
{"name":"Robert Pataki","url":"https://robertpataki.com/"},
{"name":"Andrii Vakarev","url":"https://github.com/avakarev"},
{"name":"Allan Esquina","url":"https://github.com/allanesquina"},
{"name":"Derek Peterson","url":"http://www.derekpetey.com/"},
{"name":"Arnaud Ligny","url":"http://narno.org"},
{"name":"Adrian Chia","url":"https://github.com/adrianchia"},
{"name":"Julian Shapiro","url":"https://www.julian.com/"},
{"name":"Olov Günther-Hanssen","url":"https://github.com/eolognt"},
{"name":"Dmitri Suvorov","url":"https://github.com/suvjunmd"},
{"name":"Andrii Vakarev","url":"https://github.com/avakarev"},
{"name":"François Richard","url":"https://github.com/iamWh1sp3r"},
{"name":"Derek Peterson","url":"https://derekpeterson.me/"},
{"name":"Artem Riasnianskyi","url":"https://github.com/asci"},
{"name":"Piotr Kaminski","url":"https://github.com/pkaminski"},
{"name":"Cristian Douce","url":"https://github.com/cristiandouce"},
{"name":"Vinicius Reis","url":"https://github.com/vinicius73"},
{"name":"Rick Viscomi","url":"https://github.com/rviscomi"},
{"name":"Emmanuel Krebs","url":"https://github.com/e-krebs"},
{"name":"Patrick Hulce","url":"https://github.com/patrickhulce"},
{"name":"Ajaykumar Prathap","url":"https://github.com/ajay2507"},
{"name":"Benni Mack","url":"https://github.com/bmack"}
],
"engines" : { "node" : ">=12" }
}
78 changes: 78 additions & 0 deletions release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
const fs = require('fs');
const path = require('path');
const newline = require('os').EOL;

const libDetectorSource = fs.readFileSync(path.resolve(__dirname + '/library/libraries.js'), 'utf8');
const package = require('./package.json');

const version = package.version.trim().split('.').map(n=>(n * 1))
// chrome name, id, url
const chrome = package.chrome;

console.log(`
🛒 regenerating from package.json + libraries.js
→ npm package ${ package.name }
→ version ${ version.join('.') } (⚠️ bump version number?)
→ Chrome extension "${ chrome.name }" ${ chrome.id }
→ at ${ chrome.url }
→ and ${ package.repository.url }
🚰
`);
eval(libDetectorSource);

const libraryDetectorEntries = d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests;

const libraries = Object.entries(libraryDetectorEntries)
.sort((lib1, lib2)=>{
let a = lib1[0].toLowerCase(), b = lib2[0].toLowerCase();
return a < b ? -1 : (a > b ? 1 : 0);
})
.map((it, i)=>{
const [name, lib] = it;
// like this: - [AMP](https://ampproject.org/)
return `- [${name}](${lib.url})`;
})
;

const contributors = package.contributors.map((person, i)=>{
return `- [${person.name}](${person.url || ''})${ person.comment ? (' '+person.comment):'' }`;
})

const README = `[Library Detector For Chrome](https://chrome.google.com/webstore/detail/library-detector/${ chrome.id }?hl=en)
===========================
[![](https://img.shields.io/chrome-web-store/v/${ chrome.id }.svg?style=flat-square)
![](https://img.shields.io/chrome-web-store/d/${ chrome.id }.svg?style=flat-square)
![](https://img.shields.io/chrome-web-store/stars/${ chrome.id }.svg?style=flat-square)
![](https://img.shields.io/chrome-web-store/rating-count/${ chrome.id }.svg?style=flat-square)](https://chrome.google.com/webstore/detail/library-detector/${ chrome.id }?hl=en)
[![](https://img.shields.io/npm/v/${ package.name }.svg?style=flat-square)](https://npm.im/${ package.name })
The Library Detector extension discovers which JavaScript libraries are being
utilized on webpages that you visit and displays their icons on the Chrome Menu. Currently
supports:
${ libraries.join(newline) }
### To run the development version of the plugin
1. Clone the Git repo from Github \`git clone git@github.com:johnmichel/Library-Detector-for-Chrome.git LibraryDetector\`
2. Navigate to \`chrome://extensions\` in Chrome
3. Expand the "Developer Mode" section
4. Click "Load unpacked extension..." and select the \`LibraryDetector\` folder
### Contributors
${ contributors.join(newline) }
### Inspiration
Library detection class inspired by [Paul Bakaus'](https://paulbakaus.com/) [Library Detector for Firefox](https://addons.mozilla.org/en-us/firefox/addon/library-detector/)
`;

fs.writeFileSync(path.resolve('./README.md'), README);

console.log(`
📄 README.md updated
🍻 Cheers to all ${ contributors.length } contributors!
`);

0 comments on commit 93766b6

Please sign in to comment.