@shoper/cli 0.5.2-2 → 0.5.2-4

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.
@@ -0,0 +1,22 @@
1
+ // import { Writable } from 'node:stream';
2
+ //
3
+ // export default async function (opts) {
4
+ // console.log('opts', opts);
5
+ //
6
+ // return new Writable({
7
+ // objectMode: true,
8
+ // write(chunk, enc, cb) {
9
+ // const mapped = mapLog(chunk);
10
+ //
11
+ // cb();
12
+ //
13
+ // return mapped;
14
+ // }
15
+ // });
16
+ // }
17
+ //
18
+ // function mapLog(obj) {
19
+ // //TODO map for backend structure
20
+ // return obj;
21
+ // }
22
+ export {};
@@ -25,7 +25,6 @@ import { ThemeError } from '../ui/theme_error.js';
25
25
  import { mapToPermissionsTree } from '../../utils/directory_validator/directory_validator_utils.js';
26
26
  import { mapChecksumToTree } from '../../../utils/checksums/checksums_utils.js';
27
27
  import { ThemeUnpermittedActionsError } from './ui/theme_unpermitted_actions_error.js';
28
- import { promptConfirmation } from '../../../ui/prompts/prompt_confirmation.js';
29
28
  export class ThemePushCommand extends BaseThemeCommand {
30
29
  static summary = 'Uploads your local theme files to the store and overwrites the current version of the theme in your store.';
31
30
  static description = 'Check your local changes before pushing.\n\nYou must run this command from a specific theme directory (ID not needed).';
@@ -112,12 +111,10 @@ export class ThemePushCommand extends BaseThemeCommand {
112
111
  themeFilesUploadApi
113
112
  });
114
113
  spinner.stop();
115
- await promptConfirmation('Confirm');
116
114
  renderOnce(React.createElement(ThemePushedSuccess, { themeName: await ThemeInfoUtils.getThemeName(executionContext.themeRootDir) }));
117
115
  }
118
116
  catch (err) {
119
117
  spinner?.stop();
120
- await promptConfirmation('Confirm');
121
118
  renderOnce(React.createElement(ThemeError, { err: err, executionContext: executionContext }));
122
119
  }
123
120
  }
@@ -20,7 +20,7 @@ export const ThemeError = ({ err, executionContext }) => {
20
20
  }
21
21
  if (err?.code === THEME_FILES_UPLOAD_ERROR) {
22
22
  return (React.createElement(Error, { header: "Uploading theme files to the shop failed." },
23
- React.createElement(Text, null, "Please ensure that the files are not corrupted and that the file extensions are supported.")));
23
+ React.createElement(Text, null, "Please ensure that the files are not corrupted and that the file extensions are supported or file size is not too large.")));
24
24
  }
25
25
  if (err?.message) {
26
26
  return React.createElement(ValidationErrors, { errors: err.message });
@@ -32,7 +32,7 @@ export class ThemeActionsUtils {
32
32
  actionValue,
33
33
  filesStructure
34
34
  });
35
- return deletedFiles.filter((path) => micromatch.isMatch(path, globs));
35
+ return deletedFiles.filter((path) => !looksLikeDirectory(path) && micromatch.isMatch(path, globs));
36
36
  }
37
37
  static async getFilesRecordsFromActionData({ themeRootDir, themeAction, filesStructure, themeChecksums }) {
38
38
  const filesRecords = [];
@@ -59,7 +59,8 @@ export class ThemePushService {
59
59
  actionType: THEME_ACTIONS_TYPES.push,
60
60
  actionValue: THEME_WILDCARD_ACTION_NAME,
61
61
  themeChecksums,
62
- filesStructure
62
+ filesStructure,
63
+ rootDir: themeRootDir
63
64
  });
64
65
  await this._createFilesList({
65
66
  themeRootDir,
@@ -42,7 +42,8 @@ export class ThemeFilesUtils {
42
42
  });
43
43
  }
44
44
  static mapFilesRecordsToFilesList(filesRecords, localFileNameToUploaded = {}) {
45
- return filesRecords.reduce((acc, { fileGlob, fileName, state, actionKey }) => {
45
+ let areAllSkinstoreFilesUnchanged = true;
46
+ const filesList = filesRecords.reduce((acc, { fileGlob, fileName, state, actionKey }) => {
46
47
  const name = localFileNameToUploaded[fileName] ?? fileName;
47
48
  if (state === FILE_STATES.deleted && actionKey === 'thumbnail') {
48
49
  return {
@@ -50,7 +51,9 @@ export class ThemeFilesUtils {
50
51
  [fileGlob]: null
51
52
  };
52
53
  }
53
- if (state === FILE_STATES.deleted)
54
+ if (actionKey === 'skinstore_files' && state !== FILE_STATES.unchanged)
55
+ areAllSkinstoreFilesUnchanged = false;
56
+ if (state === FILE_STATES.deleted || (state === FILE_STATES.unchanged && actionKey !== 'skinstore_files'))
54
57
  return acc;
55
58
  if (looksLikeDirectory(fileGlob)) {
56
59
  const existingFiles = acc[fileGlob] || [];
@@ -66,6 +69,9 @@ export class ThemeFilesUtils {
66
69
  };
67
70
  }
68
71
  }, {});
72
+ if (areAllSkinstoreFilesUnchanged)
73
+ delete filesList['skinstore/files'];
74
+ return filesList;
69
75
  }
70
76
  static async createAFilesListFile(themeRootDir, filesList) {
71
77
  if (!filesList || !Object.keys(filesList).length)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@shoper/cli",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "0.5.2-2",
5
+ "version": "0.5.2-4",
6
6
  "description": "CLI tool for Shoper",
7
7
  "author": "Joanna Firek",
8
8
  "license": "MIT",