Skip to content

Commit

Permalink
Merge pull request #47 from blackflux/dev
Browse files Browse the repository at this point in the history
[Gally]: master <- dev
  • Loading branch information
simlu committed Apr 1, 2019
2 parents feddf3d + 646e27d commit 25826fd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"babel-eslint": "10.0.1",
"chai": "4.2.0",
"coveralls": "3.0.3",
"eslint": "5.15.3",
"eslint": "5.16.0",
"js-gardener": "1.38.2",
"nyc": "13.3.0",
"semantic-release": "15.13.3",
"tmp": "0.0.33"
"tmp": "0.1.0"
},
"nyc": {
"tempDir": "./coverage/.nyc_output",
Expand Down
3 changes: 3 additions & 0 deletions src/logic/guess-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const path = require('path');
module.exports = (filepath) => {
const dirname = path.dirname(filepath);
const basename = path.basename(filepath);
if (!fs.existsSync(dirname) || !fs.lstatSync(dirname).isDirectory()) {
return null;
}
const relevantFiles = fs
.readdirSync(dirname)
.filter(f => f === basename || (f.startsWith(`${basename}.`) && f.lastIndexOf('.') <= basename.length));
Expand Down
5 changes: 5 additions & 0 deletions test/logic/guess-file.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ describe('Testing guessFile', () => {
executeTest(['file.json.json'], 'file', null);
executeTest(['file..json'], 'file', null);
});

it('Testing parent folder missing', () => {
executeTest([], 'folder/file', null);
executeTest(['folder'], 'folder/file', null);
});
});
19 changes: 13 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2035,10 +2035,10 @@ eslint@5.15.1:
table "^5.2.3"
text-table "^0.2.0"

eslint@5.15.3:
version "5.15.3"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.15.3.tgz#c79c3909dc8a7fa3714fb340c11e30fd2526b8b5"
integrity sha512-vMGi0PjCHSokZxE0NLp2VneGw5sio7SSiDNgIUn2tC0XkWJRNOIoHIg3CliLVfXnJsiHxGAYrkw0PieAu8+KYQ==
eslint@5.16.0:
version "5.16.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea"
integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==
dependencies:
"@babel/code-frame" "^7.0.0"
ajv "^6.9.1"
Expand All @@ -2060,7 +2060,7 @@ eslint@5.15.3:
import-fresh "^3.0.0"
imurmurhash "^0.1.4"
inquirer "^6.2.2"
js-yaml "^3.12.0"
js-yaml "^3.13.0"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.3.0"
lodash "^4.17.11"
Expand Down Expand Up @@ -3542,7 +3542,7 @@ js-yaml@3.12.2:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@3.13.0, js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.4.2, js-yaml@^3.6.1, js-yaml@^3.9.0:
js-yaml@3.13.0, js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.4.2, js-yaml@^3.6.1, js-yaml@^3.9.0:
version "3.13.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e"
integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==
Expand Down Expand Up @@ -6606,6 +6606,13 @@ tmp@0.0.33, tmp@^0.0.33:
dependencies:
os-tmpdir "~1.0.2"

tmp@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.1.0.tgz#ee434a4e22543082e294ba6201dcc6eafefa2877"
integrity sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==
dependencies:
rimraf "^2.6.3"

to-fast-properties@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"
Expand Down

0 comments on commit 25826fd

Please sign in to comment.