screwdriver-api 8.0.162 → 8.0.164
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": "screwdriver-api",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.164",
|
|
4
4
|
"description": "API server for the Screwdriver.cd service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@hapi/inert": "^7.0.0",
|
|
86
86
|
"@hapi/vision": "^7.0.0",
|
|
87
87
|
"@promster/hapi": "^15.0.0",
|
|
88
|
-
"archiver": "^
|
|
88
|
+
"archiver": "^8.0.0",
|
|
89
89
|
"async": "^3.2.4",
|
|
90
90
|
"badge-maker": "^3.3.1",
|
|
91
91
|
"config": "^3.3.8",
|
|
@@ -5,7 +5,6 @@ const joi = require('joi');
|
|
|
5
5
|
const jwt = require('jsonwebtoken');
|
|
6
6
|
const request = require('got');
|
|
7
7
|
const schema = require('screwdriver-data-schema');
|
|
8
|
-
const archiver = require('archiver');
|
|
9
8
|
const { PassThrough } = require('stream');
|
|
10
9
|
const logger = require('screwdriver-logger');
|
|
11
10
|
const { v4: uuidv4 } = require('uuid');
|
|
@@ -13,6 +12,12 @@ const idSchema = schema.models.build.base.extract('id');
|
|
|
13
12
|
const artifactSchema = joi.string().label('Artifact Name');
|
|
14
13
|
const typeSchema = joi.string().default('preview').valid('download', 'preview').label('Flag to trigger type either to download or preview');
|
|
15
14
|
|
|
15
|
+
async function createZipArchive() {
|
|
16
|
+
const { ZipArchive } = await import('archiver');
|
|
17
|
+
|
|
18
|
+
return new ZipArchive({ zlib: { level: 9 } });
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
module.exports = config => ({
|
|
17
22
|
method: 'GET',
|
|
18
23
|
path: '/builds/{id}/artifacts/{name*}',
|
|
@@ -90,7 +95,7 @@ module.exports = config => ({
|
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
// Create a stream and set up archiver
|
|
93
|
-
const archive =
|
|
98
|
+
const archive = await createZipArchive();
|
|
94
99
|
const passThrough = new PassThrough();
|
|
95
100
|
|
|
96
101
|
// Handle archiver errors
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const archiver = require('archiver');
|
|
4
3
|
const boom = require('@hapi/boom');
|
|
5
4
|
const request = require('got');
|
|
6
5
|
const joi = require('joi');
|
|
@@ -11,6 +10,12 @@ const schema = require('screwdriver-data-schema');
|
|
|
11
10
|
const { v4: uuidv4 } = require('uuid');
|
|
12
11
|
const idSchema = schema.models.build.base.extract('id');
|
|
13
12
|
|
|
13
|
+
async function createZipArchive() {
|
|
14
|
+
const { ZipArchive } = await import('archiver');
|
|
15
|
+
|
|
16
|
+
return new ZipArchive({ zlib: { level: 9 } });
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
|
|
15
20
|
module.exports = config => ({
|
|
16
21
|
method: 'GET',
|
|
@@ -63,7 +68,7 @@ module.exports = config => ({
|
|
|
63
68
|
const manifestArray = manifest.trim().split('\n');
|
|
64
69
|
|
|
65
70
|
// Create a stream and set up archiver
|
|
66
|
-
const archive =
|
|
71
|
+
const archive = await createZipArchive();
|
|
67
72
|
// PassThrough stream to make archiver readable by Hapi
|
|
68
73
|
const passThrough = new PassThrough();
|
|
69
74
|
|
package/plugins/versions.js
CHANGED
|
@@ -179,8 +179,9 @@ function collectPackage(pkgDir, data) {
|
|
|
179
179
|
|
|
180
180
|
const json = readJson(packageJsonPath);
|
|
181
181
|
const key = `${json.name}@${json.version}`;
|
|
182
|
+
const hasIdentity = json.name && json.version;
|
|
182
183
|
|
|
183
|
-
if (
|
|
184
|
+
if (hasIdentity && data[key]) {
|
|
184
185
|
return data;
|
|
185
186
|
}
|
|
186
187
|
|
|
@@ -234,7 +235,9 @@ function collectPackage(pkgDir, data) {
|
|
|
234
235
|
moduleInfo.licenses = UNLICENSED;
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
|
|
238
|
+
if (hasIdentity) {
|
|
239
|
+
data[key] = moduleInfo;
|
|
240
|
+
}
|
|
238
241
|
|
|
239
242
|
[json.dependencies, json.optionalDependencies, json.peerDependencies].forEach(dependencies => {
|
|
240
243
|
Object.keys(dependencies || {}).forEach(depName => {
|