Skip to content

Commit

Permalink
feat: use coveralls instead of codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
mamboer committed Aug 8, 2018
1 parent 9523551 commit 72e5630
Show file tree
Hide file tree
Showing 20 changed files with 12,058 additions and 4,364 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
_book
tooling
coverage
docs
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ branches:

env:
global:
- GH_REPO: "github.com/o2team/fs.git"
- secure: "izDq9jqjboKS6BGohGDfg+WtMSs3VaWw7zdqoOmgAI8csvrLARtT7zzQJXC4ag/jTOXySkDflJsDcM2GPaY7fOWypUUIV3MF5gDzmaz3RB22EzHIz7BW1lht2ZjhqQqVMAMEndiGWMqUO8bkdYD3L9rsTxu58ncDKH+sCbEktS5Omk66BBwGnPkwYpnp0CgOe4YZ5y/RTD6HpCBOlOtNSonVZ4AI/KL9wLbUOuu9D9ZDbrQCX3CQviLmxSctWhaE7Y19oHiWmD5Scluxymt5difVNhK5cmmbiDogadlkb772rN3umFrvE82QW362kyqAJ/E1YIcAsqiYtmvkfu+rC0fzs1a/CMkioDX4WRHrLLhE92A2AI4IMB9S6XInVL1uLekLjD5OL8qm6L/aHxRoRKFpk/RFomQcIFNxGhm4v7Iy+3MwlPJq5gKQPrU1aF1vnDbkwPq3FuyI+QTvxBxtPSIecVop/UKOC46Q9vIZvA0j87zOr/eFqrCzdMuEY7edRWyOKVvF7VSh9MKmTte7fdH8PdGdnlmvJbIAbFK2EiZA9efw/JxQy4czeolaSvbCkWRh5jxfut43Bl+srC9sqKncbunxGpDRcDJD1YEZP71TiQugjBJoalNLwq34tYmMx/4izGIZyVvjXRlryUNkcAxBOutIwiMHXbZP7U23//Y="
- GH_REPO: "github.com/mamboer/fs.git"
- secure: "KElmHq/XcjtD1aufQl1n6YOVtPHzHPqKAdKuiReklWIIN3W5jgH0pulsO2lS33pzerH2APDc6a0jgE/KOTZVPV4etmNJOTzQ4naUrQVmsAJj61vyADboiVUq6wOdEQT0ztLcpiRj1vRqmrFAjUiU6d7Xw/izQYcJbouTE1QPUroT1LE4hCaH5WidqkJ0lmYvUvGpbwzjfOTGfU+yYpoi8DDsXX19OsI7Ea+98giQmrVkz1hEP0zRmQ6l6oKKg0HJNHAUt3eJpTm7fLdl55LPM0maIz4h2eiboLgY6NUkDK4IylZmuSah8XsA4+RuLwpH+JG7IVrrCKuwsmXHqtCZ4ZXJfOxXVW6EihWZpZtw8lgKXa/Llxg55CjuHw/Jtm2M7jMvad99yj79K2FlbMf0labcjKbwLfBIYT9hMv61XVff8rcNGOk5/51NcNP8EbKKpzJe535YY50EZq6gbeYFC2xIXfc62ogbfQbBjH7TbKdUOS9Mq1lMsBPiS3d/QeQSVxxg2donm5nQ3206fU3v/pC7UmT2rnvLPeiir7KUFY3ix4Phr8VzJSWoUcDS9gYW2x2R/XFD5kmeiGi3rvo8iPLrgFPj8YBQMbCkkoVFMxEExeUXAZNlweHbZjifX47+w22fb/gpKmrE+LOYVDO9v4j/UsLCoFQC7G45otcKBkQ="
4 changes: 2 additions & 2 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ if [ "$1" = "false" ]
# not a pull request, deploy to github pages
then ( cd _book
git init
git config user.name "AOTULabs"
git config user.email "o2labs@qq.com"
git config user.name "LV"
git config user.email "mamboer@gmail.com"
git add .
git commit -m "Deployed from Travis CI"
git push --force --quiet "https://${GH_TOKEN}@${GH_REPO}" master:gh-pages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ npm run test1
2. Run the debug command

```
babel-node --harmony --inspect-brk test/debugs/your.debug.js
node --inspect-brk test/debugs/your.debug.js
```
3. Open the Chrome inspector interface

Expand Down
26 changes: 1 addition & 25 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1 @@
import {walk, walkSync, flatten, flattenSync} from './libs/dir'

// NOTE: This non-default export supports ES6 imports.
// Example:
// import { walk } from '@aotu/fs';
// -or-
// import * as FS from '@aotu/fs';
export {
walk,
walkSync,
flatten,
flattenSync
}

// NOTE: This default export supports CommonJS modules (otherwise Babel does NOT promote them).
// Example:
// const { walk } = require('@aotu/fs');
// -or-
// const FS = require('@aotu/fs');
export default {
walk,
walkSync,
flatten,
flattenSync
}
module.exports = require('./libs/dir')
2 changes: 1 addition & 1 deletion libs/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Constants module
* @module consts
*/
export default {
module.exports = {
/**
* @constant
* @type {String}
Expand Down
34 changes: 9 additions & 25 deletions libs/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
* @typedef StringOrBoolean
*/

import {readdir, stat, readdirSync, statSync} from 'fs-extra'
import {join, basename, extname} from 'path'
import assert from 'assert'
import {merge, map, filter} from 'lodash'
import {fn0, fn1, fn2} from './dummy'
import consts from './consts'
import {backslashToSlash, test} from './str';
import Ignore from './ignore'
const {readdir, stat, readdirSync, statSync} = require('fs-extra')
const {join, basename, extname} = require('path')
const assert = require('assert')
const {merge, map, filter} = require('lodash')
const {fn0, fn1, fn2} = require('./dummy')
const consts = require('./consts')
const {backslashToSlash, test} = require('./str')
const Ignore = require('./ignore')

/**
* Walk a directory recursively and return a json tree
Expand Down Expand Up @@ -308,24 +308,8 @@ function flattenSync (dir, opts, level = 0) {
return items
}

// NOTE: This non-default export supports ES6 imports.
// Example:
// import { walk } from '@aotu/fs';
// -or-
// import * as FS from '@aotu/fs';
export {
walk,
walkSync,
flatten,
flattenSync
}

// NOTE: This default export supports CommonJS modules (otherwise Babel does NOT promote them).
// Example:
// const { walk } = require('@aotu/fs');
// -or-
// const FS = require('@aotu/fs');
export default {
module.exports = {
walk,
walkSync,
flatten,
Expand Down
23 changes: 4 additions & 19 deletions libs/dummy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,20 @@
/**
* A dummy function returns `undefined`
*/
export function fn () {
// do nothing
}
exports.fn = () => {}

/**
* A dummy function returns `true`
*/
export function fn1 () {
return true
}
exports.fn1 = () => true

/**
* A dummy function returns `false`
*/
export function fn0 () {
return false
}
exports.fn0 = () => false

/**
* A dummy function returns the raw parameter
* @param {*} x Any object
*/
export function fn2 (x) {
return x
}

export default {
fn,
fn0,
fn1,
fn2
}
exports.fn2 = x => x
10 changes: 5 additions & 5 deletions libs/ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* @module ignore
*/

import ignore from 'ignore'
import findUp from 'find-up'
import {existsSync, readFileSync} from 'fs-extra'
import {split, map, filter, isString, some} from 'lodash'
const ignore = require('ignore')
const findUp = require('find-up')
const {existsSync, readFileSync} = require('fs-extra')
const {split, map, filter, isString, some} = require('lodash')


let cache = {}
Expand Down Expand Up @@ -82,4 +82,4 @@ function isIgnore (str, ignoreFiles = '.gitignore') {

Ignore.isIgnore = isIgnore

export default Ignore
module.exports = Ignore
4 changes: 2 additions & 2 deletions libs/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
* @param {*} regExp The target object to be tested
* @returns {Boolean} The testing result
*/
export function isRegex(regExp) {
function isRegex(regExp) {
return typeof regExp === "object" && regExp.constructor == RegExp
}

export default {
module.exports = {
isRegex
}
10 changes: 5 additions & 5 deletions libs/str.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* @module str
*/

import {some, isArray} from 'lodash'
import {isRegex} from './regex'
const {some, isArray} = require('lodash')
const {isRegex} = require('./regex')
/**
* Normalizes windows style paths by replacing double backslahes with single forward slahes (unix style).
* @param {String} str The string that to be handled
* @returns {String} The normalized path
*/
export function backslashToSlash (str) {
function backslashToSlash (str) {
return str.replace(/\\/g, '/');
}

Expand All @@ -21,7 +21,7 @@ export function backslashToSlash (str) {
* @param {Boolean} reversed Whether perform a reversing test
* @returns {Boolean} The testing result
*/
export function test (str, regexOrFunc, reversed = false) {
function test (str, regexOrFunc, reversed = false) {
if (isRegex(regexOrFunc)) {
regexOrFunc = [regexOrFunc]
}
Expand All @@ -41,7 +41,7 @@ export function test (str, regexOrFunc, reversed = false) {
return false
}

export default {
module.exports = {
backslashToSlash,
test
}
Loading

0 comments on commit 72e5630

Please sign in to comment.