summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorKasra Bigdeli <[email protected]>2020-08-16 19:34:08 -0400
committerKasra Bigdeli <[email protected]>2020-08-16 19:34:08 -0400
commitb5f32aa696f756f8b4640dff5edfa9537c44d213 (patch)
treef9ee2d2afc85bf3642435ff5a90a0ad0234dc849 /scripts
parentc711509c027f51dccaa3dfd66cafc4f83ebacb4d (diff)
downloadcaprover-one-click-apps-b5f32aa696f756f8b4640dff5edfa9537c44d213.tar.gz
caprover-one-click-apps-b5f32aa696f756f8b4640dff5edfa9537c44d213.zip
Fixed build
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build_one_click_apps.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/scripts/build_one_click_apps.js b/scripts/build_one_click_apps.js
index 1a3d816..10bed59 100644
--- a/scripts/build_one_click_apps.js
+++ b/scripts/build_one_click_apps.js
@@ -114,9 +114,24 @@ function convertV2toV4(v2String) {
function buildDist() {
- return fs.readdir(pathOfSourceDirectoryApps)
+ return Promise.resolve()
+ .then(function () {
+ return fs.existsSync(pathOfSourceDirectoryApps)
+ })
+ .then(function (dirExists) {
+
+ if (!dirExists) {
+ return [];
+ }
+
+ return fs.readdir(pathOfSourceDirectoryApps);
+ })
.then(function (appsFileNames) { // [ app1.json app2.json .... ]
+ if (appsFileNames.length === 0) {
+ return;
+ }
+
appsFileNames.forEach(appFileName => {
const pathOfAppFileInSource = path.join(pathOfSourceDirectoryApps, appFileName);
@@ -143,8 +158,7 @@ function buildDist() {
fs.outputJsonSync(path.join(pathOfDistV2, 'list'), v3List); // TODO delete oneClickApps:
fs.outputJsonSync(path.join(pathOfDistV3, 'list'), v3List);
fs.outputJsonSync(path.join(pathOfDistV4, 'list'), v3List);
- })
- .then(function () {
+
return fs.copySync(path.join(pathOfPublic, 'CNAME'), path.join(pathOfDist, 'CNAME'));
});
}