Skip to content

Commit 7cfb218

Browse files
Make ensureDirectoryExists sync
1 parent 727e5f8 commit 7cfb218

File tree

10 files changed

+18
-18
lines changed

10 files changed

+18
-18
lines changed

lib/commands/test-init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TestInitCommand implements ICommand {
4646
shouldCreateSampleTests = false;
4747
}
4848

49-
this.$fs.ensureDirectoryExists(testsDir).wait();
49+
this.$fs.ensureDirectoryExists(testsDir);
5050

5151
let karmaConfTemplate = this.$resources.readText('test/karma.conf.js').wait();
5252
let karmaConf = _.template(karmaConfTemplate)({

lib/services/android-project-service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
104104
this.$errors.failWithoutHelp(`The NativeScript CLI requires Android runtime ${AndroidProjectService.MIN_RUNTIME_VERSION_WITH_GRADLE} or later to work properly.`);
105105
}
106106

107-
this.$fs.ensureDirectoryExists(this.platformData.projectRoot).wait();
107+
this.$fs.ensureDirectoryExists(this.platformData.projectRoot);
108108
this.$androidToolsInfo.validateInfo({ showWarningsAsErrors: true, validateTargetSdk: true }).wait();
109109
let androidToolsInfo = this.$androidToolsInfo.getToolsInfo().wait();
110110
let targetSdkVersion = androidToolsInfo.targetSdkVersion;
@@ -346,15 +346,15 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
346346
private processResourcesFromPlugin(pluginData: IPluginData, pluginPlatformsFolderPath: string): IFuture<void> {
347347
return (() => {
348348
let configurationsDirectoryPath = path.join(this.platformData.projectRoot, "configurations");
349-
this.$fs.ensureDirectoryExists(configurationsDirectoryPath).wait();
349+
this.$fs.ensureDirectoryExists(configurationsDirectoryPath);
350350

351351
let pluginConfigurationDirectoryPath = path.join(configurationsDirectoryPath, pluginData.name);
352352
if (this.$fs.exists(pluginPlatformsFolderPath)) {
353-
this.$fs.ensureDirectoryExists(pluginConfigurationDirectoryPath).wait();
353+
this.$fs.ensureDirectoryExists(pluginConfigurationDirectoryPath);
354354

355355
// Copy all resources from plugin
356356
let resourcesDestinationDirectoryPath = path.join(this.platformData.projectRoot, "src", pluginData.name);
357-
this.$fs.ensureDirectoryExists(resourcesDestinationDirectoryPath).wait();
357+
this.$fs.ensureDirectoryExists(resourcesDestinationDirectoryPath);
358358
shell.cp("-Rf", path.join(pluginPlatformsFolderPath, "*"), resourcesDestinationDirectoryPath);
359359

360360
(this.$fs.enumerateFilesInDirectorySync(resourcesDestinationDirectoryPath, file => this.$fs.getFsStats(file).isDirectory() || path.extname(file) === constants.XML_FILE_EXTENSION) || [])

lib/services/ios-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
108108

109109
public createProject(frameworkDir: string, frameworkVersion: string, pathToTemplate?: string): IFuture<void> {
110110
return (() => {
111-
this.$fs.ensureDirectoryExists(path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)).wait();
111+
this.$fs.ensureDirectoryExists(path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER));
112112
if (pathToTemplate) {
113113
// Copy everything except the template from the runtime
114114
this.$fs.readDirectory(frameworkDir).wait()

lib/services/platform-service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class PlatformService implements IPlatformService {
4343
public addPlatforms(platforms: string[]): IFuture<void> {
4444
return (() => {
4545
let platformsDir = this.$projectData.platformsDir;
46-
this.$fs.ensureDirectoryExists(platformsDir).wait();
46+
this.$fs.ensureDirectoryExists(platformsDir);
4747

4848
_.each(platforms, platform => {
4949
this.addPlatform(platform.toLowerCase()).wait();
@@ -272,7 +272,7 @@ export class PlatformService implements IPlatformService {
272272
let appDestinationDirectoryPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
273273

274274
// Copy app folder to native project
275-
this.$fs.ensureDirectoryExists(appDestinationDirectoryPath).wait();
275+
this.$fs.ensureDirectoryExists(appDestinationDirectoryPath);
276276
let appSourceDirectoryPath = path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME);
277277

278278
const appUpdater = new AppFilesUpdater(appSourceDirectoryPath, appDestinationDirectoryPath, this.$options, this.$fs);
@@ -290,7 +290,7 @@ export class PlatformService implements IPlatformService {
290290
if (this.$fs.exists(appResourcesDirectoryPath)) {
291291
platformData.platformProjectService.prepareAppResources(appResourcesDirectoryPath).wait();
292292
let appResourcesDestination = platformData.platformProjectService.getAppResourcesDestinationDirectoryPath().wait();
293-
this.$fs.ensureDirectoryExists(appResourcesDestination).wait();
293+
this.$fs.ensureDirectoryExists(appResourcesDestination);
294294
shell.cp("-Rf", path.join(appResourcesDirectoryPath, platformData.normalizedPlatformName, "*"), appResourcesDestination);
295295
this.$fs.deleteDirectory(appResourcesDirectoryPath);
296296
}
@@ -385,7 +385,7 @@ export class PlatformService implements IPlatformService {
385385

386386
let packageFile = this.lastOutputPath(platform, settings);
387387

388-
this.$fs.ensureDirectoryExists(path.dirname(targetPath)).wait();
388+
this.$fs.ensureDirectoryExists(path.dirname(targetPath));
389389

390390
if (this.$fs.exists(targetPath) && this.$fs.getFsStats(targetPath).isDirectory()) {
391391
let sourceFileName = path.basename(packageFile);

lib/services/plugins-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export class PluginsService implements IPluginsService {
258258
private ensure(): IFuture<void> {
259259
return (() => {
260260
this.ensureAllDependenciesAreInstalled().wait();
261-
this.$fs.ensureDirectoryExists(this.nodeModulesPath).wait();
261+
this.$fs.ensureDirectoryExists(this.nodeModulesPath);
262262
}).future<void>()();
263263
}
264264

lib/services/project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class ProjectService implements IProjectService {
134134

135135
private createProjectCore(projectDir: string, appSourcePath: string, projectId: string): IFuture<void> {
136136
return (() => {
137-
this.$fs.ensureDirectoryExists(projectDir).wait();
137+
this.$fs.ensureDirectoryExists(projectDir);
138138

139139
let appDestinationPath = path.join(projectDir, constants.APP_FOLDER_NAME);
140140
this.$fs.createDirectory(appDestinationPath);

test/ios-project-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ describe("Static libraries support", () => {
421421

422422
it("checks validation of header files", () => {
423423
let iOSProjectService = testInjector.resolve("iOSProjectService");
424-
fs.ensureDirectoryExists(staticLibraryHeadersPath).wait();
424+
fs.ensureDirectoryExists(staticLibraryHeadersPath);
425425
_.each(headers, header => { fs.writeFile(path.join(staticLibraryHeadersPath, header), "").wait(); });
426426

427427
// Add all header files.
@@ -439,7 +439,7 @@ describe("Static libraries support", () => {
439439

440440
it("checks generation of modulemaps", () => {
441441
let iOSProjectService = testInjector.resolve("iOSProjectService");
442-
fs.ensureDirectoryExists(staticLibraryHeadersPath).wait();
442+
fs.ensureDirectoryExists(staticLibraryHeadersPath);
443443
_.each(headers, header => { fs.writeFile(path.join(staticLibraryHeadersPath, header), "").wait(); });
444444

445445
iOSProjectService.generateModulemap(staticLibraryHeadersPath, libraryName);

test/npm-support.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function setupProject(dependencies?: any): IFuture<any> {
128128

129129
// Creates platforms/android folder
130130
let androidFolderPath = path.join(projectFolder, "platforms", "android");
131-
fs.ensureDirectoryExists(androidFolderPath).wait();
131+
fs.ensureDirectoryExists(androidFolderPath);
132132

133133
// Mock platform data
134134
let appDestinationFolderPath = path.join(androidFolderPath, "assets");

test/plugins-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ describe("Plugins service", () => {
537537

538538
// Ensure the pluginDestinationPath folder exists
539539
let pluginPlatformsDirPath = path.join(projectFolder, "node_modules", pluginName, "platforms", "android");
540-
fs.ensureDirectoryExists(pluginPlatformsDirPath).wait();
540+
fs.ensureDirectoryExists(pluginPlatformsDirPath);
541541

542542
// Creates invalid plugin's AndroidManifest.xml file
543543
let xml = '<?xml version="1.0" encoding="UTF-8"?>' +

test/stubs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ export class FileSystemStub implements IFileSystem {
130130
return Future.fromResult(true);
131131
}
132132

133-
ensureDirectoryExists(directoryPath: string): IFuture<void> {
134-
return Future.fromResult();
133+
ensureDirectoryExists(directoryPath: string): void {
134+
return undefined;
135135
}
136136

137137
rename(oldPath: string, newPath: string): IFuture<void> {

0 commit comments

Comments
 (0)