Skip to content

Commit

Permalink
REF: Move code to src/
Browse files Browse the repository at this point in the history
  • Loading branch information
royriojas committed Nov 8, 2020
1 parent beed74c commit 18ed6e8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -24,7 +24,7 @@
"npm run verify --silent"
],
"scripts": {
"eslint": "eslint --cache --cache-location=node_modules/.cache/ --ext .js .",
"eslint": "eslint --cache --cache-location=node_modules/.cache/ --ext ./src/**/*.js ./test/**/*.js",
"eslint-fix": "npm run eslint -- --fix",
"autofix": "npm run eslint-fix",
"check": "npm run eslint",
Expand Down
6 changes: 3 additions & 3 deletions cache.js → src/cache.js
Expand Up @@ -19,7 +19,7 @@ var cache = {

me._visited = {};
me._persisted = {};
me._pathToFile = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, './.cache/', docId);
me._pathToFile = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, '../.cache/', docId);

if (fs.existsSync(me._pathToFile)) {
me._persisted = utils.tryParse(me._pathToFile, {});
Expand Down Expand Up @@ -182,7 +182,7 @@ module.exports = {
* @returns {Boolean} true if the cache folder was deleted. False otherwise
*/
clearCacheById: function (docId, cacheDir) {
var filePath = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, './.cache/', docId);
var filePath = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, '../.cache/', docId);
return del(filePath);
},
/**
Expand All @@ -191,7 +191,7 @@ module.exports = {
* @returns {Boolean} true if the cache folder was deleted. False otherwise
*/
clearAll: function (cacheDir) {
var filePath = cacheDir ? path.resolve(cacheDir) : path.resolve(__dirname, './.cache/');
var filePath = cacheDir ? path.resolve(cacheDir) : path.resolve(__dirname, '../.cache/');
return del(filePath);
},
};
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions test/specs/cache.js
@@ -1,13 +1,12 @@
var expect = require('chai').expect;
var readJSON = require('../../utils.js').readJSON;
var readJSON = require('../../src/utils').readJSON;
var path = require('path');
var rimraf = require('rimraf').sync;
var fs = require('fs');
var flatCache = require('../../cache');
var flatCache = require('../../src/cache');
var write = require('write');
describe('flat-cache', function () {
'use strict';

describe('flat-cache', function () {
beforeEach(function () {
flatCache.clearAll();
rimraf(path.resolve(__dirname, '../fixtures/.cache/'));
Expand Down

0 comments on commit 18ed6e8

Please sign in to comment.