Skip to content

Commit bf26f62

Browse files
authored
Merge pull request #1833 from NativeScript/util-format
util.format removed
2 parents fb0bb15 + 07c50a5 commit bf26f62

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/commands/test-init.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as path from 'path';
2-
import * as util from 'util';
32
import {TESTING_FRAMEWORKS} from '../constants';
43

54
class TestInitCommand implements ICommand {
@@ -58,7 +57,7 @@ class TestInitCommand implements ICommand {
5857

5958
this.$fs.writeFile(path.join(projectDir, 'karma.conf.js'), karmaConf).wait();
6059

61-
let exampleFilePath = this.$resources.resolvePath(util.format('test/example.%s.js', frameworkToInstall));
60+
let exampleFilePath = this.$resources.resolvePath(`test/example.${frameworkToInstall}.js`);
6261

6362
if (shouldCreateSampleTests && this.$fs.exists(exampleFilePath).wait()) {
6463
this.$fs.copyFile(exampleFilePath, path.join(testsDir, 'example.js')).wait();

lib/services/ios-project-service.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as path from "path";
22
import * as shell from "shelljs";
3-
import * as util from "util";
43
import * as os from "os";
54
import * as semver from "semver";
65
import * as xcode from "xcode";
@@ -104,7 +103,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
104103

105104
let splitedXcodeBuildVersion = xcodeBuildVersion.split(".");
106105
if (splitedXcodeBuildVersion.length === 3) {
107-
xcodeBuildVersion = util.format("%s.%s", splitedXcodeBuildVersion[0], splitedXcodeBuildVersion[1]);
106+
xcodeBuildVersion = `${splitedXcodeBuildVersion[0]}.${splitedXcodeBuildVersion[1]}`;
108107
}
109108

110109
if (helpers.versionCompare(xcodeBuildVersion, IOSProjectService.XCODEBUILD_MIN_VERSION) < 0) {
@@ -124,7 +123,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
124123
.forEach(dirName => shell.cp("-R", path.join(frameworkDir, dirName), this.platformData.projectRoot));
125124
shell.cp("-rf", path.join(pathToTemplate, "*"), this.platformData.projectRoot);
126125
} else if (this.$options.symlink) {
127-
let xcodeProjectName = util.format("%s.xcodeproj", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER);
126+
let xcodeProjectName = `${IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER}.xcodeproj`;
128127

129128
shell.cp("-R", path.join(frameworkDir, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, "*"), path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER));
130129
shell.cp("-R", path.join(frameworkDir, xcodeProjectName), this.platformData.projectRoot);
@@ -142,7 +141,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
142141

143142
public interpolateData(): IFuture<void> {
144143
return (() => {
145-
let infoPlistFilePath = path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, util.format("%s-%s", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, "Info.plist"));
144+
let infoPlistFilePath = path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, `${IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER}-Info.plist`);
146145
this.interpolateConfigurationFile(infoPlistFilePath).wait();
147146

148147
let projectRootFilePath = path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER);
@@ -439,7 +438,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
439438
this.$fs.deleteDirectory(sourceDir).wait();
440439

441440
// Copy xcodeProject file
442-
let cachedPackagePath = path.join(this.$npmInstallationManager.getCachedPackagePath(this.platformData.frameworkPackageName, newVersion), constants.PROJECT_FRAMEWORK_FOLDER_NAME, util.format("%s.xcodeproj", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER));
441+
let cachedPackagePath = path.join(this.$npmInstallationManager.getCachedPackagePath(this.platformData.frameworkPackageName, newVersion), constants.PROJECT_FRAMEWORK_FOLDER_NAME, `${IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER}.xcodeproj`);
443442
shell.cp("-R", path.join(cachedPackagePath, "*"), sourceDir);
444443
this.$logger.info(`Copied from ${cachedPackagePath} at ${this.platformData.projectRoot}.`);
445444

@@ -688,7 +687,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
688687
};
689688

690689
private buildPathToXcodeProjectFile(version: string): string {
691-
return path.join(this.$npmInstallationManager.getCachedPackagePath(this.platformData.frameworkPackageName, version), constants.PROJECT_FRAMEWORK_FOLDER_NAME, util.format("%s.xcodeproj", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER), "project.pbxproj");
690+
return path.join(this.$npmInstallationManager.getCachedPackagePath(this.platformData.frameworkPackageName, version), constants.PROJECT_FRAMEWORK_FOLDER_NAME, `${IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER}.xcodeproj`, "project.pbxproj");
692691
}
693692

694693
private validateFramework(libraryPath: string): IFuture<void> {

0 commit comments

Comments
 (0)