Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 4e961c3

Browse files
author
Sean Stares
committed
Add try-catch for removal of file
1 parent e52f3d4 commit 4e961c3

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

deploy.js

+17-11
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@ const env_vars = {
1818
}
1919

2020
console.log('env_vars', env_vars)
21-
console.log('unlinking ./dist/.gitignore')
22-
fs.unlinkSync('./dist/.gitignore')
21+
22+
try {
23+
if (fs.existsSync('./dist/.gitignore')) {
24+
console.log('unlinking ./dist/.gitignore')
25+
fs.unlinkSync('./dist/.gitignore')
26+
}
27+
} catch (err) {
28+
console.log(err)
29+
}
2330

2431
if (!DIR) {
2532
throw new Error('please specify CODE_GOV_DIR as an env variable')
@@ -30,28 +37,27 @@ const options = {
3037
repo: process.env.CODE_GOV_REPO || '[email protected]:GSA/code-gov-front-end'
3138
}
3239

33-
console.log('options:', options)
34-
3540
if (process.env.CODE_GOV_BRANCH) {
3641
options.branch = process.env.CODE_GOV_BRANCH
3742
} else {
3843
throw new Error('no branch specified')
3944
}
4045

41-
//if (!process.env.CODE_GOV_REPO) {
46+
console.log('options:', options)
47+
// if (!process.env.CODE_GOV_REPO) {
4248
// throw new Error("no repo specified")
43-
//}
49+
// }
4450
//
45-
//if (!process.env.CODE_GOV_API_KEY) {
51+
// if (!process.env.CODE_GOV_API_KEY) {
4652
// throw new Error("no api specified")
47-
//}
53+
// }
4854

49-
//ghpages.clean()
55+
// ghpages.clean()
5056
//
51-
//ghpages.publish(DIR, options, err => {
57+
// ghpages.publish(DIR, options, err => {
5258
// if (err) {
5359
// console.error(err);
5460
// } else {
5561
// console.log("published successfully");
5662
// }
57-
//});
63+
// });

0 commit comments

Comments
 (0)