Skip to content

Commit 7c2355a

Browse files
Make createDirectory sync (use mkdirp.sync)
1 parent 9a9d1ad commit 7c2355a

File tree

11 files changed

+29
-26
lines changed

11 files changed

+29
-26
lines changed

lib/services/android-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
113113

114114
if (pathToTemplate) {
115115
let mainPath = path.join(this.platformData.projectRoot, "src", "main");
116-
this.$fs.createDirectory(mainPath).wait();
116+
this.$fs.createDirectory(mainPath);
117117
shell.cp("-R", path.join(path.resolve(pathToTemplate), "*"), mainPath);
118118
} else {
119119
this.copy(this.platformData.projectRoot, frameworkDir, "src", "-R");

lib/services/app-files-updater.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import * as path from "path";
22
import * as minimatch from "minimatch";
33
import * as constants from "../constants";
4+
<<<<<<< HEAD
45
import * as fs from "fs";
56
import Future = require("fibers/future");
7+
=======
8+
>>>>>>> Make createDirectory sync (use mkdirp.sync)
69

710
export class AppFilesUpdater {
811
constructor(
@@ -76,7 +79,7 @@ export class AppFilesUpdater {
7679
}
7780

7881
protected copyAppSourceFiles(sourceFiles: string[]): void {
79-
let copyFileFutures = sourceFiles.map(source => {
82+
sourceFiles.map(source => {
8083
let destinationPath = path.join(this.appDestinationDirectoryPath, path.relative(this.appSourceDirectoryPath, source));
8184

8285
let exists = fs.lstatSync(source);
@@ -87,8 +90,8 @@ export class AppFilesUpdater {
8790
if (exists.isDirectory()) {
8891
return this.fs.createDirectory(destinationPath);
8992
}
90-
return this.fs.copyFile(source, destinationPath);
93+
94+
return this.fs.copyFile(source, destinationPath).wait();
9195
});
92-
Future.wait(copyFileFutures);
9396
}
9497
}

lib/services/ios-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
492492
</objects>
493493
</document>`;
494494
try {
495-
this.$fs.createDirectory(path.dirname(compatabilityXibPath)).wait();
495+
this.$fs.createDirectory(path.dirname(compatabilityXibPath));
496496
this.$fs.writeFile(compatabilityXibPath, content).wait();
497497
} catch (e) {
498498
this.$logger.warn("We have failed to add compatability LaunchScreen.xib due to: " + e);

lib/services/itmstransporter-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class ITMSTransporterService implements IITMSTransporterService {
4040
bundleId = this.getBundleIdentifier(data.ipaFilePath).wait(),
4141
iOSApplication = this.getiOSApplication(data.username, data.password, bundleId).wait();
4242

43-
this.$fs.createDirectory(innerDirectory).wait();
43+
this.$fs.createDirectory(innerDirectory);
4444

4545
this.$fs.copyFile(data.ipaFilePath, ipaFileLocation).wait();
4646

lib/services/project-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class ProjectService implements IProjectService {
2626
let projectId = this.$options.appid || this.$projectHelper.generateDefaultAppId(projectName, constants.DEFAULT_APP_IDENTIFIER_PREFIX);
2727

2828
let projectDir = path.join(path.resolve(this.$options.path || "."), projectName);
29-
this.$fs.createDirectory(projectDir).wait();
29+
this.$fs.createDirectory(projectDir);
3030
if(this.$fs.exists(projectDir) && !this.$fs.isEmptyDir(projectDir).wait()) {
3131
this.$errors.fail("Path already exists and is not empty %s", projectDir);
3232
}
@@ -137,13 +137,13 @@ export class ProjectService implements IProjectService {
137137
this.$fs.ensureDirectoryExists(projectDir).wait();
138138

139139
let appDestinationPath = path.join(projectDir, constants.APP_FOLDER_NAME);
140-
this.$fs.createDirectory(appDestinationPath).wait();
140+
this.$fs.createDirectory(appDestinationPath);
141141

142142
shelljs.cp('-R', path.join(appSourcePath, "*"), appDestinationPath);
143143
// Copy hidden files.
144144
shelljs.cp('-R', path.join(appSourcePath, ".*"), appDestinationPath);
145145

146-
this.$fs.createDirectory(path.join(projectDir, "platforms")).wait();
146+
this.$fs.createDirectory(path.join(projectDir, "platforms"));
147147

148148
let tnsModulesVersion = this.$options.tnsModulesVersion;
149149
let packageName = constants.TNS_CORE_MODULES_NAME;

lib/tools/node-modules/node-modules-dest-copy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class NpmPluginPrepare {
8080
_.values(dependencies).forEach(d => {
8181
prepareData[d.name] = true;
8282
});
83-
this.$fs.createDirectory(this.preparedPlatformsDir(platform)).wait();
83+
this.$fs.createDirectory(this.preparedPlatformsDir(platform));
8484
this.$fs.writeJson(this.preparedPlatformsFile(platform), prepareData, " ", "utf8").wait();
8585
}
8686

test/ios-project-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ describe("Cocoapods support", () => {
283283
fs.writeJson(path.join(projectPath, "package.json"), packageJsonData).wait();
284284

285285
let platformsFolderPath = path.join(projectPath, "platforms", "ios");
286-
fs.createDirectory(platformsFolderPath).wait();
286+
fs.createDirectory(platformsFolderPath);
287287

288288
let iOSProjectService = testInjector.resolve("iOSProjectService");
289289
iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
@@ -347,7 +347,7 @@ describe("Cocoapods support", () => {
347347
fs.writeJson(path.join(projectPath, "package.json"), packageJsonData).wait();
348348

349349
let platformsFolderPath = path.join(projectPath, "platforms", "ios");
350-
fs.createDirectory(platformsFolderPath).wait();
350+
fs.createDirectory(platformsFolderPath);
351351

352352
let iOSProjectService = testInjector.resolve("iOSProjectService");
353353
iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {

test/npm-support.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ function setupProject(dependencies?: any): IFuture<any> {
120120

121121
// Creates app folder
122122
let appFolderPath = path.join(projectFolder, "app");
123-
fs.createDirectory(appFolderPath).wait();
123+
fs.createDirectory(appFolderPath);
124124
let appResourcesFolderPath = path.join(appFolderPath, "App_Resources");
125-
fs.createDirectory(appResourcesFolderPath).wait();
126-
fs.createDirectory(path.join(appResourcesFolderPath, "Android")).wait();
127-
fs.createDirectory(path.join(appFolderPath, "tns_modules")).wait();
125+
fs.createDirectory(appResourcesFolderPath);
126+
fs.createDirectory(path.join(appResourcesFolderPath, "Android"));
127+
fs.createDirectory(path.join(appFolderPath, "tns_modules"));
128128

129129
// Creates platforms/android folder
130130
let androidFolderPath = path.join(projectFolder, "platforms", "android");

test/platform-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ describe('Platform Service Tests', () => {
211211
let tempFolder = temp.mkdirSync("prepare platform");
212212

213213
let appFolderPath = path.join(tempFolder, "app");
214-
fs.createDirectory(appFolderPath).wait();
214+
fs.createDirectory(appFolderPath);
215215

216216
let testsFolderPath = path.join(appFolderPath, "tests");
217-
fs.createDirectory(testsFolderPath).wait();
217+
fs.createDirectory(testsFolderPath);
218218

219219
let app1FolderPath = path.join(tempFolder, "app1");
220-
fs.createDirectory(app1FolderPath).wait();
220+
fs.createDirectory(app1FolderPath);
221221

222222
let appDestFolderPath = path.join(tempFolder, "appDest");
223223
let appResourcesFolderPath = path.join(appDestFolderPath, "App_Resources");

test/plugins-service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ function createAndroidManifestFile(projectFolder: string, fs: IFileSystem): void
181181
</application>
182182
</manifest>`;
183183

184-
fs.createDirectory(path.join(projectFolder, "platforms")).wait();
185-
fs.createDirectory(path.join(projectFolder, "platforms", "android")).wait();
184+
fs.createDirectory(path.join(projectFolder, "platforms"));
185+
fs.createDirectory(path.join(projectFolder, "platforms", "android"));
186186
fs.writeFile(path.join(projectFolder, "platforms", "android", "AndroidManifest.xml"), manifest).wait();
187187
}
188188

@@ -253,9 +253,9 @@ describe("Plugins service", () => {
253253
fs.writeJson(path.join(pluginFolderPath, "package.json"), pluginJsonData).wait();
254254

255255
// Adds android platform
256-
fs.createDirectory(path.join(projectFolder, "platforms")).wait();
257-
fs.createDirectory(path.join(projectFolder, "platforms", "android")).wait();
258-
fs.createDirectory(path.join(projectFolder, "platforms", "android", "app")).wait();
256+
fs.createDirectory(path.join(projectFolder, "platforms"));
257+
fs.createDirectory(path.join(projectFolder, "platforms", "android"));
258+
fs.createDirectory(path.join(projectFolder, "platforms", "android", "app"));
259259

260260
// Mock logger.warn
261261
let logger = testInjector.resolve("logger");

0 commit comments

Comments
 (0)