From cdf912ecdbd01c34ab405df2e9e39268f982d71f Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Tue, 27 Jul 2021 10:42:12 +0200 Subject: [PATCH 1/7] feat: `config` option to set custom `nativescript.config` file name (relative, absolute, with or without .ts or .js) read `ignoredNativeDependencies` from `nativescript.config``nativescript.config` --- docs/man_pages/start.md | 1 + lib/declarations.d.ts | 2 +- lib/definitions/project.d.ts | 1 + lib/options.ts | 1 + lib/project-data.ts | 2 ++ lib/services/project-config-service.ts | 37 ++++++++++++++++++++------ test/options.ts | 18 +++++++++++++ 7 files changed, 53 insertions(+), 9 deletions(-) diff --git a/docs/man_pages/start.md b/docs/man_pages/start.md index b051aac65d..e1527b21ae 100644 --- a/docs/man_pages/start.md +++ b/docs/man_pages/start.md @@ -75,5 +75,6 @@ Option | Description -------|--------- --help, -h, /? | Prints help about the selected command in the console. --path `` | Specifies the directory that contains the project. If not set, the project is searched for in the current directory and all directories above it. +--config | Specifies the name of the Nativescript configuration file to load (relative to the project directory). The default is. --version | Prints the client version. --log trace | Prints a detailed diagnostic log for the execution of the current command. diff --git a/lib/declarations.d.ts b/lib/declarations.d.ts index 67aeacc1af..e9c7bc40ff 100644 --- a/lib/declarations.d.ts +++ b/lib/declarations.d.ts @@ -616,10 +616,10 @@ interface IOptions /** * Project Configuration */ - config: string[]; log: string; verbose: boolean; path: string; + config: string; version: boolean; help: boolean; json: boolean; diff --git a/lib/definitions/project.d.ts b/lib/definitions/project.d.ts index 186d77734b..a7467b90eb 100644 --- a/lib/definitions/project.d.ts +++ b/lib/definitions/project.d.ts @@ -145,6 +145,7 @@ interface INsConfig { webpackConfigPath?: string; ios?: INsConfigIOS; android?: INsConfigAndroid; + ignoredNativeDependencies?: string[]; } interface IProjectData extends ICreateProjectData { diff --git a/lib/options.ts b/lib/options.ts index 2c7fdee082..39294f21a5 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -30,6 +30,7 @@ export class Options { profileDir: { type: OptionType.String, hasSensitiveValue: true }, analyticsClient: { type: OptionType.String, hasSensitiveValue: false }, path: { type: OptionType.String, alias: "p", hasSensitiveValue: true }, + config: { type: OptionType.String, alias: "c", hasSensitiveValue: true }, // This will parse all non-hyphenated values as strings. _: { type: OptionType.String, hasSensitiveValue: false }, }; diff --git a/lib/project-data.ts b/lib/project-data.ts index b72a9c6b32..15dda32e4a 100644 --- a/lib/project-data.ts +++ b/lib/project-data.ts @@ -88,6 +88,7 @@ export class ProjectData implements IProjectData { public appResourcesDirectoryPath: string; public dependencies: any; public devDependencies: IStringDictionary; + public ignoredDependencies: string[]; public projectType: string; public androidManifestPath: string; public infoPlistPath: string; @@ -172,6 +173,7 @@ export class ProjectData implements IProjectData { this.devDependencies = packageJsonData.devDependencies; this.projectType = this.getProjectType(); this.nsConfig = nsConfig; + this.ignoredDependencies = nsConfig.ignoredNativeDependencies; this.appDirectoryPath = this.getAppDirectoryPath(); this.appResourcesDirectoryPath = this.getAppResourcesDirectoryPath(); this.androidManifestPath = this.getPathToAndroidManifest( diff --git a/lib/services/project-config-service.ts b/lib/services/project-config-service.ts index b44aa0b8bd..620e332464 100644 --- a/lib/services/project-config-service.ts +++ b/lib/services/project-config-service.ts @@ -31,6 +31,7 @@ import { cache, exported } from "../common/decorators"; import { IOptions } from "../declarations"; import semver = require("semver/preload"); import { ICleanupService } from "../definitions/cleanup-service"; +import * as FsLib from "../../lib/common/file-system"; export class ProjectConfigService implements IProjectConfigService { private forceUsingNewConfig: boolean = false; @@ -94,18 +95,38 @@ export default { } public detectProjectConfigs(projectDir?: string): IProjectConfigInformation { - const JSConfigPath = path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_FILE_NAME_JS - ); - const TSConfigPath = path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_FILE_NAME_TS - ); + let JSConfigPath; + let TSConfigPath; + const configFilename = this.$options.config; + if (configFilename) { + const fullPath = this.$fs.isRelativePath(configFilename) ? path.join( + projectDir || this.projectHelper.projectDir, + configFilename + ) : configFilename; + if (configFilename.endsWith('.ts')) { + TSConfigPath = fullPath; + } else if (configFilename.endsWith('.js')) { + JSConfigPath = fullPath; + } else { + // the user might have passed the name without extension + TSConfigPath = fullPath + '.ts'; + JSConfigPath =fullPath + '.js'; + } + } else { + JSConfigPath = path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_FILE_NAME_JS + ); + TSConfigPath = path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_FILE_NAME_TS + ); + } const NSConfigPath = path.join( projectDir || this.projectHelper.projectDir, CONFIG_NS_FILE_NAME ); + const hasTSConfig = this.$fs.exists(TSConfigPath); const hasJSConfig = this.$fs.exists(JSConfigPath); diff --git a/test/options.ts b/test/options.ts index fa3dfb6d6d..e5c5f5e8a5 100644 --- a/test/options.ts +++ b/test/options.ts @@ -107,6 +107,24 @@ describe("options", () => { assert.isTrue(isExecutionStopped); }); + it("does not break execution when valid option has correct value", () => { + process.argv.push("--config"); + process.argv.push("SomeFilename"); + const options = createOptions(testInjector); + options.validateOptions(); + process.argv.pop(); + process.argv.pop(); + assert.isFalse(isExecutionStopped); + }); + + it("breaks execution when valid option has empty string value", () => { + process.argv.push("--config"); + const options = createOptions(testInjector); + options.validateOptions(); + process.argv.pop(); + assert.isTrue(isExecutionStopped); + }); + it("breaks execution when valid option has value with spaces only", () => { process.argv.push("--path"); process.argv.push(" "); From 3ea7c7e39302f98a352cc8e6a70a836b702c4194 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Sun, 8 Aug 2021 15:02:07 +0200 Subject: [PATCH 2/7] chore: cleanup --- docs/man_pages/start.md | 2 +- lib/project-data.ts | 2 +- lib/services/project-config-service.ts | 22 ++++++++++------------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/man_pages/start.md b/docs/man_pages/start.md index e1527b21ae..22e9b7d004 100644 --- a/docs/man_pages/start.md +++ b/docs/man_pages/start.md @@ -75,6 +75,6 @@ Option | Description -------|--------- --help, -h, /? | Prints help about the selected command in the console. --path `` | Specifies the directory that contains the project. If not set, the project is searched for in the current directory and all directories above it. ---config | Specifies the name of the Nativescript configuration file to load (relative to the project directory). The default is. +--config | Specifies the name of the Nativescript configuration file to load (relative to the project directory). The default is `nativescript.config.ts` or `nativescript.config.js` (as a fallback). --version | Prints the client version. --log trace | Prints a detailed diagnostic log for the execution of the current command. diff --git a/lib/project-data.ts b/lib/project-data.ts index 15dda32e4a..1916e58fee 100644 --- a/lib/project-data.ts +++ b/lib/project-data.ts @@ -173,7 +173,7 @@ export class ProjectData implements IProjectData { this.devDependencies = packageJsonData.devDependencies; this.projectType = this.getProjectType(); this.nsConfig = nsConfig; - this.ignoredDependencies = nsConfig.ignoredNativeDependencies; + this.ignoredDependencies = nsConfig?.ignoredNativeDependencies; this.appDirectoryPath = this.getAppDirectoryPath(); this.appResourcesDirectoryPath = this.getAppResourcesDirectoryPath(); this.androidManifestPath = this.getPathToAndroidManifest( diff --git a/lib/services/project-config-service.ts b/lib/services/project-config-service.ts index 620e332464..882ae8b266 100644 --- a/lib/services/project-config-service.ts +++ b/lib/services/project-config-service.ts @@ -31,7 +31,6 @@ import { cache, exported } from "../common/decorators"; import { IOptions } from "../declarations"; import semver = require("semver/preload"); import { ICleanupService } from "../definitions/cleanup-service"; -import * as FsLib from "../../lib/common/file-system"; export class ProjectConfigService implements IProjectConfigService { private forceUsingNewConfig: boolean = false; @@ -98,26 +97,26 @@ export default { let JSConfigPath; let TSConfigPath; const configFilename = this.$options.config; + // allow overriding config name with --config (or -c) if (configFilename) { - const fullPath = this.$fs.isRelativePath(configFilename) ? path.join( - projectDir || this.projectHelper.projectDir, - configFilename - ) : configFilename; - if (configFilename.endsWith('.ts')) { + const fullPath = this.$fs.isRelativePath(configFilename) + ? path.join(projectDir || this.projectHelper.projectDir, configFilename) + : configFilename; + if (configFilename.endsWith(".ts")) { TSConfigPath = fullPath; - } else if (configFilename.endsWith('.js')) { + } else if (configFilename.endsWith(".js")) { JSConfigPath = fullPath; } else { // the user might have passed the name without extension - TSConfigPath = fullPath + '.ts'; - JSConfigPath =fullPath + '.js'; + TSConfigPath = fullPath + ".ts"; + JSConfigPath = fullPath + ".js"; } } else { - JSConfigPath = path.join( + JSConfigPath = path.join( projectDir || this.projectHelper.projectDir, CONFIG_FILE_NAME_JS ); - TSConfigPath = path.join( + TSConfigPath = path.join( projectDir || this.projectHelper.projectDir, CONFIG_FILE_NAME_TS ); @@ -126,7 +125,6 @@ export default { projectDir || this.projectHelper.projectDir, CONFIG_NS_FILE_NAME ); - const hasTSConfig = this.$fs.exists(TSConfigPath); const hasJSConfig = this.$fs.exists(JSConfigPath); From d6f2ad1f3bc3d196634ab23ff040dcac6031c08c Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Sun, 8 Aug 2021 15:53:43 +0200 Subject: [PATCH 3/7] fix: edge cases/refactor config lookup code add more tests --- lib/services/project-config-service.ts | 75 +++++++++++++++--------- test/services/project-config-service.ts | 78 +++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 28 deletions(-) diff --git a/lib/services/project-config-service.ts b/lib/services/project-config-service.ts index 882ae8b266..319f8e0cae 100644 --- a/lib/services/project-config-service.ts +++ b/lib/services/project-config-service.ts @@ -94,43 +94,62 @@ export default { } public detectProjectConfigs(projectDir?: string): IProjectConfigInformation { - let JSConfigPath; - let TSConfigPath; - const configFilename = this.$options.config; + const possibleTSConfigPaths = [ + path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_FILE_NAME_TS + ), + ]; + const possibleJSConfigPaths = [ + path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_FILE_NAME_JS + ), + ]; + const possibleNSConfigPaths = [ + path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_NS_FILE_NAME + ), + ]; + // allow overriding config name with --config (or -c) + const configFilename = this.$options.config; if (configFilename) { const fullPath = this.$fs.isRelativePath(configFilename) ? path.join(projectDir || this.projectHelper.projectDir, configFilename) : configFilename; - if (configFilename.endsWith(".ts")) { - TSConfigPath = fullPath; - } else if (configFilename.endsWith(".js")) { - JSConfigPath = fullPath; - } else { - // the user might have passed the name without extension - TSConfigPath = fullPath + ".ts"; - JSConfigPath = fullPath + ".js"; - } - } else { - JSConfigPath = path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_FILE_NAME_JS - ); - TSConfigPath = path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_FILE_NAME_TS - ); + + possibleTSConfigPaths.unshift(fullPath, `${fullPath}.ts`); + possibleJSConfigPaths.unshift(fullPath, `${fullPath}.js`); + possibleNSConfigPaths.unshift(fullPath, `${fullPath}.json`); } - const NSConfigPath = path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_NS_FILE_NAME - ); - const hasTSConfig = this.$fs.exists(TSConfigPath); - const hasJSConfig = this.$fs.exists(JSConfigPath); - const hasNSConfig = this.$fs.exists(NSConfigPath); + const TSConfigPath = possibleTSConfigPaths + .filter(Boolean) + .find((path) => this.$fs.exists(path)); + const JSConfigPath = possibleJSConfigPaths + .filter(Boolean) + .find((path) => this.$fs.exists(path)); + const NSConfigPath = possibleNSConfigPaths + .filter(Boolean) + .find((path) => this.$fs.exists(path)); + + const hasTSConfig = TSConfigPath && this.$fs.exists(TSConfigPath); + const hasJSConfig = JSConfigPath && this.$fs.exists(JSConfigPath); + const hasNSConfig = NSConfigPath && this.$fs.exists(NSConfigPath); const usingNSConfig = !(hasTSConfig || hasJSConfig); + console.log({ + hasTSConfig, + hasJSConfig, + hasNSConfig, + usingNSConfig, + TSConfigPath, + JSConfigPath, + NSConfigPath, + }); + if (hasTSConfig && hasJSConfig) { this.$logger.warn( `You have both a ${CONFIG_FILE_NAME_JS} and ${CONFIG_FILE_NAME_TS} file. Defaulting to ${CONFIG_FILE_NAME_TS}.` diff --git a/test/services/project-config-service.ts b/test/services/project-config-service.ts index 5bb7f775ce..d4e3d09b19 100644 --- a/test/services/project-config-service.ts +++ b/test/services/project-config-service.ts @@ -45,6 +45,8 @@ const createTestInjector = ( readJson: (filePath: string): any => null, + isRelativePath: (filePath: string): any => true, + enumerateFilesInDirectorySync: ( directoryPath: string, filterCallback?: (_file: string, _stat: IFsStats) => boolean, @@ -141,6 +143,82 @@ describe("projectConfigService", () => { assert.deepStrictEqual(actualValue, "--expose-gc"); }); + it("can read a named JS config file when passing --config", async () => { + const testInjector = createTestInjector( + (filename) => sampleJSConfig, + (filePath) => basename(filePath) === "custom.config.js" + ); + + // mock "--config custom.config.js" + const options: Options = testInjector.resolve("options") as Options; + // @ts-ignore + options.config = "custom.config.js"; + + const projectConfigService: IProjectConfigService = testInjector.resolve( + "projectConfigService" + ); + + const actualValue = projectConfigService.getValue("id"); + assert.deepStrictEqual(actualValue, "io.test.app"); + }); + + it("can read a named TS config file when passing --config", async () => { + const testInjector = createTestInjector( + (filename) => sampleTSConfig, + (filePath) => basename(filePath) === "custom.config.ts" + ); + + // mock "--config custom.config.ts" + const options: Options = testInjector.resolve("options") as Options; + // @ts-ignore + options.config = "custom.config.ts"; + + const projectConfigService: IProjectConfigService = testInjector.resolve( + "projectConfigService" + ); + + const actualValue = projectConfigService.getValue("id"); + assert.deepStrictEqual(actualValue, "io.test.app"); + }); + + it("can read a named JS config file when passing --config without extension", async () => { + const testInjector = createTestInjector( + (filename) => sampleJSConfig, + (filePath) => basename(filePath) === "custom.config.js" + ); + + // mock "--config custom.config" + const options: Options = testInjector.resolve("options") as Options; + // @ts-ignore + options.config = "custom.config"; + + const projectConfigService: IProjectConfigService = testInjector.resolve( + "projectConfigService" + ); + + const actualValue = projectConfigService.getValue("id"); + assert.deepStrictEqual(actualValue, "io.test.app"); + }); + + it("can read a named TS config file when passing --config without extension", async () => { + const testInjector = createTestInjector( + (filename) => sampleTSConfig, + (filePath) => basename(filePath) === "custom.config.ts" + ); + + // mock "--config custom.config" + const options: Options = testInjector.resolve("options") as Options; + // @ts-ignore + options.config = "custom.config"; + + const projectConfigService: IProjectConfigService = testInjector.resolve( + "projectConfigService" + ); + + const actualValue = projectConfigService.getValue("id"); + assert.deepStrictEqual(actualValue, "io.test.app"); + }); + // it("Throws error if no config file found", () => { // const testInjector = createTestInjector( // (filename) => null, From 79c95f6d32cb35095c1e85d83f0387f0dccf4e5b Mon Sep 17 00:00:00 2001 From: rigor789 Date: Mon, 9 Aug 2021 15:55:05 +0200 Subject: [PATCH 4/7] fix: use env variables to explicitly set config --- lib/services/project-config-service.ts | 5 +++-- lib/services/webpack/webpack-compiler-service.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/services/project-config-service.ts b/lib/services/project-config-service.ts index 319f8e0cae..e6a5ea1a57 100644 --- a/lib/services/project-config-service.ts +++ b/lib/services/project-config-service.ts @@ -113,8 +113,9 @@ export default { ), ]; - // allow overriding config name with --config (or -c) - const configFilename = this.$options.config; + // allow overriding config name with env variable or --config (or -c) + const configFilename = + process.env.NATIVESCRIPT_CONFIG_NAME ?? this.$options.config; if (configFilename) { const fullPath = this.$fs.isRelativePath(configFilename) ? path.join(projectDir || this.projectHelper.projectDir, configFilename) diff --git a/lib/services/webpack/webpack-compiler-service.ts b/lib/services/webpack/webpack-compiler-service.ts index 2161e071e9..91cc5e2ea5 100644 --- a/lib/services/webpack/webpack-compiler-service.ts +++ b/lib/services/webpack/webpack-compiler-service.ts @@ -13,6 +13,7 @@ import { import { IPackageManager, IPackageInstallationManager, + IOptions, } from "../../declarations"; import { IPlatformData } from "../../definitions/platform"; import { IProjectData } from "../../definitions/project"; @@ -48,6 +49,7 @@ export class WebpackCompilerService private expectedHashes: IStringDictionary = {}; constructor( + private $options: IOptions, private $errors: IErrors, private $childProcess: IChildProcess, public $fs: IFileSystem, @@ -368,6 +370,13 @@ export class WebpackCompilerService envData.verbose = envData.verbose || this.$logger.isVerbose(); envData.production = envData.production || prepareData.release; + + // add the config file name to the env data so the webpack process can read the + // correct config file when resolving the CLI lib and the config service + // we are explicityly setting it to false to force using the defaults + envData.config = + process.env.NATIVESCRIPT_CONFIG_NAME ?? this.$options.config ?? "false"; + // The snapshot generation is wrongly located in the Webpack plugin. // It should be moved in the Native Prepare of the CLI or a Gradle task in the Runtime. // As a workaround, we skip the mksnapshot, xxd and android-ndk calls based on skipNativePrepare. From 411b2f1e05d011cb6595fc3d6a13a2f239944e0c Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Wed, 11 Aug 2021 13:01:10 +0200 Subject: [PATCH 5/7] fix: correctly look up config files --- lib/services/project-config-service.ts | 134 ++++++++++++++++++------- 1 file changed, 95 insertions(+), 39 deletions(-) diff --git a/lib/services/project-config-service.ts b/lib/services/project-config-service.ts index e6a5ea1a57..65561ef752 100644 --- a/lib/services/project-config-service.ts +++ b/lib/services/project-config-service.ts @@ -93,25 +93,51 @@ export default { ); } + private getConfigPathsFromPossiblePaths(paths: { + [key: string]: string[]; + }): any { + const { + possibleTSConfigPaths, + possibleJSConfigPaths, + possibleNSConfigPaths, + } = paths; + + let TSConfigPath; + let JSConfigPath; + let NSConfigPath; + + // look up a ts config first + TSConfigPath = possibleTSConfigPaths + .filter(Boolean) + .find((path) => this.$fs.exists(path)); + + // if not found, look up a JS config + if (!TSConfigPath) { + JSConfigPath = possibleJSConfigPaths + .filter(Boolean) + .find((path) => this.$fs.exists(path)); + } + + // lastly look for nsconfig/json config + if (!TSConfigPath && !JSConfigPath) { + NSConfigPath = possibleNSConfigPaths + .filter(Boolean) + .find((path) => this.$fs.exists(path)); + } + + return { + TSConfigPath, + JSConfigPath, + NSConfigPath, + found: TSConfigPath || JSConfigPath || NSConfigPath, + }; + } + public detectProjectConfigs(projectDir?: string): IProjectConfigInformation { - const possibleTSConfigPaths = [ - path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_FILE_NAME_TS - ), - ]; - const possibleJSConfigPaths = [ - path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_FILE_NAME_JS - ), - ]; - const possibleNSConfigPaths = [ - path.join( - projectDir || this.projectHelper.projectDir, - CONFIG_NS_FILE_NAME - ), - ]; + const possibleTSConfigPaths = []; + const possibleJSConfigPaths = []; + const possibleNSConfigPaths = []; + let paths; // allow overriding config name with env variable or --config (or -c) const configFilename = @@ -121,24 +147,54 @@ export default { ? path.join(projectDir || this.projectHelper.projectDir, configFilename) : configFilename; - possibleTSConfigPaths.unshift(fullPath, `${fullPath}.ts`); - possibleJSConfigPaths.unshift(fullPath, `${fullPath}.js`); - possibleNSConfigPaths.unshift(fullPath, `${fullPath}.json`); + possibleTSConfigPaths.unshift( + fullPath.endsWith(".ts") ? fullPath : `${fullPath}.ts` + ); + possibleJSConfigPaths.unshift( + fullPath.endsWith(".js") ? fullPath : `${fullPath}.js` + ); + possibleNSConfigPaths.unshift( + fullPath.endsWith(".json") ? fullPath : `${fullPath}.json` + ); + + paths = this.getConfigPathsFromPossiblePaths({ + possibleTSConfigPaths, + possibleJSConfigPaths, + possibleNSConfigPaths, + }); } - const TSConfigPath = possibleTSConfigPaths - .filter(Boolean) - .find((path) => this.$fs.exists(path)); - const JSConfigPath = possibleJSConfigPaths - .filter(Boolean) - .find((path) => this.$fs.exists(path)); - const NSConfigPath = possibleNSConfigPaths - .filter(Boolean) - .find((path) => this.$fs.exists(path)); + // look up default paths if no path found yet + if (!paths?.found) { + possibleTSConfigPaths.push( + path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_FILE_NAME_TS + ) + ); + possibleJSConfigPaths.push( + path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_FILE_NAME_JS + ) + ); + possibleNSConfigPaths.push( + path.join( + projectDir || this.projectHelper.projectDir, + CONFIG_NS_FILE_NAME + ) + ); - const hasTSConfig = TSConfigPath && this.$fs.exists(TSConfigPath); - const hasJSConfig = JSConfigPath && this.$fs.exists(JSConfigPath); - const hasNSConfig = NSConfigPath && this.$fs.exists(NSConfigPath); + paths = this.getConfigPathsFromPossiblePaths({ + possibleTSConfigPaths, + possibleJSConfigPaths, + possibleNSConfigPaths, + }); + } + + const hasTSConfig = !!paths.TSConfigPath; + const hasJSConfig = !!paths.JSConfigPath; + const hasNSConfig = !!paths.NSConfigPath; const usingNSConfig = !(hasTSConfig || hasJSConfig); console.log({ @@ -146,9 +202,9 @@ export default { hasJSConfig, hasNSConfig, usingNSConfig, - TSConfigPath, - JSConfigPath, - NSConfigPath, + TSConfigPath: paths.TSConfigPath, + JSConfigPath: paths.JSConfigPath, + NSConfigPath: paths.NSConfigPath, }); if (hasTSConfig && hasJSConfig) { @@ -162,9 +218,9 @@ export default { hasJSConfig, hasNSConfig, usingNSConfig, - TSConfigPath, - JSConfigPath, - NSConfigPath, + TSConfigPath: paths.TSConfigPath, + JSConfigPath: paths.JSConfigPath, + NSConfigPath: paths.NSConfigPath, }; } From 70e5f6860db385d0e66012c2ad2c68704f102c85 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Wed, 11 Aug 2021 13:02:32 +0200 Subject: [PATCH 6/7] chore: remove console.log --- lib/services/project-config-service.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/services/project-config-service.ts b/lib/services/project-config-service.ts index 65561ef752..6fd7829aed 100644 --- a/lib/services/project-config-service.ts +++ b/lib/services/project-config-service.ts @@ -197,16 +197,6 @@ export default { const hasNSConfig = !!paths.NSConfigPath; const usingNSConfig = !(hasTSConfig || hasJSConfig); - console.log({ - hasTSConfig, - hasJSConfig, - hasNSConfig, - usingNSConfig, - TSConfigPath: paths.TSConfigPath, - JSConfigPath: paths.JSConfigPath, - NSConfigPath: paths.NSConfigPath, - }); - if (hasTSConfig && hasJSConfig) { this.$logger.warn( `You have both a ${CONFIG_FILE_NAME_JS} and ${CONFIG_FILE_NAME_TS} file. Defaulting to ${CONFIG_FILE_NAME_TS}.` From f45031d447fe14eb57dd8a0301000fef560f1cc9 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Wed, 11 Aug 2021 13:06:37 +0200 Subject: [PATCH 7/7] test: fix missing injection --- test/services/webpack/webpack-compiler-service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/services/webpack/webpack-compiler-service.ts b/test/services/webpack/webpack-compiler-service.ts index cb48eacab5..d15cccc430 100644 --- a/test/services/webpack/webpack-compiler-service.ts +++ b/test/services/webpack/webpack-compiler-service.ts @@ -27,6 +27,7 @@ function createTestInjector(): IInjector { testInjector.register("childProcess", {}); testInjector.register("hooksService", {}); testInjector.register("hostInfo", {}); + testInjector.register("options", {}); testInjector.register("logger", {}); testInjector.register("errors", ErrorsStub); testInjector.register("packageInstallationManager", {});