@shoper/cli 0.5.2-1 → 0.5.2-2

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.
@@ -112,12 +112,12 @@ export class ThemePushCommand extends BaseThemeCommand {
112
112
  themeFilesUploadApi
113
113
  });
114
114
  spinner.stop();
115
- await promptConfirmation('Continue');
115
+ await promptConfirmation('Confirm');
116
116
  renderOnce(React.createElement(ThemePushedSuccess, { themeName: await ThemeInfoUtils.getThemeName(executionContext.themeRootDir) }));
117
117
  }
118
118
  catch (err) {
119
119
  spinner?.stop();
120
- await promptConfirmation('Continue');
120
+ await promptConfirmation('Confirm');
121
121
  renderOnce(React.createElement(ThemeError, { err: err, executionContext: executionContext }));
122
122
  }
123
123
  }
@@ -19,8 +19,8 @@ export const ThemeError = ({ err, executionContext }) => {
19
19
  return React.createElement(ThemeWorkUrlMismatch, { command: "verify" });
20
20
  }
21
21
  if (err?.code === THEME_FILES_UPLOAD_ERROR) {
22
- return (React.createElement(Error, { header: "Uploading theme files to the shop failed.\n" },
23
- React.createElement(Text, null, "The rejected files have been removed locally. Please ensure that the files are not corrupted and that the file extensions are supported.")));
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.")));
24
24
  }
25
25
  if (err?.message) {
26
26
  return React.createElement(ValidationErrors, { errors: err.message });
@@ -43,7 +43,9 @@ export class ThemePushService {
43
43
  themeRootDir,
44
44
  themeFilesUploadApi
45
45
  });
46
- localFileNameToUploaded = uploadData.localFileNameToUploaded;
46
+ if (!uploadData.isSuccess)
47
+ throw ThemePushErrorsFactory.createErrorWhileUploadingThemeFiles(credentials.shopUrl);
48
+ localFileNameToUploaded = uploadData.localFileNameToUploadedMap;
47
49
  }
48
50
  const themeArchivePath = join(tmpDir, `${uuid()}.zip`);
49
51
  const filesInArchive = await ThemeActionsUtils.getFilesThatMatchesAction({
@@ -91,18 +93,19 @@ export class ThemePushService {
91
93
  await themeChecksums.updateAllChecksums();
92
94
  }
93
95
  catch (err) {
94
- console.log('err', err);
95
96
  await ThemeFilesUtils.removeAFilesListFile(themeRootDir);
96
97
  throw err;
97
98
  }
98
99
  }
99
100
  async _uploadThemeFiles({ filesToUpload, themeRootDir, credentials, themeFilesUploadApi }) {
100
101
  try {
101
- const { uploadedImageData } = await themeFilesUploadApi.uploadFiles(filesToUpload);
102
+ const { uploadedImageData, rejectedImageData } = await themeFilesUploadApi.uploadFiles(filesToUpload);
102
103
  if (uploadedImageData.length)
103
104
  await ThemeImagesUtils.removeUploadedOriginalFiles(themeRootDir, uploadedImageData);
104
105
  return {
105
- localFileNameToUploaded: uploadedImageData.reduce((acc, { originalFilename, uploadedFilename }) => {
106
+ isSuccess: rejectedImageData.length === 0,
107
+ rejectedImageData,
108
+ localFileNameToUploadedMap: uploadedImageData.reduce((acc, { originalFilename, uploadedFilename }) => {
106
109
  return {
107
110
  ...acc,
108
111
  [originalFilename]: uploadedFilename ?? originalFilename
@@ -137,7 +140,10 @@ export class ThemePushService {
137
140
  return uniq(withSettingsFiles);
138
141
  }
139
142
  async _getAllModulesIds(themeRootDir) {
140
- const moduleDirs = await getAllDirectoriesNamesInside(join(themeRootDir, MODULES_DIRECTORY_NAME));
143
+ const modulesPath = join(themeRootDir, MODULES_DIRECTORY_NAME);
144
+ if (!(await fileExists(modulesPath)))
145
+ return [];
146
+ const moduleDirs = await getAllDirectoriesNamesInside(modulesPath);
141
147
  const modulesIds = [];
142
148
  for (const moduleDir of moduleDirs) {
143
149
  const moduleSettingsPath = join(themeRootDir, MODULES_DIRECTORY_NAME, moduleDir, THEME_MODULE_SETTINGS_FILE_NAME);
@@ -52,8 +52,6 @@ export class ThemeFilesUtils {
52
52
  }
53
53
  if (state === FILE_STATES.deleted)
54
54
  return acc;
55
- if (state === FILE_STATES.unchanged)
56
- return acc;
57
55
  if (looksLikeDirectory(fileGlob)) {
58
56
  const existingFiles = acc[fileGlob] || [];
59
57
  return {
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-1",
5
+ "version": "0.5.2-2",
6
6
  "description": "CLI tool for Shoper",
7
7
  "author": "Joanna Firek",
8
8
  "license": "MIT",
@@ -1,6 +0,0 @@
1
- // export class LoggerInitializer extends SyncFeatureInitializer {
2
- // public initialize(): void {
3
- // // this.feature.logger = new LoggerFeature(this.app);
4
- // }
5
- // }
6
- export {};