This commit is contained in:
Wade Wegner 2018-08-05 08:55:17 -05:00
Коммит 5f88500553
28 изменённых файлов: 3122 добавлений и 0 удалений

43
.circleci/config.yml Normal file
Просмотреть файл

@ -0,0 +1,43 @@
---
version: 2
jobs:
node-latest: &test
docker:
- image: node:latest
working_directory: ~/cli
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-npm-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}}
- v1-npm-{{checksum ".circleci/config.yml"}}
- run:
name: Install dependencies
command: .circleci/greenkeeper
- run: ./bin/run --version
- run: ./bin/run --help
- run:
name: Testing
command: yarn test
- run:
name: Submitting code coverage to codecov
command: |
./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov
curl -s https://codecov.io/bash | bash
- save_cache:
key: v1-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
paths:
- ~/cli/node_modules
- /usr/local/share/.cache/yarn
- /usr/local/share/.config/yarn
node-8:
<<: *test
docker:
- image: node:8
workflows:
version: 2
"thatconf":
jobs:
- node-latest
- node-8

25
.circleci/greenkeeper Executable file
Просмотреть файл

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -ex
PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH
if [[ "$CIRCLE_BRANCH" != greenkeeper/* ]]; then
yarn
# yarn check
exit 0
fi
if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
git config --global push.default simple
git config --global user.email "$GIT_EMAIL"
git config --global user.name "$GIT_USERNAME"
fi
if [[ ! -x "$(command -v greenkeeper-lockfile-update)" ]]; then
yarn global add greenkeeper-lockfile@1
fi
greenkeeper-lockfile-update
yarn
greenkeeper-lockfile-upload

11
.editorconfig Normal file
Просмотреть файл

@ -0,0 +1,11 @@
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

3
.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
* text=auto
*.js text eol=lf
*.ts text eol=lf

8
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,8 @@
*-debug.log
*-error.log
/.nyc_output
/dist
/lib
/package-lock.json
/tmp
node_modules

12
.nycrc Normal file
Просмотреть файл

@ -0,0 +1,12 @@
{
"extension": [
".ts"
],
"include": [
"src/**/*.ts"
],
"exclude": [
"**/*.d.ts"
],
"all": true
}

20
README.md Normal file
Просмотреть файл

@ -0,0 +1,20 @@
thatconf
========
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/thatconf.svg)](https://npmjs.org/package/thatconf)
[![CircleCI](https://circleci.com/gh/wadewegner/thatconf/tree/master.svg?style=shield)](https://circleci.com/gh/wadewegner/thatconf/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/wadewegner/thatconf?branch=master&svg=true)](https://ci.appveyor.com/project/wadewegner/thatconf/branch/master)
[![Codecov](https://codecov.io/gh/wadewegner/thatconf/branch/master/graph/badge.svg)](https://codecov.io/gh/wadewegner/thatconf)
[![Downloads/week](https://img.shields.io/npm/dw/thatconf.svg)](https://npmjs.org/package/thatconf)
[![License](https://img.shields.io/npm/l/thatconf.svg)](https://github.com/wadewegner/thatconf/blob/master/package.json)
<!-- toc -->
# Usage
<!-- usage -->
# Commands
<!-- commands -->

22
appveyor.yml Normal file
Просмотреть файл

@ -0,0 +1,22 @@
environment:
nodejs_version: "9"
cache:
- '%LOCALAPPDATA%\Yarn -> appveyor.yml'
- node_modules -> yarn.lock
install:
- ps: Install-Product node $env:nodejs_version x64
- yarn
test_script:
- .\bin\run --version
- .\bin\run --help
- yarn test
after_test:
- .\node_modules\.bin\nyc report --reporter text-lcov > coverage.lcov
- ps: |
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
bash codecov.sh
build: off

5
bin/run Executable file
Просмотреть файл

@ -0,0 +1,5 @@
#!/usr/bin/env node
require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'))

3
bin/run.cmd Normal file
Просмотреть файл

@ -0,0 +1,3 @@
@echo off
node "%~dp0\run" %*

66
package.json Normal file
Просмотреть файл

@ -0,0 +1,66 @@
{
"name": "thatconf",
"version": "0.1.0",
"author": "Wade Wegner @wadewegner",
"bin": {
"thatconf": "./bin/run"
},
"bugs": "https://github.com/wadewegner/thatconf/issues",
"dependencies": {
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/plugin-help": "^2",
"@types/lodash": "^4.14.116",
"axios": "^0.18.0",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"tslib": "^1"
},
"devDependencies": {
"@oclif/dev-cli": "^1",
"@oclif/test": "^1",
"@oclif/tslint": "^1",
"@types/chai": "^4",
"@types/mocha": "^5",
"@types/node": "^10",
"chai": "^4",
"globby": "^8",
"mocha": "^5",
"nyc": "^12",
"ts-node": "^6",
"tslint": "^5",
"typescript": "^2.9"
},
"engines": {
"node": ">=8.0.0"
},
"files": [
"/bin",
"/lib",
"/npm-shrinkwrap.json",
"/oclif.manifest.json"
],
"homepage": "https://github.com/wadewegner/thatconf",
"keywords": [
"oclif"
],
"license": "MIT",
"main": "lib/index.js",
"oclif": {
"commands": "./lib/commands",
"bin": "thatconf",
"plugins": [
"@oclif/plugin-help"
]
},
"repository": "wadewegner/thatconf",
"scripts": {
"postpack": "rm -f oclif.manifest.json npm-shrinkwrap.json",
"posttest": "tsc -p test --noEmit && tslint -p test -t stylish",
"prepack": "rm -rf lib && tsc && oclif-dev manifest && oclif-dev readme && npm shrinkwrap",
"prepare": "rm -rf lib && tsc",
"test": "nyc mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif-dev readme && git add README.md"
},
"types": "lib/index.d.ts"
}

1
sesions200.json Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1
sessions.json Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

31
src/commands/hello.ts Normal file
Просмотреть файл

@ -0,0 +1,31 @@
import {Command, flags} from '@oclif/command'
export default class Hello extends Command {
static description = 'describe the command here'
static examples = [
`$ thatconf hello
hello world from ./src/hello.ts!
`,
]
static flags = {
help: flags.help({char: 'h'}),
// flag with a value (-n, --name=VALUE)
name: flags.string({char: 'n', description: 'name to print'}),
// flag with no value (-f, --force)
force: flags.boolean({char: 'f'}),
}
static args = [{name: 'file'}]
async run() {
const {args, flags} = this.parse(Hello)
const name = flags.name || 'world'
this.log(`hello ${name} from ./src/commands/hello.ts`)
if (args.file && flags.force) {
this.log(`you input --force and --file: ${args.file}`)
}
}
}

61
src/commands/sessions.ts Normal file
Просмотреть файл

@ -0,0 +1,61 @@
import {Command, flags} from '@oclif/command'
import axios from 'axios'
import * as moment from 'moment'
export default class Sessions extends Command {
static description = 'describe the command here'
static flags = {
help: flags.help({char: 'h'}),
year: flags.string({char: 'y', description: 'year', default: '2018'}),
level: flags.string({char: 'l', description: 'level'}),
primary: flags.string({char: 'p', description: 'primary category', options: ['ALM', 'Architecture', 'ARVR', 'Cloud', 'DataStorage', 'DevOps', 'IoTMaker', 'Languages', 'MobileClient', 'SoftSkills', 'Security', 'Testing', 'Tools', 'UxUi', 'Web', 'Other', 'Family', 'Keynote', 'THAT Conference', 'Open Spaces', 'Precon', 'FamilyPrecon'] }),
secondary: flags.string({char: 's', description: 'secondary category', options: ['ALM', 'Architecture', 'ARVR', 'Cloud', 'DataStorage', 'DevOps', 'IoTMaker', 'Languages', 'MobileClient', 'SoftSkills', 'Security', 'Testing', 'Tools', 'UxUi', 'Web', 'Other', 'Family', 'Keynote', 'THAT Conference', 'Open Spaces', 'Precon', 'FamilyPrecon'] }),
day: flags.string({char: 'd', description: 'day of conference', options: ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday']}),
json: flags.boolean({description: 'format output as json'})
}
async run() {
const {flags} = this.parse(Sessions)
let url = `https://www.thatconference.com/api3/Session/GetAcceptedSessions?year=${flags.year}`
let {data} = await axios.get(url)
if (flags.level) {
data = data.filter((sessions: any) => sessions.Level === flags.level)
}
if (flags.primary) {
data = data.filter((sessions: any) => sessions.PrimaryCategory === flags.primary)
}
if (flags.secondary) {
data = data.filter((sessions: any) => sessions.SecondaryCategory === flags.secondary)
}
if (flags.day) {
data = data.filter((sessions: any) => moment(sessions.ScheduledDateTime).format('dddd') === flags.day)
}
if (flags.json) {
this.log(JSON.stringify(data))
} else {
let lastDayName;
for (let session of data) {
var dayName = moment(session.ScheduledDateTime).format('dddd')
const title = session.Title.trim()
const firstName = session.Speakers[0].FirstName.trim()
const lastName = session.Speakers[0].LastName.trim()
if (dayName != lastDayName && !flags.day) {
this.log(`-- ${dayName} --`)
}
this.log(`"${title}" by ${firstName} ${lastName} at ${moment(session.ScheduledDateTime).format('hh:mm a')}`)
lastDayName = dayName;
}
}
}
}

42
src/commands/tags.ts Normal file
Просмотреть файл

@ -0,0 +1,42 @@
import {Command, flags} from '@oclif/command'
import axios from 'axios'
export default class Tags extends Command {
static description = 'describe the command here'
static flags = {
help: flags.help({char: 'h'}),
year: flags.string({char: 'y', description: 'year', default: '2018'})
}
static args = [{name: 'file'}]
async run() {
const {args, flags} = this.parse(Tags)
const url = `https://www.thatconference.com/api3/Session/GetAcceptedSessions?year=${flags.year}`
let {data} = await axios.get(url)
var allTags:string[] = new Array()
for (let user of data) {
let tags = user.Tags
for (let tag of tags.keys()) {
let name = tags[tag];
allTags.push(name)
}
}
// this.log(allTags.count)
var uniqueTags = Array.from(new Set(allTags))
// this.log(uniqueTags.count)
for (let tag of uniqueTags) {
// this.log(tag.Name)
}
}
}

1
src/index.ts Normal file
Просмотреть файл

@ -0,0 +1 @@
export {run} from '@oclif/command'

197
tags.json Normal file
Просмотреть файл

@ -0,0 +1,197 @@

Просмотреть файл

@ -0,0 +1,17 @@
import {expect, test} from '@oclif/test'
describe('hello', () => {
test
.stdout()
.command(['hello'])
.it('runs hello', ctx => {
expect(ctx.stdout).to.contain('hello world')
})
test
.stdout()
.command(['hello', '--name', 'jeff'])
.it('runs hello --name jeff', ctx => {
expect(ctx.stdout).to.contain('hello jeff')
})
})

Просмотреть файл

@ -0,0 +1,17 @@
import {expect, test} from '@oclif/test'
describe('sessions', () => {
test
.stdout()
.command(['sessions'])
.it('runs hello', ctx => {
expect(ctx.stdout).to.contain('hello world')
})
test
.stdout()
.command(['sessions', '--name', 'jeff'])
.it('runs hello --name jeff', ctx => {
expect(ctx.stdout).to.contain('hello jeff')
})
})

Просмотреть файл

@ -0,0 +1,17 @@
import {expect, test} from '@oclif/test'
describe('tags', () => {
test
.stdout()
.command(['tags'])
.it('runs hello', ctx => {
expect(ctx.stdout).to.contain('hello world')
})
test
.stdout()
.command(['tags', '--name', 'jeff'])
.it('runs hello --name jeff', ctx => {
expect(ctx.stdout).to.contain('hello jeff')
})
})

2
test/helpers/init.js Normal file
Просмотреть файл

@ -0,0 +1,2 @@
const path = require('path')
process.env.TS_NODE_PROJECT = path.resolve('test/tsconfig.json')

7
test/mocha.opts Normal file
Просмотреть файл

@ -0,0 +1,7 @@
--require test/helpers/init.js
--require ts-node/register
--require source-map-support/register
--watch-extensions ts
--recursive
--reporter spec
--timeout 5000

11
test/tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,11 @@
{
"declaration": false,
"extends": "../tsconfig",
"compilerOptions": {
"sourceMap": true
},
"include": [
"./**/*",
"../src/**/*"
]
}

16
tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,16 @@
{
"compilerOptions": {
"declaration": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"module": "commonjs",
"outDir": "./lib",
"rootDirs": [ "./src" ],
"strict": true,
"target": "es2017",
"typeRoots": [ "./node_modules/@types" ]
},
"include": [
"./src/**/*"
]
}

3
tslint.json Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"extends": "@oclif/tslint"
}

0
wade.json Normal file
Просмотреть файл

2480
yarn.lock Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу