@atlaskit/dependency-version-analytics 0.4.1 → 1.0.0
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/CHANGELOG.md +12 -0
- package/dist/cjs/cli.js +4 -18
- package/dist/cjs/commands/populate-historic-data/index.js +0 -3
- package/dist/cjs/commands/populate-historic-data/lib/dependency-store.js +24 -141
- package/dist/cjs/commands/populate-historic-data/package.js +3 -27
- package/dist/cjs/commands/populate-historic-data/product.js +15 -88
- package/dist/cjs/commands/populate-historic-data/util/generate-csv.js +4 -16
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/util/analytics.js +0 -38
- package/dist/cjs/util/assert.js +0 -1
- package/dist/cjs/util/env-with-guard.js +0 -2
- package/dist/cjs/util/get-file-history-from-git.js +0 -5
- package/dist/cjs/util/get-package-version-history.js +0 -6
- package/dist/cjs/util/git.js +20 -58
- package/dist/cjs/util/statlas.js +0 -25
- package/dist/cjs/util/yarn.js +0 -32
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/cli.js +4 -8
- package/dist/es2019/commands/populate-historic-data/lib/dependency-store.js +24 -73
- package/dist/es2019/commands/populate-historic-data/package.js +0 -8
- package/dist/es2019/commands/populate-historic-data/product.js +4 -22
- package/dist/es2019/commands/populate-historic-data/util/generate-csv.js +2 -9
- package/dist/es2019/util/analytics.js +4 -19
- package/dist/es2019/util/env-with-guard.js +0 -1
- package/dist/es2019/util/get-file-history-from-git.js +2 -3
- package/dist/es2019/util/get-package-version-history.js +0 -4
- package/dist/es2019/util/git.js +29 -24
- package/dist/es2019/util/statlas.js +0 -6
- package/dist/es2019/util/yarn.js +2 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/cli.js +6 -12
- package/dist/esm/commands/populate-historic-data/lib/dependency-store.js +27 -131
- package/dist/esm/commands/populate-historic-data/package.js +3 -20
- package/dist/esm/commands/populate-historic-data/product.js +15 -72
- package/dist/esm/commands/populate-historic-data/util/generate-csv.js +4 -13
- package/dist/esm/util/analytics.js +2 -28
- package/dist/esm/util/env-with-guard.js +0 -1
- package/dist/esm/util/get-file-history-from-git.js +2 -3
- package/dist/esm/util/get-package-version-history.js +0 -4
- package/dist/esm/util/git.js +21 -50
- package/dist/esm/util/statlas.js +0 -19
- package/dist/esm/util/yarn.js +0 -19
- package/dist/esm/version.json +1 -1
- package/package.json +4 -4
- package/report.api.md +1 -1
package/dist/cjs/util/git.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -12,27 +11,17 @@ exports.getHash = getHash;
|
|
|
12
11
|
exports.refetchTag = refetchTag;
|
|
13
12
|
exports.showFile = showFile;
|
|
14
13
|
exports.tagCommit = tagCommit;
|
|
15
|
-
|
|
16
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
17
|
-
|
|
18
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
|
|
20
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
21
|
-
|
|
22
17
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
23
|
-
|
|
24
18
|
var _simpleGit = _interopRequireDefault(require("simple-git"));
|
|
25
|
-
|
|
26
19
|
var _assert = require("./assert");
|
|
27
|
-
|
|
28
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
-
|
|
30
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
-
|
|
32
22
|
function getChangesSince(_x) {
|
|
33
23
|
return _getChangesSince.apply(this, arguments);
|
|
34
24
|
}
|
|
35
|
-
|
|
36
25
|
function _getChangesSince() {
|
|
37
26
|
_getChangesSince = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(since) {
|
|
38
27
|
var revisionRange, listLogSummary;
|
|
@@ -42,14 +31,19 @@ function _getChangesSince() {
|
|
|
42
31
|
case 0:
|
|
43
32
|
revisionRange = since ? ["".concat(since, "..")] : [];
|
|
44
33
|
_context.next = 3;
|
|
45
|
-
return (0, _simpleGit.default)().log([
|
|
46
|
-
|
|
47
|
-
'-
|
|
48
|
-
|
|
49
|
-
'
|
|
50
|
-
|
|
34
|
+
return (0, _simpleGit.default)().log([
|
|
35
|
+
// Only commits on mainline master
|
|
36
|
+
'--first-parent',
|
|
37
|
+
// Show merge commit contents
|
|
38
|
+
'-m',
|
|
39
|
+
// Reverse the order
|
|
40
|
+
'--reverse',
|
|
41
|
+
// Show filename changes - simple-git parses --stat flag but not --name-only unfortunately
|
|
42
|
+
'--stat=4096',
|
|
43
|
+
// Make +- graph width as small as possible to maximise filename length
|
|
44
|
+
'--stat-graph-width=1'].concat(revisionRange, [
|
|
45
|
+
// Any commit that modifies a package.json
|
|
51
46
|
':(glob)**/package.json']));
|
|
52
|
-
|
|
53
47
|
case 3:
|
|
54
48
|
listLogSummary = _context.sent;
|
|
55
49
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, listLogSummary), {}, {
|
|
@@ -57,7 +51,6 @@ function _getChangesSince() {
|
|
|
57
51
|
return parseLogLine(logLine);
|
|
58
52
|
})
|
|
59
53
|
}));
|
|
60
|
-
|
|
61
54
|
case 5:
|
|
62
55
|
case "end":
|
|
63
56
|
return _context.stop();
|
|
@@ -67,22 +60,19 @@ function _getChangesSince() {
|
|
|
67
60
|
}));
|
|
68
61
|
return _getChangesSince.apply(this, arguments);
|
|
69
62
|
}
|
|
70
|
-
|
|
71
63
|
function parseLogLine(logLine) {
|
|
72
64
|
if (!logLine.diff) {
|
|
73
65
|
return logLine;
|
|
74
|
-
}
|
|
75
|
-
|
|
66
|
+
}
|
|
76
67
|
|
|
68
|
+
// Split files into separate entries when a rename has occurred so both old and new files are processed
|
|
77
69
|
var parsedDiffFiles = logLine.diff.files.reduce(function (acc, curr) {
|
|
78
70
|
var renameArrowCount = curr.file.match(/ => /g);
|
|
79
|
-
|
|
80
71
|
if (renameArrowCount == null) {
|
|
81
72
|
return [].concat((0, _toConsumableArray2.default)(acc), [curr]);
|
|
82
|
-
}
|
|
73
|
+
}
|
|
74
|
+
// Multiple rename parts are not supported. They most likely don't exist in git but we check
|
|
83
75
|
// for them anyway just in case
|
|
84
|
-
|
|
85
|
-
|
|
86
76
|
(0, _assert.assert)(renameArrowCount.length === 1, "Multiple rename parts detected: ".concat(curr.file));
|
|
87
77
|
/* Matches:
|
|
88
78
|
* - '{new-frontend/src => src}/package.json'
|
|
@@ -90,10 +80,10 @@ function parseLogLine(logLine) {
|
|
|
90
80
|
* - 'src/{ => platform}/analytics/package.json'
|
|
91
81
|
* - 'src/packages/spa/{main => }/package.json'
|
|
92
82
|
*/
|
|
93
|
-
|
|
94
83
|
var renameMatch = curr.file.match(/\{?([^{]+)? => ([^}]+)?\}?/);
|
|
95
84
|
(0, _assert.assert)(renameMatch != null, "Invalid rename format ".concat(curr.file));
|
|
96
|
-
var oldFile = curr.file.replace(renameMatch[0], renameMatch[1] || '')
|
|
85
|
+
var oldFile = curr.file.replace(renameMatch[0], renameMatch[1] || '')
|
|
86
|
+
// If the previous name segment is empty, we will have a double slash
|
|
97
87
|
.replace('//', '/');
|
|
98
88
|
var newFile = curr.file.replace(renameMatch[0], renameMatch[2] || '').replace('//', '/');
|
|
99
89
|
return [].concat((0, _toConsumableArray2.default)(acc), [_objectSpread(_objectSpread({}, curr), {}, {
|
|
@@ -108,11 +98,9 @@ function parseLogLine(logLine) {
|
|
|
108
98
|
})
|
|
109
99
|
});
|
|
110
100
|
}
|
|
111
|
-
|
|
112
101
|
function tagCommit(_x2) {
|
|
113
102
|
return _tagCommit.apply(this, arguments);
|
|
114
103
|
}
|
|
115
|
-
|
|
116
104
|
function _tagCommit() {
|
|
117
105
|
_tagCommit = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(tag) {
|
|
118
106
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
@@ -120,7 +108,6 @@ function _tagCommit() {
|
|
|
120
108
|
switch (_context2.prev = _context2.next) {
|
|
121
109
|
case 0:
|
|
122
110
|
return _context2.abrupt("return", (0, _simpleGit.default)().tag(['-f', tag]));
|
|
123
|
-
|
|
124
111
|
case 1:
|
|
125
112
|
case "end":
|
|
126
113
|
return _context2.stop();
|
|
@@ -130,11 +117,9 @@ function _tagCommit() {
|
|
|
130
117
|
}));
|
|
131
118
|
return _tagCommit.apply(this, arguments);
|
|
132
119
|
}
|
|
133
|
-
|
|
134
120
|
function doesTagExist(_x3) {
|
|
135
121
|
return _doesTagExist.apply(this, arguments);
|
|
136
122
|
}
|
|
137
|
-
|
|
138
123
|
function _doesTagExist() {
|
|
139
124
|
_doesTagExist = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(tag) {
|
|
140
125
|
var tags;
|
|
@@ -144,11 +129,9 @@ function _doesTagExist() {
|
|
|
144
129
|
case 0:
|
|
145
130
|
_context3.next = 2;
|
|
146
131
|
return (0, _simpleGit.default)().tags((0, _defineProperty2.default)({}, tag, null));
|
|
147
|
-
|
|
148
132
|
case 2:
|
|
149
133
|
tags = _context3.sent;
|
|
150
134
|
return _context3.abrupt("return", tags.all.length > 0);
|
|
151
|
-
|
|
152
135
|
case 4:
|
|
153
136
|
case "end":
|
|
154
137
|
return _context3.stop();
|
|
@@ -158,11 +141,9 @@ function _doesTagExist() {
|
|
|
158
141
|
}));
|
|
159
142
|
return _doesTagExist.apply(this, arguments);
|
|
160
143
|
}
|
|
161
|
-
|
|
162
144
|
function refetchTag(_x4) {
|
|
163
145
|
return _refetchTag.apply(this, arguments);
|
|
164
146
|
}
|
|
165
|
-
|
|
166
147
|
function _refetchTag() {
|
|
167
148
|
_refetchTag = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(tag) {
|
|
168
149
|
var fetchTagResult;
|
|
@@ -173,48 +154,37 @@ function _refetchTag() {
|
|
|
173
154
|
_context4.prev = 0;
|
|
174
155
|
_context4.next = 3;
|
|
175
156
|
return (0, _simpleGit.default)().tag(['-d', tag]);
|
|
176
|
-
|
|
177
157
|
case 3:
|
|
178
158
|
_context4.next = 9;
|
|
179
159
|
break;
|
|
180
|
-
|
|
181
160
|
case 5:
|
|
182
161
|
_context4.prev = 5;
|
|
183
162
|
_context4.t0 = _context4["catch"](0);
|
|
184
|
-
|
|
185
163
|
if (/tag.*not found/.test(_context4.t0.message)) {
|
|
186
164
|
_context4.next = 9;
|
|
187
165
|
break;
|
|
188
166
|
}
|
|
189
|
-
|
|
190
167
|
throw _context4.t0;
|
|
191
|
-
|
|
192
168
|
case 9:
|
|
193
169
|
_context4.prev = 9;
|
|
194
170
|
_context4.next = 12;
|
|
195
171
|
return (0, _simpleGit.default)().fetch(['origin', 'tag', tag]);
|
|
196
|
-
|
|
197
172
|
case 12:
|
|
198
173
|
fetchTagResult = _context4.sent;
|
|
199
174
|
_context4.next = 19;
|
|
200
175
|
break;
|
|
201
|
-
|
|
202
176
|
case 15:
|
|
203
177
|
_context4.prev = 15;
|
|
204
178
|
_context4.t1 = _context4["catch"](9);
|
|
205
|
-
|
|
206
179
|
if (/Couldn't find remote ref refs\/tags\//.test(_context4.t1.message)) {
|
|
207
180
|
_context4.next = 19;
|
|
208
181
|
break;
|
|
209
182
|
}
|
|
210
|
-
|
|
211
183
|
throw _context4.t1;
|
|
212
|
-
|
|
213
184
|
case 19:
|
|
214
185
|
return _context4.abrupt("return", {
|
|
215
186
|
fetchTagResult: fetchTagResult
|
|
216
187
|
});
|
|
217
|
-
|
|
218
188
|
case 20:
|
|
219
189
|
case "end":
|
|
220
190
|
return _context4.stop();
|
|
@@ -224,11 +194,9 @@ function _refetchTag() {
|
|
|
224
194
|
}));
|
|
225
195
|
return _refetchTag.apply(this, arguments);
|
|
226
196
|
}
|
|
227
|
-
|
|
228
197
|
function getHash(_x5) {
|
|
229
198
|
return _getHash.apply(this, arguments);
|
|
230
199
|
}
|
|
231
|
-
|
|
232
200
|
function _getHash() {
|
|
233
201
|
_getHash = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(ref) {
|
|
234
202
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
@@ -236,7 +204,6 @@ function _getHash() {
|
|
|
236
204
|
switch (_context5.prev = _context5.next) {
|
|
237
205
|
case 0:
|
|
238
206
|
return _context5.abrupt("return", (0, _simpleGit.default)().revparse([ref]));
|
|
239
|
-
|
|
240
207
|
case 1:
|
|
241
208
|
case "end":
|
|
242
209
|
return _context5.stop();
|
|
@@ -246,21 +213,18 @@ function _getHash() {
|
|
|
246
213
|
}));
|
|
247
214
|
return _getHash.apply(this, arguments);
|
|
248
215
|
}
|
|
249
|
-
|
|
250
216
|
function showFile(ref, filename) {
|
|
251
217
|
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
252
218
|
return (0, _simpleGit.default)(opts.cwd || process.cwd()).show(["".concat(ref, ":").concat(filename)]);
|
|
253
219
|
}
|
|
254
|
-
|
|
255
220
|
function getFiles(_x6, _x7) {
|
|
256
221
|
return _getFiles.apply(this, arguments);
|
|
257
222
|
}
|
|
258
|
-
|
|
259
223
|
function _getFiles() {
|
|
260
224
|
_getFiles = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(ref, glob) {
|
|
261
225
|
var opts,
|
|
262
|
-
|
|
263
|
-
|
|
226
|
+
result,
|
|
227
|
+
_args6 = arguments;
|
|
264
228
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
265
229
|
while (1) {
|
|
266
230
|
switch (_context6.prev = _context6.next) {
|
|
@@ -268,7 +232,6 @@ function _getFiles() {
|
|
|
268
232
|
opts = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
|
|
269
233
|
_context6.next = 3;
|
|
270
234
|
return (0, _simpleGit.default)(opts.cwd || process.cwd()).raw(['grep', '--name-only', '', ref, '--', ":(glob)".concat(glob)]);
|
|
271
|
-
|
|
272
235
|
case 3:
|
|
273
236
|
result = _context6.sent;
|
|
274
237
|
return _context6.abrupt("return", result.split('\n').filter(function (line) {
|
|
@@ -276,7 +239,6 @@ function _getFiles() {
|
|
|
276
239
|
}).map(function (line) {
|
|
277
240
|
return line.split(':')[1];
|
|
278
241
|
}));
|
|
279
|
-
|
|
280
242
|
case 5:
|
|
281
243
|
case "end":
|
|
282
244
|
return _context6.stop();
|
package/dist/cjs/util/statlas.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.getMeta = getMeta;
|
|
9
8
|
exports.uploadMeta = uploadMeta;
|
|
10
|
-
|
|
11
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
-
|
|
13
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
-
|
|
15
11
|
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
16
|
-
|
|
17
12
|
var STATLAS_BASE_URL = 'https://statlas.prod.atl-paas.net/af-product-analytics';
|
|
18
|
-
|
|
19
13
|
function getMeta(_x) {
|
|
20
14
|
return _getMeta.apply(this, arguments);
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
function _getMeta() {
|
|
24
17
|
_getMeta = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(product) {
|
|
25
18
|
var response;
|
|
@@ -29,11 +22,9 @@ function _getMeta() {
|
|
|
29
22
|
case 0:
|
|
30
23
|
_context.next = 2;
|
|
31
24
|
return retrieveJSON(getProductMetaPath(product));
|
|
32
|
-
|
|
33
25
|
case 2:
|
|
34
26
|
response = _context.sent;
|
|
35
27
|
return _context.abrupt("return", response.json);
|
|
36
|
-
|
|
37
28
|
case 4:
|
|
38
29
|
case "end":
|
|
39
30
|
return _context.stop();
|
|
@@ -43,21 +34,17 @@ function _getMeta() {
|
|
|
43
34
|
}));
|
|
44
35
|
return _getMeta.apply(this, arguments);
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
function uploadMeta(product, lastRunHash) {
|
|
48
38
|
return uploadJSON(getProductMetaPath(product), {
|
|
49
39
|
lastRunHash: lastRunHash
|
|
50
40
|
});
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
function getProductMetaPath(product) {
|
|
54
43
|
return "product/".concat(product, ".json");
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
function retrieveJSON(_x2) {
|
|
58
46
|
return _retrieveJSON.apply(this, arguments);
|
|
59
47
|
}
|
|
60
|
-
|
|
61
48
|
function _retrieveJSON() {
|
|
62
49
|
_retrieveJSON = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(filepath) {
|
|
63
50
|
var response, json;
|
|
@@ -67,28 +54,22 @@ function _retrieveJSON() {
|
|
|
67
54
|
case 0:
|
|
68
55
|
_context2.next = 2;
|
|
69
56
|
return (0, _nodeFetch.default)("".concat(STATLAS_BASE_URL, "/").concat(filepath, "?statlasredirect"));
|
|
70
|
-
|
|
71
57
|
case 2:
|
|
72
58
|
response = _context2.sent;
|
|
73
59
|
json = null;
|
|
74
|
-
|
|
75
60
|
if (!response.ok) {
|
|
76
61
|
_context2.next = 8;
|
|
77
62
|
break;
|
|
78
63
|
}
|
|
79
|
-
|
|
80
64
|
_context2.next = 7;
|
|
81
65
|
return response.json();
|
|
82
|
-
|
|
83
66
|
case 7:
|
|
84
67
|
json = _context2.sent;
|
|
85
|
-
|
|
86
68
|
case 8:
|
|
87
69
|
return _context2.abrupt("return", {
|
|
88
70
|
json: json,
|
|
89
71
|
rawResponse: response
|
|
90
72
|
});
|
|
91
|
-
|
|
92
73
|
case 9:
|
|
93
74
|
case "end":
|
|
94
75
|
return _context2.stop();
|
|
@@ -98,11 +79,9 @@ function _retrieveJSON() {
|
|
|
98
79
|
}));
|
|
99
80
|
return _retrieveJSON.apply(this, arguments);
|
|
100
81
|
}
|
|
101
|
-
|
|
102
82
|
function uploadJSON(_x3, _x4) {
|
|
103
83
|
return _uploadJSON.apply(this, arguments);
|
|
104
84
|
}
|
|
105
|
-
|
|
106
85
|
function _uploadJSON() {
|
|
107
86
|
_uploadJSON = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(filepath, json) {
|
|
108
87
|
var res;
|
|
@@ -118,17 +97,13 @@ function _uploadJSON() {
|
|
|
118
97
|
Authorization: "Bearer ".concat(process.env.bamboo_JWT_TOKEN)
|
|
119
98
|
}
|
|
120
99
|
});
|
|
121
|
-
|
|
122
100
|
case 2:
|
|
123
101
|
res = _context3.sent;
|
|
124
|
-
|
|
125
102
|
if (res.ok) {
|
|
126
103
|
_context3.next = 5;
|
|
127
104
|
break;
|
|
128
105
|
}
|
|
129
|
-
|
|
130
106
|
throw new Error("Statlas upload failed: ".concat(res.statusText));
|
|
131
|
-
|
|
132
107
|
case 5:
|
|
133
108
|
case "end":
|
|
134
109
|
return _context3.stop();
|
package/dist/cjs/util/yarn.js
CHANGED
|
@@ -1,40 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.getWorkspaceGlobs = getWorkspaceGlobs;
|
|
11
9
|
exports.getWorkspacePaths = getWorkspacePaths;
|
|
12
|
-
|
|
13
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
|
-
|
|
15
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
16
|
-
|
|
17
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
18
|
-
|
|
19
13
|
var _path = _interopRequireDefault(require("path"));
|
|
20
|
-
|
|
21
14
|
var _debug = _interopRequireDefault(require("debug"));
|
|
22
|
-
|
|
23
15
|
var _micromatch = _interopRequireDefault(require("micromatch"));
|
|
24
|
-
|
|
25
16
|
var git = _interopRequireWildcard(require("./git"));
|
|
26
|
-
|
|
27
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
|
-
|
|
29
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
|
-
|
|
31
19
|
var rootPackageJsonPath = 'package.json';
|
|
32
20
|
var debug = (0, _debug.default)('atlaskit:yarn');
|
|
33
|
-
|
|
34
21
|
function getWorkspaceGlobs(_x, _x2) {
|
|
35
22
|
return _getWorkspaceGlobs.apply(this, arguments);
|
|
36
23
|
}
|
|
37
|
-
|
|
38
24
|
function _getWorkspaceGlobs() {
|
|
39
25
|
_getWorkspaceGlobs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(ref, cwd) {
|
|
40
26
|
var file, rootPackageJsonFile, workspaces, workspacePackages;
|
|
@@ -47,47 +33,38 @@ function _getWorkspaceGlobs() {
|
|
|
47
33
|
return git.showFile(ref, rootPackageJsonPath, {
|
|
48
34
|
cwd: cwd
|
|
49
35
|
});
|
|
50
|
-
|
|
51
36
|
case 3:
|
|
52
37
|
file = _context.sent;
|
|
53
38
|
_context.next = 10;
|
|
54
39
|
break;
|
|
55
|
-
|
|
56
40
|
case 6:
|
|
57
41
|
_context.prev = 6;
|
|
58
42
|
_context.t0 = _context["catch"](0);
|
|
59
43
|
debug("".concat(rootPackageJsonPath, " does not exist"));
|
|
60
44
|
return _context.abrupt("return", new Set([]));
|
|
61
|
-
|
|
62
45
|
case 10:
|
|
63
46
|
_context.prev = 10;
|
|
64
47
|
rootPackageJsonFile = JSON.parse(file);
|
|
65
48
|
_context.next = 18;
|
|
66
49
|
break;
|
|
67
|
-
|
|
68
50
|
case 14:
|
|
69
51
|
_context.prev = 14;
|
|
70
52
|
_context.t1 = _context["catch"](10);
|
|
71
53
|
console.error("Error parsing ".concat(file, "@").concat(ref, ": ").concat(_context.t1));
|
|
72
54
|
return _context.abrupt("return", null);
|
|
73
|
-
|
|
74
55
|
case 18:
|
|
75
56
|
workspaces = rootPackageJsonFile.workspaces;
|
|
76
|
-
|
|
77
57
|
if (workspaces) {
|
|
78
58
|
_context.next = 21;
|
|
79
59
|
break;
|
|
80
60
|
}
|
|
81
|
-
|
|
82
61
|
return _context.abrupt("return", new Set([rootPackageJsonPath]));
|
|
83
|
-
|
|
84
62
|
case 21:
|
|
85
63
|
// There are actually two formats for workspaces and they are poorly documented
|
|
86
64
|
workspacePackages = Array.isArray(workspaces) ? workspaces : workspaces.packages;
|
|
87
65
|
return _context.abrupt("return", new Set([rootPackageJsonPath].concat((0, _toConsumableArray2.default)(workspacePackages.map(function (glob) {
|
|
88
66
|
return _path.default.join(glob, 'package.json');
|
|
89
67
|
})))));
|
|
90
|
-
|
|
91
68
|
case 23:
|
|
92
69
|
case "end":
|
|
93
70
|
return _context.stop();
|
|
@@ -97,11 +74,9 @@ function _getWorkspaceGlobs() {
|
|
|
97
74
|
}));
|
|
98
75
|
return _getWorkspaceGlobs.apply(this, arguments);
|
|
99
76
|
}
|
|
100
|
-
|
|
101
77
|
function getWorkspacePaths(_x3, _x4, _x5) {
|
|
102
78
|
return _getWorkspacePaths.apply(this, arguments);
|
|
103
79
|
}
|
|
104
|
-
|
|
105
80
|
function _getWorkspacePaths() {
|
|
106
81
|
_getWorkspacePaths = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(ref, workspaceGlobs, cwd) {
|
|
107
82
|
var workspacePackageJsons, matchedWorkspaces;
|
|
@@ -113,29 +88,22 @@ function _getWorkspacePaths() {
|
|
|
113
88
|
_context2.next = 2;
|
|
114
89
|
break;
|
|
115
90
|
}
|
|
116
|
-
|
|
117
91
|
return _context2.abrupt("return", []);
|
|
118
|
-
|
|
119
92
|
case 2:
|
|
120
93
|
_context2.next = 4;
|
|
121
94
|
return git.getFiles(ref, '**/package.json', {
|
|
122
95
|
cwd: cwd
|
|
123
96
|
});
|
|
124
|
-
|
|
125
97
|
case 4:
|
|
126
98
|
workspacePackageJsons = _context2.sent;
|
|
127
99
|
matchedWorkspaces = (0, _micromatch.default)(workspacePackageJsons, (0, _toConsumableArray2.default)(workspaceGlobs));
|
|
128
|
-
|
|
129
100
|
if (!(matchedWorkspaces.length === 0)) {
|
|
130
101
|
_context2.next = 8;
|
|
131
102
|
break;
|
|
132
103
|
}
|
|
133
|
-
|
|
134
104
|
throw new Error("Could not find any workspace or package.json under ".concat(cwd));
|
|
135
|
-
|
|
136
105
|
case 8:
|
|
137
106
|
return _context2.abrupt("return", matchedWorkspaces);
|
|
138
|
-
|
|
139
107
|
case 9:
|
|
140
108
|
case "end":
|
|
141
109
|
return _context2.stop();
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/cli.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference lib="es2017.object" />
|
|
2
|
+
|
|
2
3
|
import chalk from 'chalk';
|
|
3
4
|
import meow from 'meow';
|
|
4
|
-
import { populateProduct, populatePackage } from './commands/populate-historic-data';
|
|
5
|
+
import { populateProduct, populatePackage } from './commands/populate-historic-data';
|
|
5
6
|
|
|
7
|
+
// prettier-ignore
|
|
6
8
|
const HELP_MSG = `
|
|
7
9
|
${chalk.green('Global options')}
|
|
8
10
|
${chalk.yellow('--dev')} Send analytics to dev analytics pipeline instead of prod
|
|
@@ -73,15 +75,12 @@ export function run({
|
|
|
73
75
|
});
|
|
74
76
|
const [command, ...inputs] = cli.input;
|
|
75
77
|
const limit = cli.flags.limit != null ? +cli.flags.limit : undefined;
|
|
76
|
-
|
|
77
78
|
if (command === 'populate-product') {
|
|
78
79
|
const product = inputs[0];
|
|
79
|
-
|
|
80
80
|
if (!product) {
|
|
81
81
|
console.error(chalk.red('Must pass a product parameter'));
|
|
82
82
|
process.exit(1);
|
|
83
83
|
}
|
|
84
|
-
|
|
85
84
|
return populateProduct({
|
|
86
85
|
csv: cli.flags.csv || false,
|
|
87
86
|
dev: dev || cli.flags.dev || false,
|
|
@@ -95,12 +94,10 @@ export function run({
|
|
|
95
94
|
});
|
|
96
95
|
} else if (command === 'populate-package') {
|
|
97
96
|
const pkg = inputs[0];
|
|
98
|
-
|
|
99
97
|
if (!pkg) {
|
|
100
98
|
console.error(chalk.red('Must pass a package parameter'));
|
|
101
99
|
process.exit(1);
|
|
102
100
|
}
|
|
103
|
-
|
|
104
101
|
return populatePackage({
|
|
105
102
|
dev: dev || cli.flags.dev || false,
|
|
106
103
|
dryRun: cli.flags.dryRun || false,
|
|
@@ -110,8 +107,7 @@ export function run({
|
|
|
110
107
|
since: cli.flags.since
|
|
111
108
|
});
|
|
112
109
|
}
|
|
113
|
-
/* eslint-disable no-console */
|
|
114
|
-
|
|
115
110
|
|
|
111
|
+
/* eslint-disable no-console */
|
|
116
112
|
return Promise.resolve(console.log(cli.help));
|
|
117
113
|
}
|