Skip to content

Commit 59a27c5

Browse files
committed
updated error handling
1 parent 94146e4 commit 59a27c5

File tree

4 files changed

+2
-75
lines changed

4 files changed

+2
-75
lines changed

lib/node-package-manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class NodePackageManager implements INodePackageManager {
4343

4444
return diff;
4545
} catch (err) {
46-
if (err.code === "EPEERINVALID") {
46+
if (err.code === "EPEERINVALID" || err.code === 1) {
4747
// Not installed peer dependencies are treated by npm 2 as errors, but npm 3 treats them as warnings.
4848
// We'll show them as warnings and let the user install them in case they are needed.
4949
// The strucutre of the error object in such case is:
@@ -64,7 +64,6 @@ export class NodePackageManager implements INodePackageManager {
6464
// '@ngrx/[email protected]': '^2.0.0',
6565
// '[email protected]': '~2.0.0' } }
6666
this.$logger.warn(err.message);
67-
this.$logger.trace("Required peerDependencies are: ", err.peersDepending);
6867
} else {
6968
// All other errors should be handled by the caller code.
7069
throw err;

lib/services/ios-project-service.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -453,36 +453,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
453453
}).future<boolean>()();
454454
}
455455

456-
// Is this used?
457-
// public updatePlatform(currentVersion: string, newVersion: string, canUpdate: boolean): IFuture<boolean> {
458-
// return (() => {
459-
// if (!canUpdate) {
460-
// let isUpdateConfirmed = this.$prompter.confirm(`We need to override xcodeproj file. The old one will be saved at ${this.$options.profileDir}. Are you sure?`, () => true).wait();
461-
// if (isUpdateConfirmed) {
462-
// // Copy old file to options["profile-dir"]
463-
// let sourceDir = this.xcodeprojPath;
464-
// let destinationDir = path.join(this.$options.profileDir, "xcodeproj");
465-
// this.$fs.deleteDirectory(destinationDir).wait();
466-
// shell.cp("-R", path.join(sourceDir, "*"), destinationDir);
467-
// this.$logger.info(`Backup file ${sourceDir} at location ${destinationDir}`);
468-
// this.$fs.deleteDirectory(sourceDir).wait();
469-
470-
// // Copy xcodeProject file
471-
// let cachedPackagePath = path.join(this.$npmInstallationManager.getCachedPackagePath(this.platformData.frameworkPackageName, newVersion), constants.PROJECT_FRAMEWORK_FOLDER_NAME, `${IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER}.xcodeproj`);
472-
// shell.cp("-R", path.join(cachedPackagePath, "*"), sourceDir);
473-
// this.$logger.info(`Copied from ${cachedPackagePath} at ${this.platformData.projectRoot}.`);
474-
475-
// let pbxprojFilePath = this.pbxProjPath;
476-
// this.replaceFileContent(pbxprojFilePath).wait();
477-
// }
478-
479-
// return isUpdateConfirmed;
480-
// }
481-
482-
// return true;
483-
// }).future<boolean>()();
484-
// }
485-
486456
/**
487457
* Patch **LaunchScreen.xib** so we can be backward compatible for eternity.
488458
* The **xcodeproj** template proior v**2.1.0** had blank white screen launch screen.

lib/services/plugins-service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export class PluginsService implements IPluginsService {
77
private static INSTALL_COMMAND_NAME = "install";
88
private static UNINSTALL_COMMAND_NAME = "uninstall";
99
private static NPM_CONFIG = {
10-
save: true,
11-
silent: true //if this option is not enabled the returned json from npm install is not in a clear format, and it can't be parsed easily
10+
save: true
1211
};
1312
private get $projectData(): IProjectData {
1413
return this.$injector.resolve("projectData");

test/project-templates-service.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -69,50 +69,9 @@ describe("project-templates-service", () => {
6969
let tempFolder = temp.mkdirSync("preparetemplate");
7070
assert.throws(() => projectTemplatesService.prepareTemplate("invalidName", tempFolder).wait());
7171
});
72-
73-
//there is no tmp directory anymore
74-
// it("when after npm install the temp directory does not have any content", () => {
75-
// testInjector = createTestInjector({shouldNpmInstallThrow: false, npmInstallationDirContents: [], npmInstallationDirNodeModulesContents: null});
76-
// projectTemplatesService = testInjector.resolve("projectTemplatesService");
77-
// let tempFolder = temp.mkdirSync("preparetemplate");
78-
// assert.throws(() => projectTemplatesService.prepareTemplate("validName", tempFolder).wait());
79-
// });
80-
81-
// it("when after npm install the temp directory has more than one subdir", () => {
82-
// testInjector = createTestInjector({shouldNpmInstallThrow: false, npmInstallationDirContents: ["dir1", "dir2"], npmInstallationDirNodeModulesContents: []});
83-
// projectTemplatesService = testInjector.resolve("projectTemplatesService");
84-
// let tempFolder = temp.mkdirSync("preparetemplate");
85-
// assert.throws(() => projectTemplatesService.prepareTemplate("validName", tempFolder).wait());
86-
// });
87-
88-
// it("when after npm install the temp directory has only node_modules directory and there's nothing inside node_modules", () => {
89-
// testInjector = createTestInjector({shouldNpmInstallThrow: false, npmInstallationDirContents: ["node_modules"], npmInstallationDirNodeModulesContents: []});
90-
// projectTemplatesService = testInjector.resolve("projectTemplatesService");
91-
// let tempFolder = temp.mkdirSync("preparetemplate");
92-
// assert.throws(() => projectTemplatesService.prepareTemplate("validName", tempFolder).wait());
93-
// });
9472
});
9573

9674
describe("returns correct path to template", () => {
97-
//there is no tmp directory anymore
98-
// it("when after npm install the temp directory has only one subdir and it is not node_modules", () =>{
99-
// testInjector = createTestInjector({shouldNpmInstallThrow: false, npmInstallationDirContents: [expectedTemplatePath], npmInstallationDirNodeModulesContents: []});
100-
// projectTemplatesService = testInjector.resolve("projectTemplatesService");
101-
// let tempFolder = temp.mkdirSync("preparetemplate");
102-
// let actualPathToTemplate = projectTemplatesService.prepareTemplate("validName", tempFolder).wait();
103-
// assert.strictEqual(path.basename(actualPathToTemplate), expectedTemplatePath);
104-
// assert.strictEqual(isDeleteDirectoryCalledForNodeModulesDir, true, "When correct path is returned, template's node_modules directory should be deleted.");
105-
// });
106-
107-
// it("when after npm install the temp directory has only one subdir and it is node_modules", () =>{
108-
// testInjector = createTestInjector({shouldNpmInstallThrow: false, npmInstallationDirContents: ["node_modules"], npmInstallationDirNodeModulesContents: [expectedTemplatePath]});
109-
// projectTemplatesService = testInjector.resolve("projectTemplatesService");
110-
// let tempFolder = temp.mkdirSync("preparetemplate");
111-
// let actualPathToTemplate = projectTemplatesService.prepareTemplate("validName", tempFolder).wait();
112-
// assert.strictEqual(path.basename(actualPathToTemplate), expectedTemplatePath);
113-
// assert.strictEqual(isDeleteDirectoryCalledForNodeModulesDir, true, "When correct path is returned, template's node_modules directory should be deleted.");
114-
// });
115-
11675
it("when reserved template name is used", () =>{
11776
testInjector = createTestInjector({shouldNpmInstallThrow: false, npmInstallationDirContents: [], npmInstallationDirNodeModulesContents: []});
11877
projectTemplatesService = testInjector.resolve("projectTemplatesService");

0 commit comments

Comments
 (0)