├── .github └── workflows │ └── deploy.yml ├── .gitignore ├── README.md ├── build-make.js ├── build-sync.js ├── build.js ├── config.js ├── elements ├── contributor-list.css ├── contributor-list.js ├── readme-panel.css ├── readme-panel.js ├── repo-list-item.css ├── repo-list-item.js ├── repo-list.css └── repo-list.js ├── highlight.js ├── index.css ├── index.js ├── intro.md ├── package-lock.json ├── package.json └── static ├── font ├── FantasqueSansMono-Bold.eot ├── FantasqueSansMono-Bold.svg ├── FantasqueSansMono-Bold.woff ├── FantasqueSansMono-BoldItalic.eot ├── FantasqueSansMono-BoldItalic.svg ├── FantasqueSansMono-BoldItalic.woff ├── FantasqueSansMono-RegItalic.eot ├── FantasqueSansMono-RegItalic.svg ├── FantasqueSansMono-RegItalic.woff ├── FantasqueSansMono-Regular.eot ├── FantasqueSansMono-Regular.svg ├── FantasqueSansMono-Regular.woff ├── fantasque.css ├── index.css ├── stackgl.css ├── stackgl.eot ├── stackgl.svg ├── stackgl.ttf └── stackgl.woff └── index.html /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: Deploy 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the master branch 7 | on: 8 | gollum # gollum is the github wiki 9 | 10 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 11 | jobs: 12 | deploy: 13 | # The type of runner that the job will run on 14 | runs-on: ubuntu-latest 15 | strategy: 16 | matrix: 17 | node-version: [8.11.4] 18 | # Steps represent a sequence of tasks that will be executed as part of the job 19 | steps: 20 | - uses: actions/checkout@v2 21 | - name: Use Node.js ${{ matrix.node-version }} 22 | uses: actions/setup-node@v1 23 | with: 24 | node-version: ${{ matrix.node-version }} 25 | 26 | - name: Cache db 27 | id: cache-db 28 | uses: actions/cache@v1 29 | with: 30 | path: .data 31 | nkey: ${{ runner.os }}-dbcache 32 | 33 | # Runs a single command using the runners shell 34 | - name: Install and build 35 | run: npm install 36 | env: 37 | ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} 38 | DEBUG: "*" 39 | 40 | - name: Deploy 🚀 41 | uses: JamesIves/github-pages-deploy-action@releases/v3 42 | with: 43 | ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} 44 | BRANCH: gh-pages # The branch the action should deploy to. 45 | FOLDER: dist # The folder the action should deploy. 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .data 3 | dist 4 | npm-debug.log 5 | packages.md 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [stack.gl/packages](http://stack.gl/packages/) 2 | 3 | This is where we keep all of our packages' documentation for safe keeping and discoverability, both inside the [stackgl organisation](https://github.com/stackgl) and out. 4 | 5 | This branch is responsible for downloading data from the GitHub API using [ecosystem-docs](https://github.com/hughsk/ecosystem-docs), transforming it into a nice format and presenting it on the frontend. 6 | 7 | The built output can be found on the [gh-pages branch](https://github.com/stackgl/packages/tree/gh-pages) of this repository. 8 | 9 | ## Adding a package 10 | 11 | Simply add your package's GitHub repository to [the list in the wiki](https://github.com/stackgl/packages/wiki/Packages). 12 | 13 | ## Build your own list 14 | 15 | This repository has been designed to be easily forkable for other ecosystems to take advantage of, with the hopes of more flexibility becoming available in the future. 16 | 17 | First off: if you're just interested in the syncing behaviour you should check out [ecosystem-docs](https://github.com/hughsk/ecosystem-docs). 18 | 19 | Otherwise: 20 | 21 | 1. Fork the repository and clone it to your machine. 22 | 1. Update `config.js` to alter variables specific to your project, such as the logo content or packages list URL. (There's a bit of JSX in there right now. Sorry!) 23 | 1. Update `intro.md` to change the content of the intro page. 24 | 1. Install the dependencies using `npm install`. This will likely prompt you for your GitHub username and password. 25 | 1. Start the app by running `npm start` and visiting `http://localhost:3000/` when ready. 26 | 1. Whenever you want to update the list, run `npm run sync`. 27 | 1. Once you're ready to deploy, run `npm run deploy` to build the site and and push it to GitHub pages. 28 | 1. Enjoy! :sparkles: 29 | -------------------------------------------------------------------------------- /build-make.js: -------------------------------------------------------------------------------- 1 | require('node-jsx').install() 2 | 3 | const make = require('./build').make 4 | const highlight = require('./highlight') 5 | const marked = require('marked') 6 | const path = require('path') 7 | const fs = require('fs') 8 | 9 | const intro = fs.readFileSync(path.join(__dirname, 'intro.md'), 'utf8') 10 | const file = fs.readFileSync(path.join(__dirname, 'packages.md'), 'utf8') 11 | 12 | make(file, {}, function(err) { 13 | if (err) throw err 14 | 15 | marked(intro, { 16 | highlight: highlight 17 | }, function(err, html) { 18 | if (err) throw err 19 | 20 | fs.writeFileSync(path.join(__dirname, 'dist', 'intro.html'), html) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /build-sync.js: -------------------------------------------------------------------------------- 1 | require('node-jsx').install() 2 | 3 | const sync = require('./build').sync 4 | const config = require('./config') 5 | const request = require('request') 6 | const path = require('path') 7 | const fs = require('fs') 8 | 9 | request.get(config.wiki, function(err, res, body) { 10 | if (err) throw err 11 | 12 | fs.writeFileSync(path.join(__dirname, 'packages.md'), body) 13 | 14 | sync(body, function(err, repos) { 15 | if (err) { 16 | console.error('*********sync failed*********'); 17 | throw err; 18 | } 19 | console.log(repos.length + ' repos updated') 20 | }) 21 | }) 22 | -------------------------------------------------------------------------------- /build.js: -------------------------------------------------------------------------------- 1 | const read = require('ecosystem-docs/read') 2 | const sync = require('ecosystem-docs/sync') 3 | const highlight = require('./highlight') 4 | const map = require('map-limit') 5 | const cheerio = require('cheerio') 6 | const marked = require('marked') 7 | const mkdirp = require('mkdirp') 8 | const ghauth = require('ghauth') 9 | const mdast = require('mdast') 10 | const path = require('path') 11 | const cpr = require('cpr') 12 | const fs = require('fs') 13 | 14 | const dataLocation = path.join(__dirname, '.data') 15 | 16 | exports.sync = function(packageMarkdown, done) { 17 | const repos = categoriesToRepos(parseCategories(packageMarkdown)) 18 | 19 | function syncWithToken(token){ 20 | sync(repos, { 21 | data: dataLocation, 22 | token, token 23 | }, done); 24 | } 25 | 26 | if(process.env.ACCESS_TOKEN){ 27 | syncWithToken(process.env.ACCESS_TOKEN); 28 | }else{ 29 | console.log("No access token passed need to authenticate..."); 30 | ghauth({ 31 | configName: 'ecosystem-docs', 32 | userAgent: 'ecosystem-docs', 33 | scopes: ['user'] 34 | }, function(err, auth) { 35 | if (err) return done(err) 36 | syncWithToken(auth.token) 37 | }) 38 | } 39 | } 40 | 41 | exports.make = function(packageMarkdown, options, done) { 42 | options = options || {} 43 | 44 | const categories = parseCategories(packageMarkdown) 45 | const repoList = categoriesToRepos(categories) 46 | 47 | options.output = options.output || path.join(__dirname, 'dist') 48 | 49 | read(repoList, { 50 | data: dataLocation 51 | }, function(err, repos) { 52 | if (err) return done(err) 53 | 54 | const contribs = indexContributors(repos) 55 | 56 | reattachCategories(repos, categories) 57 | map(repos, 20, function(repo, next) { 58 | writeRepoJSON(repo, options, function(err) { 59 | if (err) return next(err) 60 | 61 | next(null, { 62 | user: repo.user, 63 | name: repo.name, 64 | stars: repo.stars, 65 | issues: repo.issues, 66 | contrib: repo.contributors, 67 | version: repo.package && repo.package.version || false, 68 | npmName: repo.package && repo.package.name || false, 69 | category: repo.category 70 | }) 71 | }) 72 | }, function(err, repos) { 73 | if (err) return done(err) 74 | 75 | const index = { 76 | repos: reposToCategories(repos), 77 | contributors: contribs 78 | } 79 | 80 | fs.writeFile( 81 | path.join(options.output, 'index.json'), 82 | JSON.stringify(index), 83 | copyAssets 84 | ) 85 | }) 86 | }) 87 | 88 | function copyAssets(err) { 89 | if (err) return done(err) 90 | 91 | cpr(path.join(__dirname, 'static'), options.output, function(err) { 92 | return done(err) 93 | }) 94 | } 95 | } 96 | 97 | function writeRepoJSON(repo, options, done) { 98 | const dest = path.join(options.output, repo.user, repo.name) + '.json' 99 | const data = {} 100 | 101 | mkdirp(path.dirname(dest), function(err) { 102 | if (err) return done(err) 103 | 104 | convertReadme(repo, function(err, readme) { 105 | if (err) return done(err) 106 | data.readme = readme 107 | fs.writeFile(dest, JSON.stringify(data), done) 108 | }) 109 | }) 110 | } 111 | 112 | function convertReadme(repo, done) { 113 | const ast = mdast.parse(repo.readme) 114 | 115 | // Remove all content before the first heading 116 | for (var i = 0; i < ast.children.length; i++) { 117 | var child = ast.children[i] 118 | if (child.type === 'heading') break 119 | ast.children.splice(i--, 1) 120 | } 121 | 122 | // Ensure there's only one