Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 3b35371

Browse files
committed
refactor(deep-linking): better update event handler, additional tests
1 parent 840a6f3 commit 3b35371

File tree

3 files changed

+649
-12
lines changed

3 files changed

+649
-12
lines changed

src/deep-linking.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function deepLinkingWorker(context: BuildContext) {
3535
return deepLinkingWorkerImpl(context, null);
3636
}
3737

38-
function deepLinkingWorkerImpl(context: BuildContext, changedFiles: ChangedFile[]) {
38+
export function deepLinkingWorkerImpl(context: BuildContext, changedFiles: ChangedFile[]) {
3939
return Promise.resolve().then(() => {
4040
const appNgModulePath = getStringPropertyValue(Constants.ENV_APP_NG_MODULE_PATH);
4141
const appNgModuleFile = context.fileCache.get(appNgModulePath);
@@ -54,12 +54,16 @@ function deepLinkingWorkerImpl(context: BuildContext, changedFiles: ChangedFile[
5454
}
5555

5656
export function deepLinkingUpdate(changedFiles: ChangedFile[], context: BuildContext) {
57-
// TODO, consider optimizing later
57+
const tsFiles = changedFiles.filter(changedFile => changedFile.ext === '.ts');
58+
if (tsFiles.length === 0) {
59+
return Promise.resolve();
60+
}
5861
const logger = new Logger('deeplinks update');
5962
return deepLinkingWorkerImpl(context, changedFiles).then((deepLinkConfigEntries: DeepLinkConfigEntry[]) => {
6063
setParsedDeepLinkConfig(deepLinkConfigEntries);
6164
logger.finish();
6265
}).catch((err: Error) => {
66+
Logger.warn(err.message);
6367
const error = new BuildError(err.message);
6468
throw logger.fail(error);
6569
});

0 commit comments

Comments
 (0)