Skip to content

Commit 8e4634f

Browse files
chore: remove $projectConstants
Remove `$projectConstants` as it has been used in the past, but we no longer need it.
1 parent 87553a1 commit 8e4634f

File tree

8 files changed

+12
-91
lines changed

8 files changed

+12
-91
lines changed

lib/common/appbuilder/appbuilder-bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require("../bootstrap");
2-
$injector.require("projectConstants", "./appbuilder/project-constants");
32
$injector.require("projectFilesProvider", "./appbuilder/providers/project-files-provider");
43
$injector.require("pathFilteringService", "./appbuilder/services/path-filtering");
54
$injector.require("liveSyncServiceBase", "./services/livesync-service-base");

lib/common/appbuilder/declarations.d.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,6 @@ interface IDeployHelper {
33
}
44

55
declare module Project {
6-
interface IConstants {
7-
ADDITIONAL_FILES_DIRECTORY: string;
8-
ADDITIONAL_FILE_DISPOSITION: string;
9-
APPBUILDER_PROJECT_PLATFORMS_NAMES: IDictionary<string>;
10-
APPIDENTIFIER_PROPERTY_NAME: string;
11-
CORDOVA_PLUGIN_VARIABLES_PROPERTY_NAME: string;
12-
CORE_PLUGINS_PROPERTY_NAME: string;
13-
DEBUG_CONFIGURATION_NAME: string;
14-
DEBUG_PROJECT_FILE_NAME: string;
15-
EXPERIMENTAL_TAG: string;
16-
IMAGE_DEFINITIONS_FILE_NAME: string;
17-
IONIC_PROJECT_PLATFORMS_NAMES: IDictionary<string>;
18-
NATIVESCRIPT_APP_DIR_NAME: string;
19-
PACKAGE_JSON_NAME: string;
20-
PROJECT_FILE: string;
21-
PROJECT_IGNORE_FILE: string;
22-
BUILD_RESULT_DISPOSITION: string;
23-
REFERENCES_FILE_NAME: string;
24-
OLD_REFERENCES_FILE_NAME: string;
25-
RELEASE_CONFIGURATION_NAME: string;
26-
RELEASE_PROJECT_FILE_NAME: string;
27-
ANDROID_PLATFORM_NAME: string;
28-
IOS_PLATFORM_NAME: string;
29-
WP8_PLATFORM_NAME: string;
30-
TSCONFIG_JSON_NAME: string;
31-
}
32-
336
interface ICapabilities {
347
build: boolean;
358
buildCompanion: boolean;

lib/common/appbuilder/project-constants.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

lib/common/appbuilder/project/project-base.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export abstract class ProjectBase implements Project.IProjectBase {
1919
protected $logger: ILogger,
2020
protected $nativeScriptProjectCapabilities: Project.ICapabilities,
2121
protected $options: IOptions,
22-
protected $projectConstants: Project.IConstants,
2322
protected $staticConfig: Config.IStaticConfig) {
2423
this.configurationSpecificData = Object.create(null);
2524
}
@@ -80,7 +79,7 @@ export abstract class ProjectBase implements Project.IProjectBase {
8079
const projectDir = this.getProjectDir();
8180
this.setShouldSaveProject(false);
8281
if (projectDir) {
83-
const projectFilePath = path.join(projectDir, this.$projectConstants.PROJECT_FILE);
82+
const projectFilePath = projectDir;
8483
try {
8584
this.projectData = this.getProjectData(projectFilePath);
8685
this.validate();

lib/common/appbuilder/project/project.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ export class Project extends ProjectBase {
1010
protected $logger: ILogger,
1111
protected $nativeScriptProjectCapabilities: Project.ICapabilities,
1212
protected $options: IOptions,
13-
protected $projectConstants: Project.IConstants,
1413
protected $staticConfig: Config.IStaticConfig) {
15-
super($cordovaProjectCapabilities, $errors, $fs, $logger, $nativeScriptProjectCapabilities, $options, $projectConstants, $staticConfig);
14+
super($cordovaProjectCapabilities, $errors, $fs, $logger, $nativeScriptProjectCapabilities, $options, $staticConfig);
1615
}
1716

1817
protected validate(): void { /* Currently unused */ }

lib/common/appbuilder/providers/project-files-provider.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export class ProjectFilesProvider extends ProjectFilesProviderBase {
1515
}
1616

1717
constructor(private $pathFilteringService: IPathFilteringService,
18-
private $projectConstants: Project.IConstants,
1918
private $injector: IInjector,
2019
$mobileHelper: Mobile.IMobileHelper,
2120
$options: IOptions) {
@@ -44,11 +43,7 @@ export class ProjectFilesProvider extends ProjectFilesProviderBase {
4443

4544
private get ignoreFilesConfigurations(): string[] {
4645
const configurations: string[] = [ProjectFilesProvider.IGNORE_FILE];
47-
// unless release is explicitly set, we use debug config
48-
const configFileName = "." +
49-
(this.$options.release ? this.$projectConstants.RELEASE_CONFIGURATION_NAME : this.$projectConstants.DEBUG_CONFIGURATION_NAME) +
50-
ProjectFilesProvider.IGNORE_FILE;
51-
configurations.push(configFileName);
46+
5247
return configurations;
5348
}
5449
}

lib/common/appbuilder/services/npm-service.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export class NpmService implements INpmService {
2323
private $fs: IFileSystem,
2424
private $hostInfo: IHostInfo,
2525
private $httpClient: Server.IHttpClient,
26-
private $logger: ILogger,
27-
private $projectConstants: Project.IConstants) { }
26+
private $logger: ILogger) { }
2827

2928
private get npmExecutableName(): string {
3029
if (!this._npmExecutableName) {
@@ -225,20 +224,16 @@ export class NpmService implements INpmService {
225224
try {
226225
return this.$fs.readJson(pathToPackageJson);
227226
} catch (err) {
228-
if (err.code === "ENOENT") {
229-
this.$errors.failWithoutHelp(`Unable to find ${this.$projectConstants.PACKAGE_JSON_NAME} in ${projectDir}.`);
230-
}
231-
232227
throw err;
233228
}
234229
}
235230

236231
private getPathToPackageJson(projectDir: string): string {
237-
return path.join(projectDir, this.$projectConstants.PACKAGE_JSON_NAME);
232+
return path.join(projectDir, "package.json");
238233
}
239234

240235
private getPathToReferencesFile(projectDir: string): string {
241-
return path.join(projectDir, this.$projectConstants.REFERENCES_FILE_NAME);
236+
return path.join(projectDir, "references.d.ts");
242237
}
243238

244239
private async installTypingsForDependency(projectDir: string, dependency: string): Promise<ISpawnResult> {
@@ -284,13 +279,13 @@ export class NpmService implements INpmService {
284279
// TypeScript 2.0 does not respect hidden definition files and we had to rename the file.
285280
this.removeOldAbReferencesFile(projectDir);
286281
} else {
287-
this.$logger.trace(`Could not find any .d.ts files for ${this.$projectConstants.REFERENCES_FILE_NAME} file. Deleting the old file.`);
282+
this.$logger.trace(`Could not find any .d.ts files for "references.d.ts" file. Deleting the old file.`);
288283
this.$fs.deleteFile(pathToReferenceFile);
289284
}
290285
}
291286

292287
private removeOldAbReferencesFile(projectDir: string): void {
293-
const pathToOldReferencesFile = path.join(projectDir, this.$projectConstants.OLD_REFERENCES_FILE_NAME);
288+
const pathToOldReferencesFile = path.join(projectDir, ".references.d.ts");
294289

295290
if (this.$fs.exists(pathToOldReferencesFile)) {
296291
this.$fs.deleteFile(pathToOldReferencesFile);

lib/common/services/typescript-service.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export class TypeScriptService implements ITypeScriptService {
3232
private $logger: ILogger,
3333
private $npmService: INpmService,
3434
private $options: IOptions,
35-
private $projectConstants: Project.IConstants,
3635
private $processService: IProcessService,
3736
private $errors: IErrors) { }
3837

@@ -95,7 +94,7 @@ export class TypeScriptService implements ITypeScriptService {
9594
}
9695

9796
private getPathToTsConfigFile(projectDir: string): string {
98-
return path.join(projectDir, this.$projectConstants.TSCONFIG_JSON_NAME);
97+
return projectDir;
9998
}
10099

101100
private getCompilerOptions(projectDir: string, options: ITypeScriptTranspileOptions): ITypeScriptCompilerOptions {
@@ -140,7 +139,7 @@ export class TypeScriptService implements ITypeScriptService {
140139
const typeScriptInProjectsNodeModulesDir = path.join(projectDir, typeScriptInNodeModulesDir);
141140
let typeScriptCompilerVersion: string;
142141
if (this.$fs.exists(typeScriptInProjectsNodeModulesDir)) {
143-
typeScriptCompilerVersion = this.$fs.readJson(path.join(typeScriptInProjectsNodeModulesDir, this.$projectConstants.PACKAGE_JSON_NAME)).version;
142+
typeScriptCompilerVersion = this.$fs.readJson(path.join(typeScriptInProjectsNodeModulesDir, "package.json")).version;
144143
if (gte(typeScriptCompilerVersion, TypeScriptService.DEFAULT_TSC_VERSION)) {
145144
this.typeScriptModuleFilePath = typeScriptInProjectsNodeModulesDir;
146145
} else {
@@ -167,7 +166,7 @@ export class TypeScriptService implements ITypeScriptService {
167166
}
168167

169168
const typeScriptCompilerPath = path.join(this.typeScriptModuleFilePath, "lib", "tsc");
170-
typeScriptCompilerVersion = typeScriptCompilerVersion || this.$fs.readJson(path.join(this.typeScriptModuleFilePath, this.$projectConstants.PACKAGE_JSON_NAME)).version;
169+
typeScriptCompilerVersion = typeScriptCompilerVersion || this.$fs.readJson(path.join(this.typeScriptModuleFilePath, "package.json")).version;
171170

172171
return { pathToCompiler: typeScriptCompilerPath, version: typeScriptCompilerVersion };
173172
}
@@ -244,7 +243,7 @@ export class TypeScriptService implements ITypeScriptService {
244243

245244
private createTempDirectoryForTsc(): string {
246245
const tempDir = temp.mkdirSync(`typescript-compiler-${TypeScriptService.DEFAULT_TSC_VERSION}`);
247-
this.$fs.writeJson(path.join(tempDir, this.$projectConstants.PACKAGE_JSON_NAME), { name: "tsc-container", version: "1.0.0" });
246+
this.$fs.writeJson(path.join(tempDir, "package.json"), { name: "tsc-container", version: "1.0.0" });
248247
return tempDir;
249248
}
250249
}

0 commit comments

Comments
 (0)