@stackbit/cms-core 0.1.25 → 0.1.26-gitcms.1

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.
Files changed (37) hide show
  1. package/dist/content-store.d.ts +5 -0
  2. package/dist/content-store.d.ts.map +1 -1
  3. package/dist/content-store.js +11 -6
  4. package/dist/content-store.js.map +1 -1
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/services/git.d.ts +35 -0
  10. package/dist/services/git.d.ts.map +1 -0
  11. package/dist/services/git.js +184 -0
  12. package/dist/services/git.js.map +1 -0
  13. package/dist/services/index.d.ts +3 -0
  14. package/dist/services/index.d.ts.map +1 -0
  15. package/dist/services/index.js +15 -0
  16. package/dist/services/index.js.map +1 -0
  17. package/dist/services/run.d.ts +17 -0
  18. package/dist/services/run.d.ts.map +1 -0
  19. package/dist/services/run.js +54 -0
  20. package/dist/services/run.js.map +1 -0
  21. package/dist/utils/create-update-csi-docs.d.ts.map +1 -1
  22. package/dist/utils/create-update-csi-docs.js +17 -4
  23. package/dist/utils/create-update-csi-docs.js.map +1 -1
  24. package/dist/utils/index.d.ts +2 -2
  25. package/dist/utils/index.d.ts.map +1 -1
  26. package/dist/utils/store-to-api-docs-converter.d.ts +3 -3
  27. package/dist/utils/store-to-api-docs-converter.d.ts.map +1 -1
  28. package/dist/utils/store-to-api-docs-converter.js +66 -45
  29. package/dist/utils/store-to-api-docs-converter.js.map +1 -1
  30. package/package.json +9 -6
  31. package/src/content-store.ts +17 -7
  32. package/src/index.ts +1 -0
  33. package/src/services/git.ts +229 -0
  34. package/src/services/index.ts +2 -0
  35. package/src/services/run.ts +59 -0
  36. package/src/utils/create-update-csi-docs.ts +17 -4
  37. package/src/utils/store-to-api-docs-converter.ts +63 -44
@@ -5,23 +5,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.mapStoreAssetsToAPIAssets = exports.mapAssetsToLocalizedApiImages = exports.mapDocumentsToLocalizedApiObjects = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
+ const path_1 = __importDefault(require("path"));
8
9
  const utils_1 = require("@stackbit/utils");
9
- function mapDocumentsToLocalizedApiObjects(documents, locale) {
10
- return documents.map((document) => documentToLocalizedApiObject(document, locale));
10
+ function mapDocumentsToLocalizedApiObjects(documents, staticAssetsPublicPath, locale) {
11
+ return documents.map((document) => documentToLocalizedApiObject(document, staticAssetsPublicPath, locale));
11
12
  }
12
13
  exports.mapDocumentsToLocalizedApiObjects = mapDocumentsToLocalizedApiObjects;
13
- function documentToLocalizedApiObject(document, locale) {
14
+ function documentToLocalizedApiObject(document, staticAssetsPublicPath, locale) {
14
15
  const { type, fields, ...rest } = document;
15
16
  return {
16
17
  type: 'object',
17
18
  ...rest,
18
- fields: toLocalizedAPIFields(fields, locale)
19
+ fields: toLocalizedAPIFields(fields, staticAssetsPublicPath, locale)
19
20
  };
20
21
  }
21
- function toLocalizedAPIFields(docFields, locale) {
22
- return lodash_1.default.mapValues(docFields, (docField) => toLocalizedAPIField(docField, locale));
22
+ function toLocalizedAPIFields(docFields, staticAssetsPublicPath, locale) {
23
+ return lodash_1.default.mapValues(docFields, (docField) => toLocalizedAPIField(docField, staticAssetsPublicPath, locale));
23
24
  }
24
- function toLocalizedAPIField(docField, locale, isListItem = false) {
25
+ function toLocalizedAPIField(docField, staticAssetsPublicPath, locale, isListItem = false) {
25
26
  var _a;
26
27
  function localeFields(localized) {
27
28
  const isLocalized = !!localized;
@@ -73,33 +74,46 @@ function toLocalizedAPIField(docField, locale, isListItem = false) {
73
74
  ...localeFields(docField.localized)
74
75
  };
75
76
  case 'image':
77
+ let result;
76
78
  if (docField.localized) {
77
79
  const { localized, locales, ...base } = docField;
78
80
  const localeProps = locales && locale ? locales[locale] : undefined;
79
- return {
80
- ...base,
81
- ...(localeProps
82
- ? {
83
- ...localeProps,
84
- fields: toLocalizedAPIFields(localeProps.fields, locale)
85
- }
86
- : { isUnset: true }),
87
- ...localeFields(localized)
88
- };
81
+ if (localeProps) {
82
+ const fields = toLocalizedAPIFields(localeProps.fields, staticAssetsPublicPath, locale);
83
+ result = {
84
+ ...base,
85
+ ...localeProps,
86
+ fields,
87
+ ...localeFields(localized)
88
+ };
89
+ }
90
+ else {
91
+ result = {
92
+ ...base,
93
+ isUnset: true,
94
+ ...localeFields(localized)
95
+ };
96
+ }
89
97
  }
90
- return {
91
- ...(!docField.isUnset
92
- ? {
98
+ else {
99
+ if (docField.isUnset) {
100
+ result = {
93
101
  ...docField,
94
102
  type: 'image',
95
- fields: toLocalizedAPIFields(docField.fields, locale)
96
- }
97
- : {
103
+ ...localeFields(docField.localized)
104
+ };
105
+ }
106
+ else {
107
+ const fields = toLocalizedAPIFields(docField.fields, staticAssetsPublicPath, locale);
108
+ result = {
98
109
  ...docField,
99
- type: 'image'
100
- }),
101
- ...localeFields(docField.localized)
102
- };
110
+ type: 'image',
111
+ fields,
112
+ ...localeFields(docField.localized)
113
+ };
114
+ }
115
+ }
116
+ return result;
103
117
  case 'object':
104
118
  case 'model':
105
119
  if (docField.localized) {
@@ -111,7 +125,7 @@ function toLocalizedAPIField(docField, locale, isListItem = false) {
111
125
  ...(localeProps
112
126
  ? {
113
127
  ...localeProps,
114
- fields: toLocalizedAPIFields(localeProps.fields, locale)
128
+ fields: toLocalizedAPIFields(localeProps.fields, staticAssetsPublicPath, locale)
115
129
  }
116
130
  : { isUnset: true }),
117
131
  ...localeFields(localized)
@@ -126,7 +140,7 @@ function toLocalizedAPIField(docField, locale, isListItem = false) {
126
140
  ...(localeProps
127
141
  ? {
128
142
  ...localeProps,
129
- fields: toLocalizedAPIFields(localeProps.fields, locale)
143
+ fields: toLocalizedAPIFields(localeProps.fields, staticAssetsPublicPath, locale)
130
144
  }
131
145
  : { isUnset: true }),
132
146
  ...localeFields(localized)
@@ -138,7 +152,7 @@ function toLocalizedAPIField(docField, locale, isListItem = false) {
138
152
  ? {
139
153
  ...docField,
140
154
  type: 'object',
141
- fields: toLocalizedAPIFields(docField.fields, locale)
155
+ fields: toLocalizedAPIFields(docField.fields, staticAssetsPublicPath, locale)
142
156
  }
143
157
  : {
144
158
  ...docField,
@@ -225,14 +239,14 @@ function toLocalizedAPIField(docField, locale, isListItem = false) {
225
239
  return {
226
240
  ...base,
227
241
  ...localeProps,
228
- items: ((_a = localeProps === null || localeProps === void 0 ? void 0 : localeProps.items) !== null && _a !== void 0 ? _a : []).map((field) => toLocalizedAPIField(field, locale, true)),
242
+ items: ((_a = localeProps === null || localeProps === void 0 ? void 0 : localeProps.items) !== null && _a !== void 0 ? _a : []).map((field) => toLocalizedAPIField(field, staticAssetsPublicPath, locale, true)),
229
243
  ...localeFields(localized)
230
244
  };
231
245
  }
232
246
  return {
233
247
  ...docField,
234
248
  ...localeFields(docField.localized),
235
- items: docField.items.map((field) => toLocalizedAPIField(field, locale, true))
249
+ items: docField.items.map((field) => toLocalizedAPIField(field, staticAssetsPublicPath, locale, true))
236
250
  };
237
251
  default:
238
252
  const _exhaustiveCheck = docField;
@@ -240,19 +254,19 @@ function toLocalizedAPIField(docField, locale, isListItem = false) {
240
254
  return _exhaustiveCheck;
241
255
  }
242
256
  }
243
- function mapAssetsToLocalizedApiImages(assets, locale) {
244
- return assets.map((asset) => assetToLocalizedApiImage(asset, locale));
257
+ function mapAssetsToLocalizedApiImages(assets, staticAssetsPublicPath, locale) {
258
+ return assets.map((asset) => assetToLocalizedApiImage(asset, staticAssetsPublicPath, locale));
245
259
  }
246
260
  exports.mapAssetsToLocalizedApiImages = mapAssetsToLocalizedApiImages;
247
- function assetToLocalizedApiImage(asset, locale) {
261
+ function assetToLocalizedApiImage(asset, staticAssetsPublicPath, locale) {
248
262
  const { type, fields, ...rest } = asset;
249
263
  return {
250
264
  type: 'image',
251
265
  ...rest,
252
- fields: localizeAssetFields(fields, locale)
266
+ fields: localizeAssetFields(fields, staticAssetsPublicPath, locale)
253
267
  };
254
268
  }
255
- function localizeAssetFields(assetFields, locale) {
269
+ function localizeAssetFields(assetFields, staticAssetsPublicPath, locale) {
256
270
  var _a, _b, _c, _d, _e, _f;
257
271
  const fields = {
258
272
  title: {
@@ -288,12 +302,12 @@ function localizeAssetFields(assetFields, locale) {
288
302
  }
289
303
  return fields;
290
304
  }
291
- function mapStoreAssetsToAPIAssets(assets, locale) {
292
- return assets.map((asset) => storeAssetToAPIAsset(asset, locale)).filter((asset) => !!asset);
305
+ function mapStoreAssetsToAPIAssets(assets, staticAssetsPublicPath, locale) {
306
+ return assets.map((asset) => storeAssetToAPIAsset(asset, staticAssetsPublicPath, locale)).filter((asset) => !!asset);
293
307
  }
294
308
  exports.mapStoreAssetsToAPIAssets = mapStoreAssetsToAPIAssets;
295
- function storeAssetToAPIAsset(asset, locale) {
296
- var _a, _b, _c, _d, _e;
309
+ function storeAssetToAPIAsset(asset, staticAssetsPublicPath, locale) {
310
+ var _a, _b, _c, _d, _e, _f;
297
311
  const assetTitleField = asset.fields.title;
298
312
  const localizedTitleField = assetTitleField.localized ? (_a = assetTitleField.locales) === null || _a === void 0 ? void 0 : _a[locale] : assetTitleField;
299
313
  const assetFileField = asset.fields.file;
@@ -304,15 +318,22 @@ function storeAssetToAPIAsset(asset, locale) {
304
318
  return {
305
319
  objectId: asset.srcObjectId,
306
320
  createdAt: asset.createdAt,
307
- url: localizedFileField.url,
321
+ url: (_c = replaceAssetUrlIfNeeded(staticAssetsPublicPath, localizedFileField.url)) !== null && _c !== void 0 ? _c : staticAssetsPublicPath,
308
322
  ...(0, utils_1.omitByNil)({
309
- title: (_c = localizedTitleField === null || localizedTitleField === void 0 ? void 0 : localizedTitleField.value) !== null && _c !== void 0 ? _c : null,
323
+ title: (_d = localizedTitleField === null || localizedTitleField === void 0 ? void 0 : localizedTitleField.value) !== null && _d !== void 0 ? _d : null,
310
324
  fileName: localizedFileField.fileName,
311
325
  contentType: localizedFileField.contentType,
312
326
  size: localizedFileField.size,
313
- width: (_d = localizedFileField.dimensions) === null || _d === void 0 ? void 0 : _d.width,
314
- height: (_e = localizedFileField.dimensions) === null || _e === void 0 ? void 0 : _e.height
327
+ width: (_e = localizedFileField.dimensions) === null || _e === void 0 ? void 0 : _e.width,
328
+ height: (_f = localizedFileField.dimensions) === null || _f === void 0 ? void 0 : _f.height
315
329
  })
316
330
  };
317
331
  }
332
+ function replaceAssetUrlIfNeeded(staticAssetsPublicPath, value) {
333
+ let url = value;
334
+ if (url && !url.startsWith('http:') && !url.startsWith('https:')) {
335
+ url = path_1.default.join(staticAssetsPublicPath, url);
336
+ }
337
+ return url;
338
+ }
318
339
  //# sourceMappingURL=store-to-api-docs-converter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-to-api-docs-converter.js","sourceRoot":"","sources":["../../src/utils/store-to-api-docs-converter.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,2CAA4C;AAG5C,SAAgB,iCAAiC,CAAC,SAAuC,EAAE,MAAe;IACtG,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,4BAA4B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACvF,CAAC;AAFD,8EAEC;AAED,SAAS,4BAA4B,CAAC,QAAoC,EAAE,MAAe;IACvF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC3C,OAAO;QACH,IAAI,EAAE,QAAQ;QACd,GAAG,IAAI;QACP,MAAM,EAAE,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;KAC/C,CAAC;AACN,CAAC;AAED,SAAS,oBAAoB,CAAC,SAA0D,EAAE,MAAe;IACrG,OAAO,gBAAC,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACvF,CAAC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C,MAAM,EAAE,MAAA,kBAAkB,CAAC,UAAU,0CAAE,MAAM;SAChD,CAAC;KACL,CAAC;AACN,CAAC;AAED,SAAS,uBAAuB,CAAC,sBAA8B,EAAE,KAAyB;IACtF,IAAI,GAAG,GAAG,KAAK,CAAC;IAChB,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC9D,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;KAChD;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbit/cms-core",
3
- "version": "0.1.25",
3
+ "version": "0.1.26-gitcms.1",
4
4
  "description": "stackbit-dev",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,8 +18,10 @@
18
18
  "author": "Stackbit Inc.",
19
19
  "license": "MIT",
20
20
  "devDependencies": {
21
+ "@types/fs-extra": "^11.0.1",
21
22
  "@types/jest": "^27.5.2",
22
23
  "@types/lodash": "^4.14.182",
24
+ "@types/uuid": "^9.0.0",
23
25
  "jest": "^27.4.7",
24
26
  "prettier": "^2.5.1",
25
27
  "ts-jest": "^27.1.3",
@@ -29,9 +31,9 @@
29
31
  "@babel/parser": "^7.11.5",
30
32
  "@babel/traverse": "^7.11.5",
31
33
  "@iarna/toml": "^2.2.3",
32
- "@stackbit/sdk": "^0.3.18",
33
- "@stackbit/types": "^0.1.10",
34
- "@stackbit/utils": "^0.2.17",
34
+ "@stackbit/sdk": "^0.3.19-gitcms.0",
35
+ "@stackbit/types": "^0.1.11-gitcms.0",
36
+ "@stackbit/utils": "^0.2.18-gitcms.0",
35
37
  "chalk": "^4.0.1",
36
38
  "esm": "^3.2.25",
37
39
  "fs-extra": "^8.1.0",
@@ -43,7 +45,8 @@
43
45
  "moment": "^2.29.1",
44
46
  "parse5": "^6.0.1",
45
47
  "sanitize-filename": "^1.6.3",
46
- "slugify": "^1.6.5"
48
+ "slugify": "^1.6.5",
49
+ "uuid": "^9.0.0"
47
50
  },
48
- "gitHead": "7dc1c50c11e403a05b821d14dcedd747c2017ada"
51
+ "gitHead": "605514332909dd9cd603bf74794f20917b91e246"
49
52
  }
@@ -48,6 +48,7 @@ import { mergeObjectWithDocument } from './utils/duplicate-document';
48
48
  import { normalizeModels, validateModels } from './utils/model-utils';
49
49
  import { IMAGE_MODEL } from './common/common-schema';
50
50
  import { getDocumentObjectFromPreset, getPresetFromDocument } from './utils/preset-utils';
51
+ import { ContentSourceServices } from '@stackbit/types';
51
52
 
52
53
  export type HandleConfigAssets = <T extends Model>({ models, presets }: { models?: T[]; presets?: PresetMap }) => Promise<{ models: T[]; presets: PresetMap }>;
53
54
 
@@ -55,8 +56,10 @@ export interface ContentSourceOptions {
55
56
  logger: ContentStoreTypes.Logger;
56
57
  userLogger: ContentStoreTypes.Logger;
57
58
  localDev: boolean;
59
+ staticAssetsPublicPath: string;
58
60
  webhookUrl?: string;
59
- userCommandSpawner?: UserCommandSpawner;
61
+ contentSourceServices: ContentSourceServices;
62
+ userCommandSpawner?: UserCommandSpawner; //TODO remove
60
63
  onSchemaChangeCallback: () => void;
61
64
  onContentChangeCallback: (contentChanges: ContentStoreTypes.ContentChangeResult) => void;
62
65
  handleConfigAssets: HandleConfigAssets;
@@ -73,7 +76,9 @@ export class ContentStore {
73
76
  private readonly userLogger: ContentStoreTypes.Logger;
74
77
  private readonly userCommandSpawner?: UserCommandSpawner;
75
78
  private readonly localDev: boolean;
79
+ private readonly staticAssetsPublicPath: string;
76
80
  private readonly webhookUrl?: string;
81
+ private readonly contentSourceServices: ContentSourceServices;
77
82
  private readonly onSchemaChangeCallback: () => void;
78
83
  private readonly onContentChangeCallback: (contentChanges: ContentStoreTypes.ContentChangeResult) => void;
79
84
  private readonly handleConfigAssets: HandleConfigAssets;
@@ -93,7 +98,9 @@ export class ContentStore {
93
98
  this.logger = options.logger.createLogger({ label: 'content-store' });
94
99
  this.userLogger = options.userLogger.createLogger({ label: 'content-store' });
95
100
  this.localDev = options.localDev;
101
+ this.staticAssetsPublicPath = options.staticAssetsPublicPath;
96
102
  this.webhookUrl = options.webhookUrl;
103
+ this.contentSourceServices = options.contentSourceServices;
97
104
  this.userCommandSpawner = options.userCommandSpawner;
98
105
  this.onSchemaChangeCallback = options.onSchemaChangeCallback;
99
106
  this.onContentChangeCallback = options.onContentChangeCallback;
@@ -430,7 +437,10 @@ export class ContentStore {
430
437
  userCommandSpawner: this.userCommandSpawner,
431
438
  localDev: this.localDev,
432
439
  webhookUrl: this.getWebhookUrl(contentSourceInstance.getContentSourceType(), contentSourceInstance.getProjectId()),
433
- devAppRestartNeeded: this.devAppRestartNeeded
440
+ devAppRestartNeeded: this.devAppRestartNeeded,
441
+ delegate: {
442
+ services: this.contentSourceServices
443
+ }
434
444
  });
435
445
  } else {
436
446
  contentSourceInstance.stopWatchingContentUpdates();
@@ -1130,8 +1140,8 @@ export class ContentStore {
1130
1140
  : assets;
1131
1141
  const currentLocale = locale ?? contentSourceData.defaultLocaleCode;
1132
1142
  const filteredDocuments = documents.filter((document) => document.srcModelName !== StackbitPresetModelName);
1133
- const documentObjects = mapDocumentsToLocalizedApiObjects(filteredDocuments, currentLocale);
1134
- const imageObjects = mapAssetsToLocalizedApiImages(assets, currentLocale);
1143
+ const documentObjects = mapDocumentsToLocalizedApiObjects(filteredDocuments, this.staticAssetsPublicPath, currentLocale);
1144
+ const imageObjects = mapAssetsToLocalizedApiImages(assets, this.staticAssetsPublicPath, currentLocale);
1135
1145
  return objects.concat(documentObjects, imageObjects);
1136
1146
  },
1137
1147
  []
@@ -1154,12 +1164,12 @@ export class ContentStore {
1154
1164
  if (srcProjectId && srcType) {
1155
1165
  const contentSourceId = getContentSourceId(srcType, srcProjectId);
1156
1166
  const contentSourceData = this.getContentSourceDataByIdOrThrow(contentSourceId);
1157
- assets = mapStoreAssetsToAPIAssets(contentSourceData.assets, contentSourceData.defaultLocaleCode);
1167
+ assets = mapStoreAssetsToAPIAssets(contentSourceData.assets, this.staticAssetsPublicPath, contentSourceData.defaultLocaleCode);
1158
1168
  } else {
1159
1169
  assets = _.reduce(
1160
1170
  this.contentSourceDataById,
1161
1171
  (result: ContentStoreTypes.APIAsset[], contentSourceData) => {
1162
- const assets = mapStoreAssetsToAPIAssets(contentSourceData.assets, contentSourceData.defaultLocaleCode);
1172
+ const assets = mapStoreAssetsToAPIAssets(contentSourceData.assets, this.staticAssetsPublicPath, contentSourceData.defaultLocaleCode);
1163
1173
  return result.concat(assets);
1164
1174
  },
1165
1175
  []
@@ -1733,7 +1743,7 @@ export class ContentStore {
1733
1743
  contentSourceInstance: contentSourceData.instance,
1734
1744
  defaultLocaleCode: contentSourceData.defaultLocaleCode
1735
1745
  });
1736
- return mapStoreAssetsToAPIAssets(storeAssets, locale);
1746
+ return mapStoreAssetsToAPIAssets(storeAssets, this.staticAssetsPublicPath, locale);
1737
1747
  }
1738
1748
 
1739
1749
  async deleteDocument({
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * as ContentStoreTypes from './content-store-types';
10
10
  export { default as encodeData } from './encoder';
11
11
  export * from './encoder';
12
12
  export * from './types/search-filter';
13
+ export * from './services';
@@ -0,0 +1,229 @@
1
+ import _ from 'lodash';
2
+ import os from 'os';
3
+ import path from 'path';
4
+ import { v4 as uuid } from 'uuid';
5
+ import fse from 'fs-extra';
6
+
7
+ import { GitServiceInterface, GitFileObject, GitAuthor, GitCommitLogEntry, Logger } from '@stackbit/types';
8
+ import { Worker } from '@stackbit/utils';
9
+
10
+ import { RunService } from './run';
11
+ import { DocumentStatus } from '@stackbit/types';
12
+
13
+ const GIT_LOG_CHANGE_TYPES: Record<string, DocumentStatus> = {
14
+ M: 'modified',
15
+ A: 'added',
16
+ D: 'deleted'
17
+ };
18
+
19
+ export class GitService implements GitServiceInterface {
20
+ private readonly repoUrl: string;
21
+ private readonly repoDir: string;
22
+ private readonly repoBranch: string;
23
+ private readonly repoPublishBranch: string;
24
+ private readonly worker: Worker;
25
+ private readonly run: RunService;
26
+ private readonly logger: Logger;
27
+ private readonly userLogger: Logger;
28
+
29
+ private branchFetched: boolean = false;
30
+
31
+ constructor(options: {
32
+ repoUrl: string;
33
+ repoDir: string;
34
+ repoBranch: string;
35
+ repoPublishBranch: string;
36
+ worker: Worker;
37
+ runService: RunService;
38
+ logger: Logger;
39
+ userLogger: Logger;
40
+ }) {
41
+ this.repoUrl = options.repoUrl;
42
+ this.repoDir = options.repoDir;
43
+ this.repoBranch = options.repoBranch;
44
+ this.repoPublishBranch = options.repoPublishBranch;
45
+ this.worker = options.worker;
46
+ this.run = options.runService;
47
+ this.logger = options.logger;
48
+ this.userLogger = options.userLogger;
49
+ }
50
+
51
+ private async commit(author: GitAuthor, files: GitFileObject[]) {
52
+ const filePaths = _.map(files, 'filePath');
53
+ this.logger.debug('[git] Commit scheduled', filePaths);
54
+ return this.worker.schedule(async () => {
55
+ this.logger.debug('[git] Commit running', filePaths);
56
+ const message = files
57
+ .reduce((messages: string[], file) => {
58
+ messages.push(`${path.parse(file.filePath).base}: ${file.description}`);
59
+ return messages;
60
+ }, [])
61
+ .join('.\n');
62
+ await this.run.command('git', ['add', ...filePaths], this.repoDir);
63
+ await this.run.command(
64
+ 'git',
65
+ ['commit', '--no-verify', '--author', `${author.name || author.email} <${author.email}>`, '-m', message],
66
+ this.repoDir
67
+ );
68
+ this.logger.debug('[git] Commit done', filePaths);
69
+ });
70
+ }
71
+
72
+ private push() {
73
+ this.logger.debug('[git] Push scheduled');
74
+ return this.worker.schedule(async () => {
75
+ this.logger.debug('[git] Push running');
76
+ await this.run.command('git', ['pull', 'origin', '--rebase', '--autostash', '-Xtheirs'], this.repoDir);
77
+ await this.run.command('git', ['push', 'origin'], this.repoDir);
78
+ this.logger.debug('[git] Push done');
79
+ });
80
+ }
81
+
82
+ async commitAndPush(author: GitAuthor, files: GitFileObject[]) {
83
+ await this.commit(author, files);
84
+ return this.push();
85
+ }
86
+
87
+ pull() {
88
+ this.logger.debug('[git] Pull scheduled');
89
+ return this.worker.schedule(async () => {
90
+ this.logger.debug('[git] Pull running');
91
+ await this.run.command('git', ['pull', 'origin', '--rebase', '--autostash', '-Xtheirs'], this.repoDir);
92
+ this.logger.debug('[git] Pull done');
93
+ });
94
+ }
95
+
96
+ private async publishAll(author: GitAuthor) {
97
+ this.logger.debug('[git] Publish all started');
98
+ const publishDir = path.join(os.tmpdir(), uuid());
99
+ await this.run.command('git', ['clone', this.repoUrl, '--branch', this.repoPublishBranch, publishDir]);
100
+ try {
101
+ await this.run.command('git', ['merge', `origin/${this.repoBranch}`, this.repoPublishBranch, '-Xtheirs'], publishDir);
102
+ await this.run
103
+ .command('git', ['commit', '--author', `${author.name || author.email} <${author.email}>`, `-m`, 'Publish'], publishDir)
104
+ .catch(() => {});
105
+ await this.run.command('git', ['push', 'origin'], publishDir);
106
+ } finally {
107
+ await fse.remove(publishDir);
108
+ }
109
+ this.logger.debug('[git] Publish all done');
110
+ }
111
+
112
+ private async publishFiles(author: GitAuthor, filePaths: string[]) {
113
+ this.logger.debug('[git] Publish files started', filePaths);
114
+ const publishDir = path.join(os.tmpdir(), uuid());
115
+ await this.run.command('git', ['clone', this.repoUrl, '--branch', this.repoPublishBranch, publishDir]);
116
+ try {
117
+ await Promise.all(
118
+ filePaths.map(async (filePath) => {
119
+ const destFilePath = path.join(publishDir, filePath);
120
+ await fse.ensureDir(path.dirname(destFilePath));
121
+ return fse.copy(path.join(this.repoDir, filePath), destFilePath);
122
+ })
123
+ );
124
+
125
+ await this.run.command('git', ['checkout', '-b', 'stackbit-publish-branch'], publishDir);
126
+ await this.run.command('git', ['add', ...filePaths], publishDir);
127
+ await this.run.command('git', ['commit', '--author', `${author.name || author.email} <${author.email}>`, `-m`, 'Publish'], publishDir).catch(err => {
128
+ return;
129
+ });
130
+
131
+ await this.run.command('git', ['checkout', this.repoBranch], publishDir);
132
+ await this.run.command('git', ['merge', 'stackbit-publish-branch', this.repoBranch, '-Xtheirs'], publishDir);
133
+
134
+ await this.run.command('git', ['checkout', this.repoPublishBranch], publishDir);
135
+ await this.run.command('git', ['merge', 'stackbit-publish-branch', this.repoPublishBranch, '-Xtheirs'], publishDir);
136
+
137
+ await this.run.command('git', ['push', 'origin', this.repoPublishBranch, this.repoBranch], publishDir);
138
+ } finally {
139
+ await fse.remove(publishDir);
140
+ }
141
+ this.logger.debug('[git] Publish files done', filePaths);
142
+ }
143
+
144
+ publish(author: GitAuthor, filePaths?: string[]): Promise<void> {
145
+ this.logger.debug('[git] Publish scheduled');
146
+ return this.worker.schedule(async () => {
147
+ if (filePaths) {
148
+ if (!filePaths.length) {
149
+ this.logger.debug('[git] Nothing to publish');
150
+ return;
151
+ }
152
+ return this.publishFiles(author, filePaths);
153
+ } else {
154
+ return this.publishAll(author);
155
+ }
156
+ });
157
+ }
158
+
159
+ private parseGitCommitAuthor(author?: string) {
160
+ if (!author) {
161
+ return author;
162
+ }
163
+ const regex = /(.*)\((.*)\)/;
164
+ const match = author.match(regex);
165
+ if (match) {
166
+ const [authorEmail, authorName] = match.slice(1);
167
+
168
+ if (authorName === 'Stackbit Code Editor') {
169
+ return 'stackbit';
170
+ }
171
+ return authorEmail ? authorEmail.toLowerCase() : author;
172
+ }
173
+ return author;
174
+ }
175
+
176
+ async diff(): Promise<string[]> {
177
+ this.logger.debug('[git] Diff check scheduled');
178
+ return this.worker.schedule(async () => {
179
+ this.logger.debug('[git] Diff check running');
180
+ const result = await this.run.command(
181
+ 'git',
182
+ [
183
+ 'diff',
184
+ '--name-only',
185
+ '--no-renames', // this flag makes sure we get both old and new name of renamed file
186
+ `origin/${this.repoPublishBranch}..${this.repoBranch}`
187
+ ],
188
+ this.repoDir
189
+ );
190
+ this.logger.debug('[git] Diff check done');
191
+ return result.stdout.split('\n').filter(Boolean);
192
+ });
193
+ }
194
+
195
+ async commitLog(): Promise<GitCommitLogEntry[]> {
196
+ this.logger.debug('[git] Changes check scheduled');
197
+ return this.worker.schedule(async () => {
198
+ this.logger.debug('[git] Changes check running');
199
+ if (!this.branchFetched) {
200
+ await this.run.command('git', ['fetch', 'origin', `${this.repoPublishBranch}:${this.repoPublishBranch}`], this.repoDir);
201
+ this.branchFetched = true;
202
+ }
203
+ const logResult = await this.run.command(
204
+ 'git',
205
+ ['log', '--pretty=format:commit:%H%n%at%n%ae%x28%an%x29', '--name-status', `${this.repoPublishBranch}..${this.repoBranch}`],
206
+ this.repoDir
207
+ );
208
+ this.logger.debug('[git] Changes check done');
209
+ return logResult.stdout
210
+ .split('commit:')
211
+ .filter(Boolean)
212
+ .map((rawCommit) => {
213
+ const split = rawCommit.trim().split('\n');
214
+ return {
215
+ author: this.parseGitCommitAuthor(split[2]),
216
+ timestamp: split[1] ? new Date(parseInt(split[1]) * 1000) : undefined,
217
+ commitHash: split[0],
218
+ changes: split
219
+ .slice(3)
220
+ .map((line) => line.trim().split(/\t/))
221
+ .filter(Boolean)
222
+ .filter(([status, filename]) => status && filename)
223
+ .map(([status, filename]) => [GIT_LOG_CHANGE_TYPES[status!] || 'modified', filename])
224
+ };
225
+ })
226
+ .reverse();
227
+ });
228
+ }
229
+ }
@@ -0,0 +1,2 @@
1
+ export * from './run';
2
+ export * from './git';