@front10/danger-plugins 2.0.0-alpha.2 → 2.0.0-alpha.5
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/dist/danger-plugins.cjs.development.js +57 -211
- package/dist/danger-plugins.cjs.development.js.map +1 -1
- package/dist/danger-plugins.cjs.production.min.js +1 -1
- package/dist/danger-plugins.cjs.production.min.js.map +1 -1
- package/dist/danger-plugins.esm.js +58 -212
- package/dist/danger-plugins.esm.js.map +1 -1
- package/dist/plugin-netlify.d.ts +7 -10
- package/package.json +2 -3
- package/src/plugin-bundle-size.ts +11 -8
- package/src/plugin-netlify.ts +9 -47
- package/src/types.d.ts +0 -223
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import NetlifyAPI from 'netlify';
|
|
2
1
|
import fs__default, { existsSync, readFileSync, readdirSync, lstatSync, readFile as readFile$1 } from 'fs';
|
|
3
|
-
import { fetch } from 'undici';
|
|
2
|
+
import { Headers, fetch } from 'undici';
|
|
4
3
|
import path from 'path';
|
|
5
4
|
import zlib from 'zlib';
|
|
6
5
|
import { promisify } from 'util';
|
|
@@ -41,81 +40,6 @@ function _asyncToGenerator(fn) {
|
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
function _extends() {
|
|
45
|
-
_extends = Object.assign || function (target) {
|
|
46
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
47
|
-
var source = arguments[i];
|
|
48
|
-
|
|
49
|
-
for (var key in source) {
|
|
50
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
51
|
-
target[key] = source[key];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return target;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return _extends.apply(this, arguments);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
63
|
-
if (source == null) return {};
|
|
64
|
-
var target = {};
|
|
65
|
-
var sourceKeys = Object.keys(source);
|
|
66
|
-
var key, i;
|
|
67
|
-
|
|
68
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
69
|
-
key = sourceKeys[i];
|
|
70
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
71
|
-
target[key] = source[key];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return target;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
78
|
-
if (!o) return;
|
|
79
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
80
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
81
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
82
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
83
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function _arrayLikeToArray(arr, len) {
|
|
87
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
88
|
-
|
|
89
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
90
|
-
|
|
91
|
-
return arr2;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
95
|
-
var it;
|
|
96
|
-
|
|
97
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
98
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
99
|
-
if (it) o = it;
|
|
100
|
-
var i = 0;
|
|
101
|
-
return function () {
|
|
102
|
-
if (i >= o.length) return {
|
|
103
|
-
done: true
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
done: false,
|
|
107
|
-
value: o[i++]
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
it = o[Symbol.iterator]();
|
|
116
|
-
return it.next.bind(it);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
43
|
function createCommonjsModule(fn, module) {
|
|
120
44
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
121
45
|
}
|
|
@@ -138,24 +62,6 @@ var runtime = (function (exports) {
|
|
|
138
62
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
139
63
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
140
64
|
|
|
141
|
-
function define(obj, key, value) {
|
|
142
|
-
Object.defineProperty(obj, key, {
|
|
143
|
-
value: value,
|
|
144
|
-
enumerable: true,
|
|
145
|
-
configurable: true,
|
|
146
|
-
writable: true
|
|
147
|
-
});
|
|
148
|
-
return obj[key];
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
152
|
-
define({}, "");
|
|
153
|
-
} catch (err) {
|
|
154
|
-
define = function(obj, key, value) {
|
|
155
|
-
return obj[key] = value;
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
65
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
160
66
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
161
67
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
@@ -208,9 +114,9 @@ var runtime = (function (exports) {
|
|
|
208
114
|
// This is a polyfill for %IteratorPrototype% for environments that
|
|
209
115
|
// don't natively support it.
|
|
210
116
|
var IteratorPrototype = {};
|
|
211
|
-
|
|
117
|
+
IteratorPrototype[iteratorSymbol] = function () {
|
|
212
118
|
return this;
|
|
213
|
-
}
|
|
119
|
+
};
|
|
214
120
|
|
|
215
121
|
var getProto = Object.getPrototypeOf;
|
|
216
122
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
@@ -224,22 +130,18 @@ var runtime = (function (exports) {
|
|
|
224
130
|
|
|
225
131
|
var Gp = GeneratorFunctionPrototype.prototype =
|
|
226
132
|
Generator.prototype = Object.create(IteratorPrototype);
|
|
227
|
-
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
GeneratorFunctionPrototype,
|
|
232
|
-
toStringTagSymbol,
|
|
233
|
-
"GeneratorFunction"
|
|
234
|
-
);
|
|
133
|
+
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
134
|
+
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
135
|
+
GeneratorFunctionPrototype[toStringTagSymbol] =
|
|
136
|
+
GeneratorFunction.displayName = "GeneratorFunction";
|
|
235
137
|
|
|
236
138
|
// Helper for defining the .next, .throw, and .return methods of the
|
|
237
139
|
// Iterator interface in terms of a single ._invoke method.
|
|
238
140
|
function defineIteratorMethods(prototype) {
|
|
239
141
|
["next", "throw", "return"].forEach(function(method) {
|
|
240
|
-
|
|
142
|
+
prototype[method] = function(arg) {
|
|
241
143
|
return this._invoke(method, arg);
|
|
242
|
-
}
|
|
144
|
+
};
|
|
243
145
|
});
|
|
244
146
|
}
|
|
245
147
|
|
|
@@ -258,7 +160,9 @@ var runtime = (function (exports) {
|
|
|
258
160
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
259
161
|
} else {
|
|
260
162
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
261
|
-
|
|
163
|
+
if (!(toStringTagSymbol in genFun)) {
|
|
164
|
+
genFun[toStringTagSymbol] = "GeneratorFunction";
|
|
165
|
+
}
|
|
262
166
|
}
|
|
263
167
|
genFun.prototype = Object.create(Gp);
|
|
264
168
|
return genFun;
|
|
@@ -340,9 +244,9 @@ var runtime = (function (exports) {
|
|
|
340
244
|
}
|
|
341
245
|
|
|
342
246
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
343
|
-
|
|
247
|
+
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
344
248
|
return this;
|
|
345
|
-
}
|
|
249
|
+
};
|
|
346
250
|
exports.AsyncIterator = AsyncIterator;
|
|
347
251
|
|
|
348
252
|
// Note that simple async functions are implemented on top of
|
|
@@ -528,20 +432,20 @@ var runtime = (function (exports) {
|
|
|
528
432
|
// unified ._invoke helper method.
|
|
529
433
|
defineIteratorMethods(Gp);
|
|
530
434
|
|
|
531
|
-
|
|
435
|
+
Gp[toStringTagSymbol] = "Generator";
|
|
532
436
|
|
|
533
437
|
// A Generator should always return itself as the iterator object when the
|
|
534
438
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
535
439
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
536
440
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
537
441
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
538
|
-
|
|
442
|
+
Gp[iteratorSymbol] = function() {
|
|
539
443
|
return this;
|
|
540
|
-
}
|
|
444
|
+
};
|
|
541
445
|
|
|
542
|
-
|
|
446
|
+
Gp.toString = function() {
|
|
543
447
|
return "[object Generator]";
|
|
544
|
-
}
|
|
448
|
+
};
|
|
545
449
|
|
|
546
450
|
function pushTryEntry(locs) {
|
|
547
451
|
var entry = { tryLoc: locs[0] };
|
|
@@ -860,49 +764,24 @@ try {
|
|
|
860
764
|
} catch (accidentalStrictMode) {
|
|
861
765
|
// This module should not be running in strict mode, so the above
|
|
862
766
|
// assignment should always work unless something is misconfigured. Just
|
|
863
|
-
// in case runtime.js accidentally runs in strict mode,
|
|
864
|
-
// we can explicitly access globalThis. In older engines we can escape
|
|
767
|
+
// in case runtime.js accidentally runs in strict mode, we can escape
|
|
865
768
|
// strict mode using a global Function call. This could conceivably fail
|
|
866
769
|
// if a Content Security Policy forbids using Function, but in that case
|
|
867
770
|
// the proper solution is to fix the accidental strict mode problem. If
|
|
868
771
|
// you've misconfigured your bundler to force strict mode and applied a
|
|
869
772
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|
870
773
|
// problems, please detail your unique predicament in a GitHub issue.
|
|
871
|
-
|
|
872
|
-
globalThis.regeneratorRuntime = runtime;
|
|
873
|
-
} else {
|
|
874
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
875
|
-
}
|
|
774
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
876
775
|
}
|
|
877
776
|
});
|
|
878
777
|
|
|
879
|
-
function
|
|
880
|
-
|
|
881
|
-
buildDir = _ref.buildDir,
|
|
882
|
-
customClient = _ref.client,
|
|
883
|
-
configRest = _objectWithoutPropertiesLoose(_ref, ["siteId", "buildDir", "client"]);
|
|
884
|
-
|
|
885
|
-
var client = customClient;
|
|
886
|
-
|
|
887
|
-
if (!client) {
|
|
888
|
-
var authToken = process.env.NETLIFY_AUTH_TOKEN;
|
|
889
|
-
client = new NetlifyAPI(authToken);
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
return client.deploy(siteId, buildDir, _extends({
|
|
893
|
-
statusCb: function statusCb(statusObj) {
|
|
894
|
-
console.log(statusObj.msg);
|
|
895
|
-
}
|
|
896
|
-
}, configRest));
|
|
778
|
+
function deployment(_x) {
|
|
779
|
+
return _deployment.apply(this, arguments);
|
|
897
780
|
}
|
|
898
|
-
function deploy(_x) {
|
|
899
|
-
return _deploy.apply(this, arguments);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
function _deploy() {
|
|
903
|
-
_deploy = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(configs) {
|
|
904
|
-
var authToken, client, message, deployResults, _iterator, _step, config, result, lastCommit;
|
|
905
781
|
|
|
782
|
+
function _deployment() {
|
|
783
|
+
_deployment = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(configs) {
|
|
784
|
+
var authToken, lastCommit;
|
|
906
785
|
return runtime_1.wrap(function _callee$(_context) {
|
|
907
786
|
while (1) {
|
|
908
787
|
switch (_context.prev = _context.next) {
|
|
@@ -913,66 +792,29 @@ function _deploy() {
|
|
|
913
792
|
fail("Couldn't get deploy information. You need to set up an authentication \n token in your environment variables. \n See: https://gitlab.com/help/ci/variables/README#variables");
|
|
914
793
|
}
|
|
915
794
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
795
|
+
try {
|
|
796
|
+
lastCommit = danger.git.commits[0];
|
|
797
|
+
markdown(["## Deploy preview", "The deploy preview is ready!", "Built with commit " + lastCommit.sha].concat(configs.map(function (result) {
|
|
798
|
+
return result.label + ": " + result.deploy_url;
|
|
799
|
+
})).join("\n\n"));
|
|
800
|
+
} catch (e) {
|
|
801
|
+
console.error(e);
|
|
802
|
+
fail("Couldn't get deploy information.");
|
|
921
803
|
}
|
|
922
804
|
|
|
923
|
-
|
|
924
|
-
_iterator = _createForOfIteratorHelperLoose(configs);
|
|
925
|
-
|
|
926
|
-
case 7:
|
|
927
|
-
if ((_step = _iterator()).done) {
|
|
928
|
-
_context.next = 15;
|
|
929
|
-
break;
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
config = _step.value;
|
|
933
|
-
_context.next = 11;
|
|
934
|
-
return deploySite(_extends({
|
|
935
|
-
client: client,
|
|
936
|
-
message: message,
|
|
937
|
-
draft: true
|
|
938
|
-
}, config));
|
|
939
|
-
|
|
940
|
-
case 11:
|
|
941
|
-
result = _context.sent;
|
|
942
|
-
deployResults.push(result);
|
|
943
|
-
|
|
944
|
-
case 13:
|
|
945
|
-
_context.next = 7;
|
|
946
|
-
break;
|
|
947
|
-
|
|
948
|
-
case 15:
|
|
949
|
-
lastCommit = danger.git.commits[0];
|
|
950
|
-
markdown(["## Deploy preview", "Deploy preview for *front10-ui* ready!", "Built with commit " + lastCommit.sha].concat(deployResults.map(function (result, index) {
|
|
951
|
-
return configs[index].label + ": " + result.deploy.deploy_ssl_url;
|
|
952
|
-
})).join("\n\n"));
|
|
953
|
-
_context.next = 23;
|
|
954
|
-
break;
|
|
955
|
-
|
|
956
|
-
case 19:
|
|
957
|
-
_context.prev = 19;
|
|
958
|
-
_context.t0 = _context["catch"](2);
|
|
959
|
-
console.error(_context.t0);
|
|
960
|
-
fail("Couldn't get deploy information.");
|
|
961
|
-
|
|
962
|
-
case 23:
|
|
805
|
+
case 3:
|
|
963
806
|
case "end":
|
|
964
807
|
return _context.stop();
|
|
965
808
|
}
|
|
966
809
|
}
|
|
967
|
-
}, _callee
|
|
810
|
+
}, _callee);
|
|
968
811
|
}));
|
|
969
|
-
return
|
|
812
|
+
return _deployment.apply(this, arguments);
|
|
970
813
|
}
|
|
971
814
|
|
|
972
815
|
var pluginNetlify = {
|
|
973
816
|
__proto__: null,
|
|
974
|
-
|
|
975
|
-
deploy: deploy
|
|
817
|
+
deployment: deployment
|
|
976
818
|
};
|
|
977
819
|
|
|
978
820
|
/**
|
|
@@ -1092,7 +934,7 @@ function bundleSize(_x) {
|
|
|
1092
934
|
|
|
1093
935
|
function _bundleSize() {
|
|
1094
936
|
_bundleSize = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(options) {
|
|
1095
|
-
var results, reportPath, _options$baseBundleJo, baseBundleJob, baseResults, projectId, authToken, targetBranch, baseBundlesUrl,
|
|
937
|
+
var results, reportPath, _options$baseBundleJo, baseBundleJob, baseResults, projectId, authToken, targetBranch, baseBundlesUrl, _headers, baseBundlesResponse, baseBundles, diffHeaders, _baseResults, bundles, brotli, gzip, headers, body;
|
|
1096
938
|
|
|
1097
939
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1098
940
|
while (1) {
|
|
@@ -1102,36 +944,40 @@ function _bundleSize() {
|
|
|
1102
944
|
reportPath = options.reportPath, _options$baseBundleJo = options.baseBundleJob, baseBundleJob = _options$baseBundleJo === void 0 ? "publish" : _options$baseBundleJo;
|
|
1103
945
|
|
|
1104
946
|
if (!reportPath) {
|
|
1105
|
-
_context.next =
|
|
947
|
+
_context.next = 16;
|
|
1106
948
|
break;
|
|
1107
949
|
}
|
|
1108
950
|
|
|
1109
951
|
projectId = process.env.CI_MERGE_REQUEST_PROJECT_ID;
|
|
1110
952
|
authToken = process.env.DANGER_GITLAB_API_TOKEN;
|
|
1111
|
-
targetBranch = process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME || "
|
|
953
|
+
targetBranch = process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME || "main";
|
|
1112
954
|
baseBundlesUrl = "https://gitlab.com/api/v4/projects/" + projectId + "/jobs/artifacts/" + targetBranch + "/raw/" + reportPath + "?job=" + baseBundleJob;
|
|
1113
|
-
|
|
955
|
+
_headers = new Headers();
|
|
956
|
+
|
|
957
|
+
if (authToken) {
|
|
958
|
+
_headers.set("PRIVATE-TOKEN", authToken);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
_context.next = 11;
|
|
1114
962
|
return fetch(baseBundlesUrl, {
|
|
1115
|
-
headers:
|
|
1116
|
-
"PRIVATE-TOKEN": authToken
|
|
1117
|
-
}
|
|
963
|
+
headers: _headers
|
|
1118
964
|
});
|
|
1119
965
|
|
|
1120
|
-
case
|
|
1121
|
-
|
|
966
|
+
case 11:
|
|
967
|
+
baseBundlesResponse = _context.sent;
|
|
1122
968
|
|
|
1123
|
-
if (!
|
|
1124
|
-
_context.next =
|
|
969
|
+
if (!baseBundlesResponse.ok) {
|
|
970
|
+
_context.next = 16;
|
|
1125
971
|
break;
|
|
1126
972
|
}
|
|
1127
973
|
|
|
1128
|
-
_context.next =
|
|
1129
|
-
return
|
|
974
|
+
_context.next = 15;
|
|
975
|
+
return baseBundlesResponse.json();
|
|
1130
976
|
|
|
1131
|
-
case
|
|
977
|
+
case 15:
|
|
1132
978
|
baseResults = _context.sent;
|
|
1133
979
|
|
|
1134
|
-
case
|
|
980
|
+
case 16:
|
|
1135
981
|
baseBundles = new Map();
|
|
1136
982
|
diffHeaders = [];
|
|
1137
983
|
|
|
@@ -1172,7 +1018,7 @@ function _bundleSize() {
|
|
|
1172
1018
|
});
|
|
1173
1019
|
markdown(["## Bundle size", generateMDTable(headers, body)].join("\n\n"));
|
|
1174
1020
|
|
|
1175
|
-
case
|
|
1021
|
+
case 22:
|
|
1176
1022
|
case "end":
|
|
1177
1023
|
return _context.stop();
|
|
1178
1024
|
}
|