@shoper/cli 0.1.0-27 → 0.1.0-29
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.
|
@@ -46,7 +46,7 @@ export class ThemeMergeService {
|
|
|
46
46
|
return initialChecksums !== currentChecksums;
|
|
47
47
|
}
|
|
48
48
|
async hasFileBeenCreated(path, themeDir) {
|
|
49
|
-
const initialChecksum = await ThemeChecksumsUtils.
|
|
49
|
+
const initialChecksum = await ThemeChecksumsUtils.getInitialChecksumFromPath(path, themeDir);
|
|
50
50
|
return !initialChecksum && (await fileExists(join(themeDir, path)));
|
|
51
51
|
}
|
|
52
52
|
async hasFileBeenModified(path, themeDir) {
|
|
@@ -2,7 +2,7 @@ import tmp from 'tmp-promise';
|
|
|
2
2
|
import { THEME_ACTION_DATA_TYPE, THEME_ACTIONS_TYPES } from '../../actions/theme_actions_constants.js';
|
|
3
3
|
import { createZip } from '../../../../../utils/zip/create_zip_utils.js';
|
|
4
4
|
import { basename, dirname, extname, join, looksLikeDirectory, toUnixPath } from '../../../../../utils/path_utils.js';
|
|
5
|
-
import { createReadStream } from 'node:fs';
|
|
5
|
+
import fs, { createReadStream } from 'node:fs';
|
|
6
6
|
import { v4 as uuid } from 'uuid';
|
|
7
7
|
import globs from 'fast-glob';
|
|
8
8
|
import { THEME_WILDCARD_ACTION_NAME } from '../../actions/service/theme_actions_service_constants.js';
|
|
@@ -34,6 +34,7 @@ export class ThemePushService {
|
|
|
34
34
|
filesStructure,
|
|
35
35
|
executionContext
|
|
36
36
|
});
|
|
37
|
+
console.log('uploadData', uploadData);
|
|
37
38
|
if (uploadData.length) {
|
|
38
39
|
await this._uploadThemeFiles({
|
|
39
40
|
filesToUpload: uploadData,
|
|
@@ -123,25 +124,30 @@ export class ThemePushService {
|
|
|
123
124
|
async _uploadFiles(uploadData, credentials) {
|
|
124
125
|
const uploadedImageData = [];
|
|
125
126
|
const rejectedImageData = [];
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
console.log('uploadData', uploadData);
|
|
128
|
+
await Promise.all(uploadData.map(({ actionData, path }) => {
|
|
129
|
+
const fstat = fs.lstatSync(path);
|
|
130
|
+
console.log('fstat', fstat);
|
|
131
|
+
return this.#themePushHttpApi
|
|
132
|
+
.pushThemeData({
|
|
133
|
+
actionData,
|
|
134
|
+
stream: createReadStream(path),
|
|
135
|
+
shopUrl: credentials.shopUrl
|
|
136
|
+
})
|
|
137
|
+
.response.then((response) => {
|
|
138
|
+
uploadedImageData.push({
|
|
139
|
+
location: dirname(path),
|
|
140
|
+
originalFilename: basename(path),
|
|
141
|
+
uploadedFilename: response.data.imageId
|
|
142
|
+
});
|
|
143
|
+
})
|
|
144
|
+
.catch(() => {
|
|
145
|
+
rejectedImageData.push({
|
|
146
|
+
location: dirname(path),
|
|
147
|
+
originalFilename: basename(path)
|
|
148
|
+
});
|
|
143
149
|
});
|
|
144
|
-
}))
|
|
150
|
+
}));
|
|
145
151
|
return {
|
|
146
152
|
uploadedImageData,
|
|
147
153
|
rejectedImageData
|