@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.getThemeInitialChecksums(themeDir);
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
- await Promise.all(uploadData.map(({ actionData, path }) => this.#themePushHttpApi
127
- .pushThemeData({
128
- actionData,
129
- stream: createReadStream(path),
130
- shopUrl: credentials.shopUrl
131
- })
132
- .response.then((response) => {
133
- uploadedImageData.push({
134
- location: dirname(path),
135
- originalFilename: basename(path),
136
- uploadedFilename: response.data.imageId
137
- });
138
- })
139
- .catch(() => {
140
- rejectedImageData.push({
141
- location: dirname(path),
142
- originalFilename: basename(path)
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
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.1.0-27",
5
+ "version": "0.1.0-29",
6
6
  "description": "CLI tool for Shoper",
7
7
  "author": "Joanna Firek",
8
8
  "license": "MIT",