diff --git a/package.json b/package.json index f049fe6..aff59f8 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "tslint": "^5.1.0" }, "dependencies": { - "fs-p": "2.0.0", + "fs-extra": "^4.0.2", "globby": "^6.1.0", "lodash": "^4.17.4", "typescript": "^2.2.2" diff --git a/src/index.ts b/src/index.ts index 959f0d4..4d19d1a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import * as path from 'path' -import * as fs from 'fs-p' +import * as fs from 'fs-extra' import * as _ from 'lodash' import * as globby from 'globby' diff --git a/src/typescript.ts b/src/typescript.ts index 1f07bdc..f18e59b 100644 --- a/src/typescript.ts +++ b/src/typescript.ts @@ -1,5 +1,5 @@ import * as ts from 'typescript' -import * as fs from 'fs-p' +import * as fs from 'fs-extra' import * as _ from 'lodash' import { ServerlessFunction } from './types' import * as path from 'path' diff --git a/src/watchFiles.ts b/src/watchFiles.ts index eb4acb6..8b8322c 100644 --- a/src/watchFiles.ts +++ b/src/watchFiles.ts @@ -9,9 +9,9 @@ export function watchFiles( cb: () => void ) { const tsConfig = typescript.getTypescriptConfig(originalServicePath) - let watchFiles = typescript.getSourceFiles(rootFileNames, tsConfig) + let watchedFiles = typescript.getSourceFiles(rootFileNames, tsConfig) - watchFiles.forEach(fileName => { + watchedFiles.forEach(fileName => { watchFile(fileName, { persistent: true, interval: 250 }, watchCallback) }) @@ -25,18 +25,18 @@ export function watchFiles( // use can reference not watched yet file or remove reference to already watched const newWatchFiles = typescript.getSourceFiles(rootFileNames, tsConfig) - watchFiles.forEach(fileName => { + watchedFiles.forEach(fileName => { if (newWatchFiles.indexOf(fileName) < 0) { unwatchFile(fileName, watchCallback) } }) newWatchFiles.forEach(fileName => { - if (watchFiles.indexOf(fileName) < 0) { + if (watchedFiles.indexOf(fileName) < 0) { watchFile(fileName, { persistent: true, interval: 250 }, watchCallback) } }) - watchFiles = newWatchFiles + watchedFiles = newWatchFiles } } diff --git a/yarn.lock b/yarn.lock index 46f0460..f534ae7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -735,13 +735,6 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" -fs-extra@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.1.2.tgz#046c70163cef9aad46b0e4a7fa467fb22d71de35" - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - fs-extra@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291" @@ -750,11 +743,13 @@ fs-extra@^3.0.0: jsonfile "^3.0.0" universalify "^0.1.0" -fs-p@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fs-p/-/fs-p-2.0.0.tgz#66784a012473c700b68fb76ac2120eccc6b0602b" +fs-extra@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.2.tgz#f91704c53d1b461f893452b0c307d9997647ab6b" dependencies: - fs-extra "^2.0.0" + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" fs.realpath@^1.0.0: version "1.0.0" @@ -1372,18 +1367,18 @@ json5@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.0.tgz#92e7c7444e5ffd5fa32e6a9ae8b85034df8347d0" optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + optionalDependencies: + graceful-fs "^4.1.6" + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"