Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sQVe committed Oct 22, 2018
2 parents 3250430 + 37e5029 commit bbaf16c
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/build/**
/coverage/**
/dist/**
/node_modules/**
/submodules/**
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ build/
coverage/
dist/


# --- SublimeText
# cache files for sublime text
*.tmlanguage.cache
Expand All @@ -44,8 +43,7 @@ dist/

# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project

*.sublime-project

# --- VisualStudioCode
.vscode/*
Expand All @@ -59,7 +57,6 @@ dist/
modules.xml
*.ipr


# --- System Files
.DS_Store

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-prefix=~
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/build/**
/coverage/**
/dist/**
/node_modules/**
/submodules/**
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 30s

_A command-line application for [30 seconds of code](https://github.com/30-seconds/30-seconds-of-code/) snippets._
_A command-line application for [`30 seconds of code`](https://github.com/30-seconds/30-seconds-of-code/) snippets._

[![license](https://img.shields.io/badge/license-CC0--1.0-blue.svg)](https://github.com/sQVe/30s/blob/develop/LICENSE) [![build status](https://travis-ci.org/sQVe/30s.svg?branch=master)](https://travis-ci.org/sQVe/30s) [![coveralls](https://coveralls.io/repos/github/sQVe/30s/badge.svg?branch=master)](https://coveralls.io/github/sQVe/30s?branch=master) [![greenkeeper](https://badges.greenkeeper.io/sQVe/30s.svg)](https://greenkeeper.io/)

Expand All @@ -14,9 +14,9 @@ _A command-line application for [30 seconds of code](https://github.com/30-secon
- View, view by tag and search snippets
- Only show what you find necessary by picking a layout
- Colorful output or JSON
- Copy all code blocks to clipboard
- Copy all code to clipboard
- Automatically updates with new snippet changes
- Works on Mac, Linux and (maybe) Windows
- Works on Linux, Mac and Windows

## Installation

Expand All @@ -38,7 +38,7 @@ yarn add -g 30s
$ git clone [email protected]:sQVe/30s.git
$ cd 30s/
$ npm install
$ ./build/cli.sh <command> <query>
$ ./dist/index.js <command> <query>
```

## Usage
Expand Down Expand Up @@ -98,7 +98,7 @@ Please use the [issue tracker](https://github.com/sQVe/30s/issues) to report bug

#### Developing

PRs are more than welcome. Do the following to start helping out:
Pull requests are more than welcome. Do the following to start helping out:

1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
2. Run `npm install` in the created directory to install all necessary dependencies.
Expand All @@ -108,17 +108,26 @@ Optional steps:
3. Uninstall `30s` if it's already installed: `npm uninstall -g 30s`
4. Link it to the global module directory: `npm link`

#### Style guide & conventions

Code is written with an intent to follow [functional programming](https://en.wikipedia.org/wiki/Functional_programming) best practices. Write pure functions and utilize [`Ramda`](https://github.com/ramda/ramda) when possible.

Styling and formatting is enforced by [`prettier`](https://github.com/prettier/prettier) and [`eslint-config-sqve`](https://github.com/sQVe/eslint-config-sqve) (a config based on [`airbnb/javascript`](https://github.com/airbnb/javascript)). Code is automatically formatted and fixed on `pre-commit` and also checked for issues on **Travis CI**.

Commits are written in accordance with [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). This enables us to automatically release new version together with [`semantic-release`](https://github.com/semantic-release/semantic-release) on `fix` and `feat` commit types.

#### Roadmap

See the [development board](https://github.com/sQVe/30s/projects/1) for a detailed development roadmap. Below are a short outline of important improvements:

- Replace most helper logic by using `Ramda`
- Replace `commander` with basic `yargs` and own logic
- Autocomplete with `omelette`
- Display relevant tags
- Replace `commander` with basic `yargs` and own logic
- Replace most helper logic by using `Ramda`

## Thanks

Many thanks to the core team and all the contributers at [30-seconds-of-code](https://github.com/Chalarangelo/30-seconds-of-code) for creating an awesome curated collection of snippets.
Many thanks to the core team and all the contributers at [`30-seconds-of-code`](https://github.com/Chalarangelo/30-seconds-of-code) for creating an awesome curated collection of snippets.

## License

Expand Down
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
clearMocks: true,
coveragePathIgnorePatterns: [
// Exlude cli integration test.
'/test/cli.test.js',
// Exlude index (cli) integration test.
'/test/index.test.js',
],
testEnvironment: 'node',
testPathIgnorePatterns: [
// Exlude cli integration test.
'/test/cli.test.js',
// Exlude index (cli) integration test.
'/test/index.test.js',
'/node_modules/',
'/submodules/',
],
Expand Down
3 changes: 1 addition & 2 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"compilerOptions": {
"target": "es2017",
"checkJs": true,
"allowSyntheticDefaultImports": true,
"jsx": "react"
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*", "test/**/*"]
}
40 changes: 27 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,43 @@
"cli"
],
"scripts": {
"build": "rm -rf build && npm run build:js && npm run build:parse",
"build:copy": "cp src/snippets.json build/",
"build:js": "NODE_ENV=production babel src --out-dir build",
"build:parse": "node build/parser.js",
"build": "rm -rf dist && npm run build:js && npm run build:parse",
"build:copy": "cp src/snippets.json dist/",
"build:js": "NODE_ENV=production babel src --out-dir dist",
"build:parse": "node dist/parser.js",
"ci:format": "prettier-eslint --list-different '{**/*,*}.{js,jsx,json}'",
"ci:coverage": "jest --coverage --coverageReporters=text-lcov | coveralls",
"format": "prettier-eslint --write '{**/*,*}.{js,jsx,json}'",
"lint": "eslint '{**/*,*}.{js,jsx}'",
"prepare": "npm run build",
"start": "babel-node src/cli.js",
"start": "babel-node src/index.js",
"test": "jest",
"test:coverage": "jest --coverage",
"test:integration": "jest test/cli.test.js --testPathIgnorePatterns",
"test:integration": "jest test/index.test.js --testPathIgnorePatterns",
"test:watch": "jest --watch --onlyChanged"
},
"engines": {
"node": ">= 8"
},
"bin": {
"30s": "./build/cli.js"
"30s": "./dist/index.js"
},
"files": [
"build/"
"dist/"
],
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/cli": "~7.1.2",
"@babel/core": "~7.1.2",
"@babel/node": "~7.0.0",
"@babel/preset-env": "~7.1.0",
"@types/jest": "^23.3.5",
"@types/node": "^10.11.7",
"@types/ramda": "^0.25.39",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "~23.6.0",
"coveralls": "^3.0.2",
"coveralls": "~3.0.2",
"eslint": "~5.6.1",
"eslint-config-sqve": "~1.6.1",
"eslint-config-sqve": "~1.7.0",
"eslint-plugin-import": "~2.14.0",
"eslint-plugin-jsx-a11y": "~6.1.2",
"eslint-plugin-react": "~7.11.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup_git() {
}

get_snippets_sha() {
sha256sum build/snippets.json | awk '{print $1}'
sha256sum dist/snippets.json | awk '{print $1}'
}

check_submodules_changes() {
Expand Down
10 changes: 5 additions & 5 deletions src/cli.js → src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

import program from 'commander';

import snippets from '../build/snippets.json';
import snippets from '../dist/snippets.json';
import { getSnippet, getSnippetsByTag, searchSnippets } from './handler';
import { print } from './printer';
import { printSnippet } from './printer';
import { version } from '../package.json';

const isTest = process.env.NODE_ENV === 'test';
const actions = {
tag: (id, opts) => print(opts, getSnippetsByTag(snippets, id)),
view: (id, opts) => print(opts, getSnippet(snippets, id)),
search: (query, opts) => print(opts, searchSnippets(snippets, query)),
tag: (id, opts) => printSnippet(opts, getSnippetsByTag(snippets, id)),
view: (id, opts) => printSnippet(opts, getSnippet(snippets, id)),
search: (query, opts) => printSnippet(opts, searchSnippets(snippets, query)),
};
const addCommand = settings => {
settings.reduce((acc, [key, ...args]) => acc[key](...args), program);
Expand Down
Loading

0 comments on commit bbaf16c

Please sign in to comment.