Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 11, 2019
0 parents commit f5b179b
Show file tree
Hide file tree
Showing 29 changed files with 11,135 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"presets": ["@babel/typescript"],
"plugins": [
["babel-plugin-module-resolver", { "alias": { "~": "./src" } }],
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": false }],
"@babel/plugin-proposal-class-properties",
["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": true }]
],
"ignore": ["node_modules", "**/*.d.ts"],
"env": {
"test": {
"presets": [
["@babel/preset-env", { "targets": { "node": "8.0.0" } }],
"@babel/typescript"
]
}
}
}
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
104 changes: 104 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
const path = require('path');
const fs = require('fs');
const globals = require('eslint-restricted-globals');
const { configs: ts } = require('@typescript-eslint/eslint-plugin');
const project = require('./project.config');

const dir = (file) => path.join(project.get('paths.root'), file);
const prettier = require(dir('.prettierrc'));
const babel = JSON.parse(fs.readFileSync(dir('.babelrc')));
const aliases =
babel &&
babel.plugins &&
babel.plugins
.filter((plugin) => Array.isArray(plugin))
.filter((plugin) => plugin[0] === 'babel-plugin-module-resolver')
.map((plugin) => plugin[1] && plugin[1].alias)[0];

module.exports = {
root: true,
extends: ['standard', 'plugin:import/errors', 'prettier'],
env: {
node: true,
jest: true
},
parserOptions: {
impliedStrict: true,
sourceType: 'module'
},
plugins: ['prettier', 'jest', 'import'],
globals: {},
rules: {
/* DISABLED */
'standard/no-callback-literal': 0,
/* WARNINGS */
'no-warning-comments': [
1,
{ terms: ['xxx', 'fixme', 'todo', 'refactor'], location: 'start' }
],
'no-unused-vars': 1,
'no-console': 1,
/* ERRORS */
// Add custom globals
'no-restricted-globals': [2, 'fetch'].concat(globals),
// Prettier
'prettier/prettier': [2, prettier]
},
settings: {
'import/resolver': {
alias: {
map: Object.entries(aliases || {}),
extensions: ['json']
.concat(project.get('ext.js').split(','))
.concat(
project.get('typescript') ? project.get('ext.ts').split(',') : []
)
.filter(Boolean)
.map((x) => '.' + x)
}
}
},
overrides: [
/* JAVASCRIPT */
{
files: [`*.{${project.get('ext.js')}}`],
parser: 'babel-eslint',
plugins: ['babel'],
rules: {
'babel/no-invalid-this': 1,
'babel/semi': 1
}
},
/* TYPESCRIPT */
{
files: [`*.{${project.get('ext.ts')}}`],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
// Overrides don't allow for extends
rules: Object.assign(ts.recommended.rules, {
/* DISABLED */
'@typescript-eslint/indent': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-object-literal-type-assertion': 0,
/* WARNINGS */
'@typescript-eslint/camelcase': 1,
'@typescript-eslint/explicit-function-return-type': [
1,
{ allowExpressions: true, allowTypedFunctionExpressions: true }
],
'@typescript-eslint/no-unused-vars': [
1,
{
args: 'after-used',
argsIgnorePattern: '_.*',
ignoreRestSiblings: true
}
],
/* ERRORS */
'@typescript-eslint/interface-name-prefix': [2, 'always'],
'@typescript-eslint/no-use-before-define': [2, { functions: false }],
'@typescript-eslint/array-type': [2, 'array-simple']
})
}
]
};
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Project Specific #
####################
/pkg
/build
/lib
/bin
/dist
/out
_test*

# Node, Frameworks, Editors #
#############################
.cache
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
coverage
node_modules
npm-debug.log

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite
*.db

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/pkg
/build
/lib
/bin
/dist
/out
.vscode
.cache
coverage
node_modules
*.md
12 changes: 12 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'none',
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: 'always',
proseWrap: 'never'
};
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- '8.0.0'
script:
- npm run validate
after_success:
- coveralls < coverage/lcov.info
18 changes: 18 additions & 0 deletions Jakefile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const fs = require('fs');
const path = require('path');
const project = require('./project.config');

const JAKE_DIR = path.join(project.get('paths.root'), 'scripts/tasks');

(function run(dir = JAKE_DIR) {
fs.readdirSync(dir).forEach((name) => {
const item = path.join(dir, name);

if (fs.statSync(item).isDirectory()) {
if (name === 'root') run(item);
else namespace(name, () => run(item));
} else if (/\.jake\.js$/.exec(item)) {
require(item);
}
});
})();
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Rafa Mel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# kpo

[![Version](https://img.shields.io/npm/v/kpo.svg)](https://www.npmjs.com/package/kpo)
[![Build Status](https://img.shields.io/travis/rafamel/kpo.svg)](https://travis-ci.org/rafamel/kpo)
[![Coverage](https://img.shields.io/coveralls/rafamel/kpo.svg)](https://coveralls.io/github/rafamel/kpo)
[![Dependencies](https://img.shields.io/david/rafamel/kpo.svg)](https://david-dm.org/rafamel/kpo)
[![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/kpo.svg)](https://snyk.io/test/npm/kpo)
[![License](https://img.shields.io/github/license/rafamel/kpo.svg)](https://github.com/rafamel/kpo/blob/master/LICENSE)
[![Types](https://img.shields.io/npm/types/kpo.svg)](https://www.npmjs.com/package/kpo)

<!-- markdownlint-disable MD036 -->
**A task runner that goes where npm scripts won't, for the true [capo.](https://en.wiktionary.org/wiki/capo#Etymology_2)**
<!-- markdownlint-enable MD036 -->

## Install

To install *kpo* globally, run: [`npm install -g kpo`](https://www.npmjs.com/package/kpo)
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const project = require('./project.config');
const EXT =
project.get('typescript') && project.get('ext.ts')
? project.get('ext.js') + ',' + project.get('ext.ts')
: project.get('ext.js');
const EXT_ARR = EXT.split(',');

module.exports = {
testEnvironment: 'node',
collectCoverage: true,
collectCoverageFrom: [`<rootDir>/src/**/*.{${EXT}}`],
modulePathIgnorePatterns: [
'<rootDir>/pkg',
'<rootDir>/src/@types',
'<rootDir>/src/bin',
'<rootDir>/src/.*/__mocks__'
],
moduleFileExtensions: EXT_ARR.concat(['json']),
testPathIgnorePatterns: ['/node_modules/']
};
9 changes: 9 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"~/*": ["src/*"]
}
}
}
7 changes: 7 additions & 0 deletions markdown.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ul-indent": {
"indent": 2
},
"line-length": false,
"no-inline-html": false
}
Loading

0 comments on commit f5b179b

Please sign in to comment.