Skip to content

Commit 6bf0f6d

Browse files
committed
Fix comments.
1 parent adca13b commit 6bf0f6d

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

lib/commands/update.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,23 @@ export class UpdateCommand implements ICommand {
1515
this.$projectData.initializeProjectData();
1616
}
1717

18-
static readonly folders: string[] = ["lib", "hooks", "platforms", "node_modules"];
18+
static readonly folders: string[] = [
19+
constants.LIB_DIR_NAME,
20+
constants.HOOKS_DIR_NAME,
21+
constants.PLATFORMS_DIR_NAME,
22+
constants.NODE_MODULES_FOLDER_NAME
23+
];
1924
static readonly tempFolder: string = ".tmp_backup";
25+
static readonly updateFailMessage: string = "Could not update the project!";
26+
static readonly backupFailMessage: string = "Could not backup project folders!";
2027

2128
public async execute(args: string[]): Promise<void> {
2229
const tmpDir = path.join(this.$projectData.projectDir, UpdateCommand.tempFolder);
2330

2431
try {
2532
this.backup(tmpDir);
2633
} catch (error) {
27-
this.$logger.error("Could not backup project folders!");
34+
this.$logger.error(UpdateCommand.backupFailMessage);
2835
this.$fs.deleteDirectory(tmpDir);
2936
return;
3037
}
@@ -33,7 +40,7 @@ export class UpdateCommand implements ICommand {
3340
await this.executeCore(args);
3441
} catch (error) {
3542
this.restoreBackup(tmpDir);
36-
this.$logger.error("Could not update the project!");
43+
this.$logger.error(UpdateCommand.updateFailMessage);
3744
} finally {
3845
this.$fs.deleteDirectory(tmpDir);
3946
}

lib/constants.ts

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export const TEST_RUNNER_NAME = "nativescript-unit-test-runner";
1616
export const LIVESYNC_EXCLUDED_FILE_PATTERNS = ["**/*.js.map", "**/*.ts"];
1717
export const XML_FILE_EXTENSION = ".xml";
1818
export const PLATFORMS_DIR_NAME = "platforms";
19+
export const HOOKS_DIR_NAME = "hooks";
20+
export const LIB_DIR_NAME = "lib";
1921
export const CODE_SIGN_ENTITLEMENTS = "CODE_SIGN_ENTITLEMENTS";
2022
export const AWAIT_NOTIFICATION_TIMEOUT_SECONDS = 9;
2123
export const SRC_DIR = "src";

test/update.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ describe("update command method tests", () => {
178178
});
179179
});
180180

181-
it("calls remove for all falders", async () => {
181+
it("calls remove for all folders", async () => {
182182
const testInjector = createTestInjector();
183183
const fs = testInjector.resolve("fs");
184184
const deleteDirectory: sinon.SinonStub = sandbox.stub(fs, "deleteDirectory");

0 commit comments

Comments
 (0)