From 6091474c67411e9ce9996e7c409e4f24f42e9e57 Mon Sep 17 00:00:00 2001 From: InLAnn Date: Tue, 31 Jan 2023 23:34:35 +0800 Subject: [PATCH] scripts: fix the comparison of package references (#12122) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Paul Maréchal --- dev-packages/private-eslint-plugin/tsconfig.json | 9 ++++++++- packages/core/tsconfig.json | 6 ++++++ packages/editor-preview/tsconfig.json | 3 +++ scripts/compile-references.js | 4 +++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dev-packages/private-eslint-plugin/tsconfig.json b/dev-packages/private-eslint-plugin/tsconfig.json index e7e23251e1f99..8137e3e6fa954 100644 --- a/dev-packages/private-eslint-plugin/tsconfig.json +++ b/dev-packages/private-eslint-plugin/tsconfig.json @@ -6,5 +6,12 @@ "include": [ "rules" ], - "references": [] + "references": [ + { + "path": "../../packages/core" + }, + { + "path": "../private-re-exports" + } + ] } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 27758a2237580..e490a71167a54 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -12,6 +12,12 @@ "references": [ { "path": "../../dev-packages/application-package" + }, + { + "path": "../../dev-packages/private-re-exports" + }, + { + "path": "../../dev-packages/request" } ] } diff --git a/packages/editor-preview/tsconfig.json b/packages/editor-preview/tsconfig.json index b8599fa6f6f5a..97f0e679c552a 100644 --- a/packages/editor-preview/tsconfig.json +++ b/packages/editor-preview/tsconfig.json @@ -14,6 +14,9 @@ }, { "path": "../editor" + }, + { + "path": "../navigator" } ] } diff --git a/scripts/compile-references.js b/scripts/compile-references.js index 00376f320ef0e..9569e1b9fca57 100644 --- a/scripts/compile-references.js +++ b/scripts/compile-references.js @@ -126,7 +126,9 @@ async function configureTypeScriptReferences(targetPackage, expectedReferences) /** @type {string[]} */ const currentReferences = (tsconfigJson['references'] || []).map(reference => reference.path); // Compare both arrays: if an element is not the same we need to rewrite. - needRewrite = needRewrite || currentReferences.some((reference, index) => expectedReferences[index] !== reference); + needRewrite = needRewrite + || currentReferences.length !== expectedReferences.length + || currentReferences.some((reference, index) => expectedReferences[index] !== reference); if (needRewrite) { tsconfigJson.references = expectedReferences.map(path => ({ path })); const content = JSON.stringify(tsconfigJson, undefined, 2);