@opentermsarchive/engine 10.3.2 → 10.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "10.3.2",
3
+ "version": "10.3.3",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -30,7 +30,7 @@ export default async function publish({ archivePath, releaseDate, stats }) {
30
30
  logger.info('Uploading release asset…');
31
31
 
32
32
  await octokit.rest.repos.uploadReleaseAsset({
33
- data: fsApi.readFileSync(archivePath),
33
+ data: fsApi.createReadStream(archivePath),
34
34
  headers: {
35
35
  'content-type': 'application/zip',
36
36
  'content-length': fsApi.statSync(archivePath).size,
@@ -22,26 +22,29 @@ export default async function publishRelease({ archivePath, releaseDate, stats }
22
22
  throw new Error('No publishing platform configured. Please configure at least one of: GitHub (OTA_ENGINE_GITHUB_TOKEN), GitLab (OTA_ENGINE_GITLAB_TOKEN), or data.gouv.fr (OTA_ENGINE_DATAGOUV_API_KEY + datasetId or organizationIdOrSlug in config).');
23
23
  }
24
24
 
25
- const results = await Promise.allSettled(platforms.map(async platform => {
26
- const url = await platform.publish();
27
-
28
- return { platform: platform.name, url };
29
- }));
30
-
31
- const succeeded = results.filter(result => result.status === 'fulfilled');
32
- const failed = results.filter(result => result.status === 'rejected');
25
+ const succeeded = [];
26
+ const failed = [];
27
+
28
+ // Execute publications sequentially to avoid memory issues with large file uploads
29
+ for (const platform of platforms) {
30
+ try {
31
+ const url = await platform.publish();
32
+
33
+ succeeded.push({ platform: platform.name, url });
34
+ } catch (error) {
35
+ failed.push({ platform: platform.name, error });
36
+ }
37
+ }
33
38
 
34
39
  if (failed.length) {
35
40
  let errorMessage = !succeeded.length ? 'All platforms failed to publish:' : 'Some platforms failed to publish:';
36
41
 
37
- failed.forEach(rejectedResult => {
38
- const index = results.indexOf(rejectedResult);
39
-
40
- errorMessage += `\n - ${platforms[index].name}: ${rejectedResult.reason.message}`;
42
+ failed.forEach(({ platform, error }) => {
43
+ errorMessage += `\n - ${platform}: ${error.message}`;
41
44
  });
42
45
 
43
46
  logger.error(errorMessage);
44
47
  }
45
48
 
46
- return succeeded.map(result => result.value);
49
+ return succeeded;
47
50
  }