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.
Files changed (2) hide show
  1. package/lib/utils.js +21 -1
  2. 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
- zip.addLocalFolder(filePath, themeName);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoplazza-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "",
5
5
  "main": "bin/shoplazza",
6
6
  "engines": {