added code improvements
diff --git a/images/index.js b/images/index.js
index 7b092b4..dc31fdf 100644
--- a/images/index.js
+++ b/images/index.js
@@ -55,7 +55,7 @@
{
name: 'individualAssets',
alias: 'i',
- type: (value) => ([0, 1].includes(Number(value)) ? Number(value) : 1),
+ type: (value) => ([0, 1].includes(+value) ? +value : 1),
description: 'export as individual assets',
},
];
diff --git a/images/js/googleCloud.js b/images/js/googleCloud.js
index 35bba9c..06c795f 100644
--- a/images/js/googleCloud.js
+++ b/images/js/googleCloud.js
@@ -3,7 +3,7 @@
const bucketName = 'gs://lottie-animation-community-tests';
let storage;
-const initialize = () => {
+const initialize = async () => {
try {
const key = process.env.GOOGLE_CLOUD_STORAGE;
const keyString = Buffer.from(key, 'base64').toString('ascii');
@@ -13,8 +13,7 @@
projectId: storageKey.project_id,
});
} catch (error) {
- console.log('Could not initialize Google Cloud');
- console.log(error);
+ console.log('Could not initialize Google Cloud', error); // eslint-disable-line no-console
}
};
@@ -24,8 +23,7 @@
destination,
});
} catch (error) {
- console.log('Could not upload asset to Google Cloud');
- console.log(error);
+ console.log('Could not upload asset to Google Cloud', error); // eslint-disable-line no-console
}
};
diff --git a/images/js/main.js b/images/js/main.js
index 2029a03..1c3b6f5 100644
--- a/images/js/main.js
+++ b/images/js/main.js
@@ -28,11 +28,10 @@
window._finished = true; // eslint-disable-line no-underscore-dangle
};
-window.startProcess = () => {
+window.startProcess = async () => {
try {
- start();
+ await start();
} catch (err) {
- console.log('ERROR'); // eslint-disable-line no-console
- console.log(err.message); // eslint-disable-line no-console
+ console.log('ERROR', err.message); // eslint-disable-line no-console
}
};