shoplazza-cli 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils.js +21 -1
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -5,6 +5,8 @@ const chalk = require('chalk');
|
|
|
5
5
|
|
|
6
6
|
const { SSO_AUTH_URL, ACCOUNT_URL, CLIENT_ID, DEV_SSO_AUTH_URL, DEV_ACCOUNT_URL, DEV_CLIENT_ID } = require('./config');
|
|
7
7
|
|
|
8
|
+
const ZIP_IGNORE_FOLDER = ['.git', '.DS_Store'];
|
|
9
|
+
|
|
8
10
|
exports.unzipTheme = (zipPath, outputPath) => {
|
|
9
11
|
const zip = new AdmZip(zipPath);
|
|
10
12
|
const zipEntries = zip.getEntries();
|
|
@@ -22,7 +24,25 @@ exports.unzipTheme = (zipPath, outputPath) => {
|
|
|
22
24
|
|
|
23
25
|
exports.zipTheme = (filePath, themeName) => {
|
|
24
26
|
const zip = new AdmZip();
|
|
25
|
-
|
|
27
|
+
// Old code
|
|
28
|
+
// zip.addLocalFolder(filePath, themeName);
|
|
29
|
+
|
|
30
|
+
// zip, but ignore some folder
|
|
31
|
+
const lsDir = fs.readdirSync(filePath);
|
|
32
|
+
lsDir.forEach((lsItem) => {
|
|
33
|
+
const lsItemStat = fs.statSync(path.join(filePath, lsItem));
|
|
34
|
+
|
|
35
|
+
if (ZIP_IGNORE_FOLDER.includes(lsItem)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (lsItemStat.isDirectory()) {
|
|
40
|
+
zip.addLocalFolder(path.join(filePath, lsItem), path.join(themeName, lsItem));
|
|
41
|
+
} else if (lsItemStat.isFile()) {
|
|
42
|
+
zip.addLocalFile(path.join(filePath, lsItem), path.join(themeName, lsItem));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
26
46
|
zip.writeZip(`${process.cwd()}/${themeName}.zip`);
|
|
27
47
|
};
|
|
28
48
|
|