From ce61d075ec54f0b171045c9cd84335d7abcaa6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Bal=C3=A1ssy?= Date: Mon, 18 Sep 2017 10:18:19 +0200 Subject: [PATCH 1/2] FIXED: TypeScript compiler ERROR: src/watchFiles.ts[12, 7]: Shadowed name: 'watchFiles' --- src/watchFiles.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/watchFiles.ts b/src/watchFiles.ts index eb4acb61..8b8322c5 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 } } From 3fc55e50c816fcb9e910b22b5228981ec9d7ffe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Bal=C3=A1ssy?= Date: Mon, 18 Sep 2017 10:19:04 +0200 Subject: [PATCH 2/2] UPDATE: The deprecated fs-p package is replaced with the latest version of the fs-extra package. --- package.json | 2 +- src/index.ts | 2 +- src/typescript.ts | 2 +- yarn.lock | 29 ++++++++++++----------------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index f049fe6d..aff59f8f 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 959f0d4c..4d19d1a2 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 1f07bdc1..f18e59b4 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/yarn.lock b/yarn.lock index 46f04608..f534ae76 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"