├── .codeclimate.yml ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── __tests__ ├── arrify_confs.js ├── display.js ├── filter_by_cfp.js ├── flatify_confs.js ├── format_date.js └── reducer.js ├── cli.js ├── code-of-conduct.md ├── commitlint.config.js ├── demo.gif ├── index.js ├── package-lock.json ├── package.json └── src ├── arryify_confs.js ├── display.js ├── fetcher.js ├── filter_by_cfp.js ├── flatify_confs.js ├── format_date.js └── reducer.js /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | checks: 3 | argument-count: 4 | config: 5 | threshold: 4 6 | complex-logic: 7 | config: 8 | threshold: 4 9 | file-lines: 10 | config: 11 | threshold: 250 12 | method-complexity: 13 | config: 14 | threshold: 5 15 | method-count: 16 | config: 17 | threshold: 20 18 | method-lines: 19 | config: 20 | threshold: 25 21 | nested-control-flow: 22 | config: 23 | threshold: 4 24 | return-statements: 25 | config: 26 | threshold: 4 27 | plugins: 28 | eslint: 29 | enabled: true 30 | exclude_patterns: 31 | - "__tests__/" 32 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * **I'm submitting a ... ** 2 | - [ ] bug report 3 | - [ ] feature request 4 | - [ ] support request => Please do not submit support request here, see note at the top of this template. 5 | 6 | 7 | * **Do you want to request a *feature* or report a *bug*?** 8 | 9 | 10 | 11 | * **What is the current behavior?** 12 | 13 | 14 | 15 | * **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** via 16 | https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5). 17 | 18 | 19 | 20 | * **What is the expected behavior?** 21 | 22 | 23 | 24 | * **What is the motivation / use case for changing the behavior?** 25 | 26 | 27 | 28 | * **Please tell us about your environment:** 29 | 30 | - version: 2.0.0-beta.X 31 | - Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] 32 | - Language: [all | TypeScript X.X | ES6/7 | ES5 | Dart] 33 | 34 | 35 | 36 | * **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc) -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * **Please check if the PR fulfills these requirements** 2 | - [ ] The commit message follows our guidelines 3 | - [ ] Tests for the changes have been added (for bug fixes / features) 4 | - [ ] Docs have been added / updated (for bug fixes / features) 5 | 6 | 7 | * **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) 8 | 9 | 10 | 11 | * **What is the current behavior?** (You can also link to an open issue here) 12 | 13 | 14 | 15 | * **What is the new behavior (if this is a feature change)?** 16 | 17 | 18 | 19 | * **Does this PR introduce a breaking change?** (What changes might users need to make in their application due to this PR?) 20 | 21 | 22 | 23 | * **Other information**: -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: 3 | directories: 4 | - ~/.npm 5 | notifications: 6 | email: false 7 | node_js: 8 | - '9' 9 | - '8' 10 | - '6' 11 | script: 12 | - npm run commitlint-travis 13 | - npm run lint 14 | - npm run coverage 15 | after_success: 16 | - npm run collect-coverage 17 | - npm run travis-deploy-once "npm run semantic-release" 18 | branches: 19 | except: 20 | - /^v\d+\.\d+\.\d+$/ 21 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue with the owners of this repository before making a change. 4 | 5 | Please note we have a [code of conduct](code-of-conduct.md), please follow it in all your interactions with the project. 6 | 7 | ## Pull Request Process 8 | 9 | 1. Update the README.md with details of changes to the interface, this includes new environment 10 | variables, exposed ports, useful file locations and container parameters. 11 | 2. Use ```npm run cz``` to commit changes to adhere to our commit style guide 12 | 3. We run code style checking, commit message validation & tests via githooks on every commit & push 13 | please do not try to undermine those checks, otherwise your code can't be accepted 14 | 4. If you do introduce dependencies to the project, please make sure that they don't contain any vulnarabilities & are compliant with the projects license -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Sebastian Golasch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cfp-magick 2 | 3 | [![Build Status](https://travis-ci.org/asciidisco/cfp-magick.svg?branch=master)](https://travis-ci.org/asciidisco/cfp-magick) 4 | [![npm](https://img.shields.io/npm/v/cfp-magick.svg)](https://www.npmjs.com/package/cfp-magick) 5 | [![dependencies Status](https://david-dm.org/asciidisco/cfp-magick/status.svg)](https://david-dm.org/asciidisco/cfp-magick) 6 | [![dependencies Status](https://david-dm.org/asciidisco/cfp-magick/dev-status.svg)](https://david-dm.org/asciidisco/cfp-magick#info=devDependencies) 7 | [![Test Coverage](https://api.codeclimate.com/v1/badges/cef0e6703b53514c4863/test_coverage)](https://codeclimate.com/github/asciidisco/cfp-magick/test_coverage) 8 | [![Maintainability](https://api.codeclimate.com/v1/badges/cef0e6703b53514c4863/maintainability)](https://codeclimate.com/github/asciidisco/cfp-magick/maintainability) 9 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 10 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fasciidisco%2Fcfp-magick.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fasciidisco%2Fcfp-magick?ref=badge_shield) 11 | [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) 12 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) 13 | [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) 14 | [![Greenkeeper badge](https://badges.greenkeeper.io/greenkeeperio/greenkeeper.svg)](https://greenkeeper.io/) 15 | [![Known Vulnerabilities](https://snyk.io/test/github/asciidisco/cfp-magick/badge.svg)](https://snyk.io/test/github/asciidisco/cfp-magick) 16 | 17 | CLI applications that shows JavaScript and Web conferences with open calls for papers 18 | 19 | ![Demo](https://raw.githubusercontent.com/asciidisco/cfp-magick/master/demo.gif) 20 | 21 | ### Installing 22 | 23 | Install the application via `npm` or use it on demand via `npx`: 24 | 25 | ```bash 26 | npm install cfp-magick -g 27 | ``` 28 | 29 | ```bash 30 | npx cfp-magick 31 | ``` 32 | 33 | ## Development 34 | 35 | Fork and clone this repo and install all the needed dependencies 36 | by issuing ```npm install``` in the root directory. 37 | 38 | ## Running the tests 39 | 40 | Tests are located on the `__tests__` folder and can be run by calling ```npm test``` from the root dir of the project. 41 | 42 | ### And coding style tests 43 | 44 | We adhere to the [Standard](https://github.com/standard/standard) coding guidelines. 45 | You can lint you code using ```npm run lint``` 46 | 47 | ## Built With 48 | 49 | * [Chalk](https://github.com/chalk/chalk) - For beautiful colors 50 | * [NPM](https://www.npmjs.com/) - Dependency Management 51 | * [Commitizen](https://github.com/commitizen/cz-cli) - Easy semantic commit messages 52 | * [Jest](https://facebook.github.io/jest/) - Easy tests 53 | * [Semantic Release](https://github.com/semantic-release/semantic-release) - Easy software releases 54 | 55 | ## Contributing 56 | 57 | Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our [code of conduct](code-of-conduct.md), and the process for submitting pull requests to us. 58 | 59 | ## Versioning 60 | 61 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/asciidisco/cfp-magick/tags). 62 | 63 | ## Authors 64 | 65 | * **Sebastian Golasch** - *Initial work* - [asciidisco](https://github.com/asciidisco) 66 | 67 | See also the list of [contributors](https://github.com/ascidiisco/cfp-magick/contributors) who participated in this project. 68 | 69 | ## License 70 | 71 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 72 | 73 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fasciidisco%2Fcfp-magick.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fasciidisco%2Fcfp-magick?ref=badge_large) 74 | -------------------------------------------------------------------------------- /__tests__/arrify_confs.js: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | const arrifyConfs = require('../src/arryify_confs') 3 | 4 | const rawData = { 5 | 'January': ['foo', 'bar'], 6 | 'February': ['baz', 'bam'] 7 | } 8 | 9 | test('can arrify nested data', () => { 10 | const result = arrifyConfs(rawData) 11 | const expected = [['foo', 'bar'], ['baz', 'bam']] 12 | expect(result).toEqual(expected) 13 | }) 14 | -------------------------------------------------------------------------------- /__tests__/display.js: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | const chalk = require('chalk') 3 | const display = require('../src/display') 4 | 5 | const rawData = [ 6 | {name: 'a', date: {start: '01-01-2018', end: '01-02-2018'}, location: {emoji_country: 'x'}, cfp: {link: 'http://example.com'}}, 7 | {name: 'b', date: {start: '01-01-2018', end: '01-01-2018'}, location: {emoji_country: 'x'}, cfp: {link: 'http://example2.com'}} 8 | ] 9 | 10 | const expected = [ 11 | 'x ', 12 | chalk.red('a') + ' - ', 13 | chalk.yellow('Monday, January 1, 2018') + chalk.blue(' to '), 14 | chalk.yellow('Tuesday, January 2, 2018') + ' - ', 15 | chalk.green('http://example.com'), 16 | '__', 17 | 'x ', 18 | chalk.red('b') + ' - ', 19 | chalk.yellow('Monday, January 1, 2018') + ' - ', 20 | chalk.green('http://example2.com'), 21 | '__' 22 | ] 23 | 24 | test('can filter by cfp', () => { 25 | let collectedResult = [] 26 | const collector = {write: data => collectedResult.push(data.replace('\n', '__'))} 27 | display(rawData, collector) 28 | expect(collectedResult).toEqual(expected) 29 | }) 30 | -------------------------------------------------------------------------------- /__tests__/filter_by_cfp.js: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | const filterByCfp = require('../src/filter_by_cfp') 3 | 4 | const rawData = [ 5 | {cfp: {has_cfp: false, link: ''}}, 6 | {cfp: {has_cfp: true, link: ''}}, 7 | {cfp: {has_cfp: true, link: 'http://example.com'}}, 8 | {cfp: {has_cfp: false, link: 'http://example.com'}} 9 | ] 10 | 11 | test('can filter by cfp', () => { 12 | const result = filterByCfp(rawData) 13 | const expected = [{cfp: {has_cfp: true, link: 'http://example.com'}}] 14 | expect(result).toEqual(expected) 15 | }) 16 | -------------------------------------------------------------------------------- /__tests__/flatify_confs.js: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | const flatifyConfs = require('../src/flatify_confs') 3 | 4 | const rawData = [['foo', 'bar'], ['baz', 'bam']] 5 | 6 | test('can arrify nested data', () => { 7 | const result = flatifyConfs(rawData) 8 | const expected = ['foo', 'bar', 'baz', 'bam'] 9 | expect(result).toEqual(expected) 10 | }) 11 | -------------------------------------------------------------------------------- /__tests__/format_date.js: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | const formatDate = require('../src/format_date') 3 | 4 | test('can format date', () => { 5 | const rawDate = '01-04-2018' 6 | const result = formatDate(rawDate) 7 | const expected = 'Thursday, January 4, 2018' 8 | expect(result).toBe(expected) 9 | }) 10 | -------------------------------------------------------------------------------- /__tests__/reducer.js: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | const reduce = require('../src/reducer') 3 | 4 | const rawData = { 5 | 'January': [ 6 | {cfp: {has_cfp: false, link: ''}}, 7 | {cfp: {has_cfp: true, link: ''}}, 8 | {cfp: {has_cfp: true, link: 'http://example.com'}}, 9 | {cfp: {has_cfp: false, link: 'http://example.com'}} 10 | ], 11 | 'Febuary': [ 12 | {cfp: {has_cfp: false, link: ''}}, 13 | {cfp: {has_cfp: true, link: ''}}, 14 | {cfp: {has_cfp: true, link: 'http://example2.com'}}, 15 | {cfp: {has_cfp: false, link: 'http://example2.com'}} 16 | ] 17 | } 18 | 19 | test('can filter by cfp', () => { 20 | const result = reduce(rawData) 21 | const expected = [{cfp: {has_cfp: true, link: 'http://example.com'}}, {cfp: {has_cfp: true, link: 'http://example2.com'}}] 22 | expect(result).toEqual(expected) 23 | }) 24 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const main = require('./index') 3 | 4 | // runs the fetcher/reducer and outputs the data 5 | async function init () { 6 | try { 7 | await main() 8 | } catch (error) { 9 | console.warn('An error occured:') 10 | console.error(error) 11 | } 12 | } 13 | 14 | init() 15 | -------------------------------------------------------------------------------- /code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at public@asciidisco.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = {extends: ['@commitlint/config-conventional']} 2 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asciidisco/cfp-magick/0acceef82fa2dde500d59118a9acb2628a858a9e/demo.gif -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const fetch = require('./src/fetcher') 2 | const reduce = require('./src/reducer') 3 | const display = require('./src/display') 4 | 5 | // runs the fetche, reducer and display function 6 | module.exports = async (displayFunc) => { 7 | const conferenceData = await fetch() 8 | const eventsWithCfp = reduce(conferenceData) 9 | display(eventsWithCfp, displayFunc) 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cfp-magick", 3 | "version": "0.0.0-development", 4 | "description": "Show JavaScript and Web conferences with open calls for papers in your terminal", 5 | "main": "index.js", 6 | "bin": { 7 | "cfp-magick": "./cli.js" 8 | }, 9 | "scripts": { 10 | "lint": "standard --verbose | snazzy", 11 | "test": "jest", 12 | "coverage": "jest --coverage --collectCoverageFrom=src/*js", 13 | "collect-coverage": "codeclimate-test-reporter < ./coverage/lcov.info", 14 | "cz": "git-cz", 15 | "commitmsg": "commitlint -e $GIT_PARAMS", 16 | "commitlint-travis": "commitlint-travis", 17 | "semantic-release": "semantic-release", 18 | "travis-deploy-once": "travis-deploy-once" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/asciidisco/cfp-magick.git" 23 | }, 24 | "author": "Sebastian Golasch (https://asciidisco.com/)", 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/asciidisco/cfp-magick/issues" 28 | }, 29 | "homepage": "https://github.com/asciidisco/cfp-magick#readme", 30 | "devDependencies": { 31 | "@commitlint/cli": "6.1.3", 32 | "@commitlint/config-conventional": "6.1.3", 33 | "@commitlint/prompt": "6.1.3", 34 | "@commitlint/travis-cli": "6.1.3", 35 | "codeclimate-test-reporter": "0.5.0", 36 | "commitizen": "2.9.6", 37 | "cz-conventional-changelog": "2.1.0", 38 | "ghooks": "2.0.3", 39 | "jest": "22.1.3", 40 | "semantic-release": "^15.0.0", 41 | "semantic-release-cli": "3.6.5", 42 | "snazzy": "7.1.0", 43 | "standard": "11.0.1", 44 | "travis-deploy-once": "^4.3.0" 45 | }, 46 | "dependencies": { 47 | "chalk": "2.4.0" 48 | }, 49 | "config": { 50 | "commitizen": { 51 | "path": "./node_modules/cz-conventional-changelog" 52 | }, 53 | "ghooks": { 54 | "pre-commit": "npm run lint", 55 | "commit-msg": "npm run commitmsg", 56 | "pre-push": "npm test", 57 | "post-merge": "npm install", 58 | "post-rewrite": "npm install" 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/arryify_confs.js: -------------------------------------------------------------------------------- 1 | // turns object based nested conf data into an array 2 | module.exports = conferences => Object.keys(conferences).map(month => conferences[month]) 3 | -------------------------------------------------------------------------------- /src/display.js: -------------------------------------------------------------------------------- 1 | const chalk = require('chalk') 2 | const formatDate = require('./format_date') 3 | 4 | // displays the list of conferences 5 | module.exports = (conferences, displayFunction) => { 6 | displayFunction = displayFunction || process.stdout 7 | conferences.forEach(conference => { 8 | displayFunction.write(conference.location.emoji_country + ' ') 9 | displayFunction.write(chalk.red(conference.name) + ' - ') 10 | if (conference.date.start === conference.date.end) { 11 | displayFunction.write(chalk.yellow(formatDate(conference.date.start)) + ' - ') 12 | } else { 13 | displayFunction.write(chalk.yellow(formatDate(conference.date.start)) + chalk.blue(' to ')) 14 | displayFunction.write(chalk.yellow(formatDate(conference.date.end)) + ' - ') 15 | } 16 | displayFunction.write(chalk.green(conference.cfp.link)) 17 | displayFunction.write('\n') 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /src/fetcher.js: -------------------------------------------------------------------------------- 1 | const https = require('https') 2 | module.exports = () => { 3 | return new Promise((resolve, reject) => { 4 | https.get('https://webconf-api-2018.glitch.me/', res => { 5 | let contents = '' 6 | res.on('data', data => { 7 | contents += data 8 | }) 9 | res.on('end', () => { 10 | try { 11 | const parsedContents = JSON.parse(contents) 12 | resolve(parsedContents) 13 | } catch (error) { 14 | reject(error) 15 | } 16 | }) 17 | }) 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /src/filter_by_cfp.js: -------------------------------------------------------------------------------- 1 | // filters out conferences without an cfp or where no cfp link is given 2 | module.exports = conferences => conferences.filter(conf => conf.cfp.has_cfp && conf.cfp.link !== '') 3 | -------------------------------------------------------------------------------- /src/flatify_confs.js: -------------------------------------------------------------------------------- 1 | // turns incoming nested array conferences into a flat array 2 | module.exports = conferences => { 3 | let allConfs = [] 4 | conferences.forEach(confs => confs.forEach(conf => allConfs.push(conf))) 5 | return allConfs 6 | } 7 | -------------------------------------------------------------------------------- /src/format_date.js: -------------------------------------------------------------------------------- 1 | // formats a raw date 2 | module.exports = rawDate => { 3 | const parsedDate = new Date(rawDate) 4 | const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' } 5 | return parsedDate.toLocaleDateString('en-gb', options) 6 | } 7 | -------------------------------------------------------------------------------- /src/reducer.js: -------------------------------------------------------------------------------- 1 | const filterByCfp = require('./filter_by_cfp') 2 | const arrifyConfs = require('./arryify_confs') 3 | const flatifyConfs = require('./flatify_confs') 4 | 5 | // turns nested conferences data into filtered flat array data 6 | module.exports = conferenceData => filterByCfp(flatifyConfs(arrifyConfs(conferenceData))) 7 | --------------------------------------------------------------------------------