diff --git a/.nvmrc b/.nvmrc index dac255d2..3d8b28ee 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16.15.1 +v18.11.0 diff --git a/lerna.json b/lerna.json index 94d99c32..434fea63 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,5 @@ ], "npmClient": "yarn", "useWorkspaces": true, - "version": "4.7.2" + "version": "4.7.4" } diff --git a/package.json b/package.json index 027eb3b1..84bbda92 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/forcedotcom/lightning-language-server.git" }, "engines": { - "node": ">=16.0.0" + "node": ">=18.11.0" }, "devDependencies": { "@commitlint/cli": "^7", @@ -15,7 +15,7 @@ "commitizen": "^3.0.5", "cz-conventional-changelog": "^2.1.0", "@types/jest": "^27.4.0", - "@types/node": "^16.0.0", + "@types/node": "^18.11.0", "@typescript-eslint/eslint-plugin": "^2.22.0", "@typescript-eslint/parser": "^2.22.0", "eslint": "^6.8.0", diff --git a/packages/aura-language-server/package.json b/packages/aura-language-server/package.json index 50a1a4af..1d3ae1fb 100644 --- a/packages/aura-language-server/package.json +++ b/packages/aura-language-server/package.json @@ -1,6 +1,6 @@ { "name": "@salesforce/aura-language-server", - "version": "4.7.2", + "version": "4.7.4", "description": "Language server for Aura components.", "main": "lib/aura-indexer/indexer.js", "typings": "lib/shared.d.ts", @@ -27,7 +27,7 @@ "package": "yarn pack" }, "dependencies": { - "@salesforce/lightning-lsp-common": "4.7.2", + "@salesforce/lightning-lsp-common": "4.7.4", "acorn": "^6.0.0", "acorn-loose": "^6.0.0", "acorn-walk": "^6.0.0", @@ -50,7 +50,7 @@ "@types/glob": "^7.1.3", "@types/jest": "^29.5.0", "@types/mock-fs": "^4.10.0", - "@types/node": "^16.0.0", + "@types/node": "^18.11.0", "@types/shelljs": "^0.8.8", "babel-types": "^6.26.0", "eslint": "^7.7.0", diff --git a/packages/lightning-lsp-common/package.json b/packages/lightning-lsp-common/package.json index ff543e89..7316fd69 100644 --- a/packages/lightning-lsp-common/package.json +++ b/packages/lightning-lsp-common/package.json @@ -1,6 +1,6 @@ { "name": "@salesforce/lightning-lsp-common", - "version": "4.7.2", + "version": "4.7.4", "description": "Common components for lwc-language-server and aura-language-server.", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/packages/lightning-lsp-common/src/__tests__/context.test.ts b/packages/lightning-lsp-common/src/__tests__/context.test.ts index 5e3f9015..8aff4932 100644 --- a/packages/lightning-lsp-common/src/__tests__/context.test.ts +++ b/packages/lightning-lsp-common/src/__tests__/context.test.ts @@ -281,20 +281,27 @@ it('configureCoreMulti()', async () => { const jsconfigPathGlobal = context.workspaceRoots[1] + '/modules/jsconfig.json'; const codeWorkspacePath = CORE_ALL_ROOT + '/core.code-workspace'; const launchPath = CORE_ALL_ROOT + '/.vscode/launch.json'; + const tsconfigPathForce = context.workspaceRoots[0] + '/tsconfig.json'; // make sure no generated files are there from previous runs fs.removeSync(jsconfigPathGlobal); fs.removeSync(jsconfigPathForce); fs.removeSync(codeWorkspacePath); fs.removeSync(launchPath); + fs.removeSync(tsconfigPathForce); + + fs.createFileSync(tsconfigPathForce); // configure and verify typings/jsconfig after configuration: await context.configureProject(); // verify newly created jsconfig.json verifyJsconfigCore(jsconfigPathGlobal); - verifyJsconfigCore(jsconfigPathForce); + // verify jsconfig.json is not created when there is a tsconfig.json + expect(fs.existsSync(tsconfigPathForce)).not.toExist(); verifyTypingsCore(); + + fs.removeSync(tsconfigPathForce); }); it('configureCoreAll()', async () => { diff --git a/packages/lightning-lsp-common/src/context.ts b/packages/lightning-lsp-common/src/context.ts index c3ec7c39..106a41ef 100644 --- a/packages/lightning-lsp-common/src/context.ts +++ b/packages/lightning-lsp-common/src/context.ts @@ -395,6 +395,15 @@ export class WorkspaceContext { } } + /** + * @param modulesDir + * @returns whether a tsconfig.json file exists in the same directory of modulesDir + */ + private hasTSConfigOnCore(modulesDir: string): boolean { + const tsConfigFile = path.join(modulesDir, '..', 'tsconfig.json'); + return fs.pathExistsSync(tsConfigFile); + } + /** * Writes to and updates Jsconfig files and ES Lint files of WorkspaceRoots, optimizing by type */ @@ -419,16 +428,22 @@ export class WorkspaceContext { jsConfigTemplate = await fs.readFile(utils.getCoreResource('jsconfig-core.json'), 'utf8'); jsConfigContent = this.processTemplate(jsConfigTemplate, { project_root: '../..' }); for (const modulesDir of modulesDirs) { - const jsConfigPath = path.join(modulesDir, 'jsconfig.json'); - this.updateConfigFile(jsConfigPath, jsConfigContent); + // only writes jsconfig.json if there is no tsconfig.json on core + if (!this.hasTSConfigOnCore(modulesDir)) { + const jsConfigPath = path.join(modulesDir, 'jsconfig.json'); + this.updateConfigFile(jsConfigPath, jsConfigContent); + } } break; case WorkspaceType.CORE_PARTIAL: jsConfigTemplate = await fs.readFile(utils.getCoreResource('jsconfig-core.json'), 'utf8'); jsConfigContent = this.processTemplate(jsConfigTemplate, { project_root: '../..' }); for (const modulesDir of modulesDirs) { - const jsConfigPath = path.join(modulesDir, 'jsconfig.json'); - this.updateConfigFile(jsConfigPath, jsConfigContent); // no workspace reference yet, that comes in update config file + // only writes jsconfig.json if there is no tsconfig.json on core + if (!this.hasTSConfigOnCore(modulesDir)) { + const jsConfigPath = path.join(modulesDir, 'jsconfig.json'); + this.updateConfigFile(jsConfigPath, jsConfigContent); // no workspace reference yet, that comes in update config file + } } break; } diff --git a/packages/lwc-language-server/package.json b/packages/lwc-language-server/package.json index f17c6440..9abede89 100644 --- a/packages/lwc-language-server/package.json +++ b/packages/lwc-language-server/package.json @@ -1,6 +1,6 @@ { "name": "@salesforce/lwc-language-server", - "version": "4.7.2", + "version": "4.7.4", "description": "Language server for Lightning Web Components.", "main": "lib/indexer.js", "license": "BSD-3-Clause", @@ -34,7 +34,7 @@ "@lwc/template-compiler": "2.50.0", "@salesforce/apex": "0.0.12", "@salesforce/label": "0.0.12", - "@salesforce/lightning-lsp-common": "4.7.2", + "@salesforce/lightning-lsp-common": "4.7.4", "@salesforce/resourceurl": "0.0.12", "@salesforce/schema": "0.0.12", "@salesforce/user": "0.0.12", @@ -60,7 +60,7 @@ "@types/fs-extra": "^5.0.4", "@types/glob": "^7.1.3", "@types/jest": "^29.5.0", - "@types/node": "^16.0.0", + "@types/node": "^18.11.0", "@types/normalize-path": "^3.0.0", "@types/xml2js": "^0.4.5", "babel-types": "^6.26.0", diff --git a/yarn.lock b/yarn.lock index 9da29979..81405eb2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2994,10 +2994,12 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.7.tgz#1628e6461ba8cc9b53196dfeaeec7b07fa6eea99" integrity sha512-Uo4chgKbnPNlxQwoFmYIwctkQVkMMmsAoGGU4JKwLuvBefF0pCq4FybNSnfkfRCpC7ZW7kttcC/TrRtAJsvGtg== -"@types/node@^16.0.0": - version "16.18.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.3.tgz#d7f7ba828ad9e540270f01ce00d391c54e6e0abc" - integrity sha512-jh6m0QUhIRcZpNv7Z/rpN+ZWXOicUUQbSoWks7Htkbb9IjFQj4kzcX/xFCkjstCj5flMsN8FiSvt+q+Tcs4Llg== +"@types/node@^18.11.0": + version "18.18.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.13.tgz#ae0f76c0bfe79d8fad0f910b78ae3e59b333c6e8" + integrity sha512-vXYZGRrSCreZmq1rEjMRLXJhiy8MrIeVasx+PCVlP414N7CJLHnMf+juVvjdprHyH+XRy3zKZLHeNueOpJCn0g== + dependencies: + undici-types "~5.26.4" "@types/node@^6.0.46": version "6.14.13" @@ -11713,6 +11715,11 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"