@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.
- package/build/cli/utilities/features/logger/transports/log_object_map_transport.js +22 -0
- package/build/theme/commands/push/theme_push_command.js +0 -3
- package/build/theme/commands/ui/theme_error.js +1 -1
- package/build/theme/features/theme/actions/theme_actions_utils.js +1 -1
- package/build/theme/features/theme/push/service/theme_push_service.js +2 -1
- package/build/theme/features/theme/utils/files/theme_files_utils.js +8 -2
- package/package.json +1 -1
|
@@ -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 = [];
|
|
@@ -42,7 +42,8 @@ export class ThemeFilesUtils {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
static mapFilesRecordsToFilesList(filesRecords, localFileNameToUploaded = {}) {
|
|
45
|
-
|
|
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 (
|
|
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)
|