@atlaskit/dependency-version-analytics 1.0.0 → 1.2.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +7 -4
  3. package/dist/cjs/cli.js +52 -17
  4. package/dist/cjs/commands/populate-historic-data/index.js +2 -2
  5. package/dist/cjs/commands/populate-historic-data/lib/dependency-store.js +227 -451
  6. package/dist/cjs/commands/populate-historic-data/package.js +31 -71
  7. package/dist/cjs/commands/populate-historic-data/product.js +130 -253
  8. package/dist/cjs/commands/populate-historic-data/util/allowed-scopes.js +15 -0
  9. package/dist/cjs/commands/populate-historic-data/util/generate-csv.js +16 -21
  10. package/dist/cjs/constants.js +2 -2
  11. package/dist/cjs/index.js +3 -3
  12. package/dist/cjs/util/analytics.js +82 -94
  13. package/dist/cjs/util/get-file-history-from-git.js +4 -4
  14. package/dist/cjs/util/get-package-version-history.js +11 -7
  15. package/dist/cjs/util/git.js +75 -205
  16. package/dist/cjs/util/statlas.js +27 -97
  17. package/dist/cjs/util/yarn.js +40 -101
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/cli.js +10 -4
  20. package/dist/es2019/commands/populate-historic-data/lib/dependency-store.js +6 -4
  21. package/dist/es2019/commands/populate-historic-data/package.js +11 -6
  22. package/dist/es2019/commands/populate-historic-data/product.js +25 -7
  23. package/dist/es2019/commands/populate-historic-data/util/allowed-scopes.js +7 -0
  24. package/dist/es2019/commands/populate-historic-data/util/generate-csv.js +1 -1
  25. package/dist/es2019/util/analytics.js +13 -0
  26. package/dist/es2019/util/get-package-version-history.js +7 -3
  27. package/dist/es2019/version.json +1 -1
  28. package/dist/esm/cli.js +8 -3
  29. package/dist/esm/commands/populate-historic-data/lib/dependency-store.js +20 -15
  30. package/dist/esm/commands/populate-historic-data/package.js +27 -21
  31. package/dist/esm/commands/populate-historic-data/product.js +121 -81
  32. package/dist/esm/commands/populate-historic-data/util/allowed-scopes.js +11 -0
  33. package/dist/esm/commands/populate-historic-data/util/generate-csv.js +1 -1
  34. package/dist/esm/util/analytics.js +19 -5
  35. package/dist/esm/util/get-package-version-history.js +7 -3
  36. package/dist/esm/util/git.js +14 -13
  37. package/dist/esm/util/statlas.js +8 -7
  38. package/dist/esm/util/yarn.js +6 -5
  39. package/dist/esm/version.json +1 -1
  40. package/dist/types/commands/populate-historic-data/lib/dependency-store.d.ts +3 -2
  41. package/dist/types/commands/populate-historic-data/types.d.ts +3 -2
  42. package/dist/types/commands/populate-historic-data/util/allowed-scopes.d.ts +2 -0
  43. package/dist/types/commands/populate-historic-data/util/generate-csv.d.ts +2 -2
  44. package/dist/types/types.d.ts +7 -0
  45. package/dist/types/util/analytics.d.ts +2 -1
  46. package/dist/types/util/get-package-version-history.d.ts +7 -3
  47. package/package.json +2 -2
  48. package/report.api.md +5 -0
  49. package/tmp/api-report-tmp.d.ts +5 -0
  50. package/tokenize-arg-string.ts +0 -0
@@ -1,7 +1,8 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
6
  import { DEFAULT_TAG } from '../../constants';
6
7
  import chalk from 'chalk';
7
8
  import { createUpgradeEvent, sendAnalytics } from '../../util/analytics';
@@ -10,6 +11,8 @@ import * as statlas from '../../util/statlas';
10
11
  import { generateCSV } from './util/generate-csv';
11
12
  import { assert } from '../../util/assert';
12
13
  import { DependencyStore } from './lib/dependency-store';
14
+ import getPackageVersionHistoryAndTags from '../../util/get-package-version-history';
15
+ import { getSupportedScopes } from './util/allowed-scopes';
13
16
  var getUpgradeEventsFromPkgChange = function getUpgradeEventsFromPkgChange(oldDeps, newDeps, _ref) {
14
17
  var date = _ref.date,
15
18
  commitHash = _ref.commitHash;
@@ -56,219 +59,256 @@ var getUpgradeEventsFromPkgChange = function getUpgradeEventsFromPkgChange(oldDe
56
59
  return [].concat(_toConsumableArray(addOrUpgradeEvents), _toConsumableArray(removeEvents));
57
60
  };
58
61
  var getEventsFromHistory = /*#__PURE__*/function () {
59
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(packageChangesLog, prevRunHash, _ref8) {
60
- var cwd, allPackageChanges, allUpgradeEvents, dependencyStore, dependencies, i, item, newDependencies, packageChange, upgradeEvents;
61
- return _regeneratorRuntime.wrap(function _callee$(_context) {
62
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(packageChangesLog, prevRunHash, _ref8, supportedScopes) {
63
+ var cwd, allPackageChanges, allUpgradeEvents, dependencyStore, dependencies, i, item, newDependencies, packageChange, upgradeEvents, _allUpgradeEvents;
64
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
62
65
  while (1) {
63
- switch (_context.prev = _context.next) {
66
+ switch (_context2.prev = _context2.next) {
64
67
  case 0:
65
68
  cwd = _ref8.cwd;
66
69
  allPackageChanges = [];
67
70
  allUpgradeEvents = [];
68
71
  assert(packageChangesLog.all.length > 0, '');
69
- dependencyStore = new DependencyStore(cwd);
70
- _context.next = 7;
72
+ dependencyStore = new DependencyStore(cwd, supportedScopes);
73
+ _context2.next = 7;
71
74
  return dependencyStore.initialise(prevRunHash);
72
75
  case 7:
73
- dependencies = _context.sent;
76
+ dependencies = _context2.sent;
74
77
  i = 0;
75
78
  case 9:
76
79
  if (!(i < packageChangesLog.all.length)) {
77
- _context.next = 21;
80
+ _context2.next = 21;
78
81
  break;
79
82
  }
80
83
  item = packageChangesLog.all[i];
81
84
  if (allPackageChanges.length > 0) {
82
- dependencies = allPackageChanges[allPackageChanges.length - 1].akDeps;
85
+ dependencies = allPackageChanges[allPackageChanges.length - 1].deps;
83
86
  }
84
- _context.next = 14;
87
+ _context2.next = 14;
85
88
  return dependencyStore.update(item);
86
89
  case 14:
87
- newDependencies = _context.sent;
90
+ newDependencies = _context2.sent;
88
91
  packageChange = {
89
92
  date: new Date(item.date).toISOString(),
90
- akDeps: newDependencies
93
+ deps: newDependencies
91
94
  };
92
95
  upgradeEvents = getUpgradeEventsFromPkgChange(dependencies, newDependencies, {
93
96
  date: packageChange.date,
94
97
  commitHash: item.hash
95
98
  });
96
99
  if (upgradeEvents.length > 0) {
97
- allUpgradeEvents.push.apply(allUpgradeEvents, _toConsumableArray(upgradeEvents));
100
+ (_allUpgradeEvents = allUpgradeEvents).push.apply(_allUpgradeEvents, _toConsumableArray(upgradeEvents));
98
101
  allPackageChanges.push(packageChange);
99
102
  }
100
103
  case 18:
101
104
  i++;
102
- _context.next = 9;
105
+ _context2.next = 9;
103
106
  break;
104
107
  case 21:
105
- return _context.abrupt("return", {
108
+ _context2.next = 23;
109
+ return Promise.all(allUpgradeEvents.map( /*#__PURE__*/function () {
110
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(upgradeEvent) {
111
+ var _distTags$hotfix, _distTags$latest, _distTags$next;
112
+ var getPackageTags, distTags;
113
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
114
+ while (1) {
115
+ switch (_context.prev = _context.next) {
116
+ case 0:
117
+ _context.next = 2;
118
+ return getPackageVersionHistoryAndTags(upgradeEvent.dependencyName);
119
+ case 2:
120
+ getPackageTags = _context.sent;
121
+ distTags = getPackageTags['dist-tags'];
122
+ Object.keys(distTags).forEach(function (key) {
123
+ if (key.startsWith('rc')) {
124
+ upgradeEvent.rcTag = distTags[key];
125
+ }
126
+ });
127
+ upgradeEvent.hotfixTag = (_distTags$hotfix = distTags['hotfix']) !== null && _distTags$hotfix !== void 0 ? _distTags$hotfix : null;
128
+ upgradeEvent.latestTag = (_distTags$latest = distTags['latest']) !== null && _distTags$latest !== void 0 ? _distTags$latest : null;
129
+ upgradeEvent.nextTag = (_distTags$next = distTags['next']) !== null && _distTags$next !== void 0 ? _distTags$next : null;
130
+ return _context.abrupt("return", upgradeEvent);
131
+ case 9:
132
+ case "end":
133
+ return _context.stop();
134
+ }
135
+ }
136
+ }, _callee);
137
+ }));
138
+ return function (_x5) {
139
+ return _ref10.apply(this, arguments);
140
+ };
141
+ }()));
142
+ case 23:
143
+ allUpgradeEvents = _context2.sent;
144
+ return _context2.abrupt("return", {
106
145
  allPackageChanges: allPackageChanges,
107
146
  allUpgradeEvents: allUpgradeEvents
108
147
  });
109
- case 22:
148
+ case 25:
110
149
  case "end":
111
- return _context.stop();
150
+ return _context2.stop();
112
151
  }
113
152
  }
114
- }, _callee);
153
+ }, _callee2);
115
154
  }));
116
- return function getEventsFromHistory(_x, _x2, _x3) {
155
+ return function getEventsFromHistory(_x, _x2, _x3, _x4) {
117
156
  return _ref9.apply(this, arguments);
118
157
  };
119
158
  }();
120
- function getSinceRef(_x4) {
159
+ function getSinceRef(_x6) {
121
160
  return _getSinceRef.apply(this, arguments);
122
161
  }
123
162
  function _getSinceRef() {
124
- _getSinceRef = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(flags) {
163
+ _getSinceRef = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(flags) {
125
164
  var meta, tag, tagExists;
126
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
165
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
127
166
  while (1) {
128
- switch (_context2.prev = _context2.next) {
167
+ switch (_context3.prev = _context3.next) {
129
168
  case 0:
130
169
  if (!flags.statlas) {
131
- _context2.next = 9;
170
+ _context3.next = 9;
132
171
  break;
133
172
  }
134
- _context2.next = 3;
173
+ _context3.next = 3;
135
174
  return statlas.getMeta(flags.product);
136
175
  case 3:
137
- meta = _context2.sent;
176
+ meta = _context3.sent;
138
177
  if (!(!meta || !meta.lastRunHash)) {
139
- _context2.next = 6;
178
+ _context3.next = 6;
140
179
  break;
141
180
  }
142
181
  throw new Error(chalk.red("Missing or invalid metadata file for ".concat(flags.product, ". Must use --reset for populating from start of history")));
143
182
  case 6:
144
- return _context2.abrupt("return", meta.lastRunHash);
183
+ return _context3.abrupt("return", meta.lastRunHash);
145
184
  case 9:
146
185
  tag = flags.tag || DEFAULT_TAG;
147
- _context2.next = 12;
186
+ _context3.next = 12;
148
187
  return refetchTag(tag);
149
188
  case 12:
150
- _context2.next = 14;
189
+ _context3.next = 14;
151
190
  return doesTagExist(tag);
152
191
  case 14:
153
- tagExists = _context2.sent;
192
+ tagExists = _context3.sent;
154
193
  if (tagExists) {
155
- _context2.next = 17;
194
+ _context3.next = 17;
156
195
  break;
157
196
  }
158
197
  throw new Error(chalk.red("Tag '".concat(tag, "' does not exist. Must use --reset for populating from start of history.")));
159
198
  case 17:
160
- return _context2.abrupt("return", tag);
199
+ return _context3.abrupt("return", tag);
161
200
  case 18:
162
201
  case "end":
163
- return _context2.stop();
202
+ return _context3.stop();
164
203
  }
165
204
  }
166
- }, _callee2);
205
+ }, _callee3);
167
206
  }));
168
207
  return _getSinceRef.apply(this, arguments);
169
208
  }
170
- export default function populateProduct(_x5) {
209
+ export default function populateProduct(_x7) {
171
210
  return _populateProduct.apply(this, arguments);
172
211
  }
173
212
  function _populateProduct() {
174
- _populateProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(flags) {
175
- var cwd, sinceRef, log, _yield$getEventsFromH, allPackageChanges, allUpgradeEvents, csv, currentCommit;
176
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
213
+ _populateProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(flags) {
214
+ var cwd, sinceRef, log, supportedScopes, _yield$getEventsFromH, allPackageChanges, allUpgradeEvents, csv, currentCommit;
215
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
177
216
  while (1) {
178
- switch (_context3.prev = _context3.next) {
217
+ switch (_context4.prev = _context4.next) {
179
218
  case 0:
180
219
  cwd = flags.cwd || process.cwd();
181
220
  if (!flags.reset) {
182
- _context3.next = 5;
221
+ _context4.next = 5;
183
222
  break;
184
223
  }
185
- _context3.t0 = undefined;
186
- _context3.next = 8;
224
+ _context4.t0 = undefined;
225
+ _context4.next = 8;
187
226
  break;
188
227
  case 5:
189
- _context3.next = 7;
228
+ _context4.next = 7;
190
229
  return getSinceRef(flags);
191
230
  case 7:
192
- _context3.t0 = _context3.sent;
231
+ _context4.t0 = _context4.sent;
193
232
  case 8:
194
- sinceRef = _context3.t0;
195
- _context3.next = 11;
233
+ sinceRef = _context4.t0;
234
+ _context4.next = 11;
196
235
  return getChangesSince(sinceRef);
197
236
  case 11:
198
- log = _context3.sent;
237
+ log = _context4.sent;
238
+ supportedScopes = getSupportedScopes(flags.includeRestrictedScopes);
199
239
  if (!(log.all.length === 0)) {
200
- _context3.next = 15;
240
+ _context4.next = 16;
201
241
  break;
202
242
  }
203
243
  console.log("No package.json changes found since '".concat(sinceRef, "'."));
204
- return _context3.abrupt("return");
205
- case 15:
206
- _context3.next = 17;
244
+ return _context4.abrupt("return");
245
+ case 16:
246
+ _context4.next = 18;
207
247
  return getEventsFromHistory(log, sinceRef, {
208
248
  cwd: cwd
209
- });
210
- case 17:
211
- _yield$getEventsFromH = _context3.sent;
249
+ }, supportedScopes);
250
+ case 18:
251
+ _yield$getEventsFromH = _context4.sent;
212
252
  allPackageChanges = _yield$getEventsFromH.allPackageChanges;
213
253
  allUpgradeEvents = _yield$getEventsFromH.allUpgradeEvents;
214
254
  if (!flags.csv) {
215
- _context3.next = 24;
255
+ _context4.next = 25;
216
256
  break;
217
257
  }
218
258
  csv = generateCSV(allPackageChanges);
219
259
  console.log(csv);
220
- return _context3.abrupt("return");
221
- case 24:
260
+ return _context4.abrupt("return");
261
+ case 25:
222
262
  if (!flags.dryRun) {
223
- _context3.next = 27;
263
+ _context4.next = 28;
224
264
  break;
225
265
  }
226
266
  console.log(JSON.stringify(allUpgradeEvents));
227
- return _context3.abrupt("return");
228
- case 27:
267
+ return _context4.abrupt("return");
268
+ case 28:
229
269
  if (!(allUpgradeEvents.length > 0)) {
230
- _context3.next = 32;
270
+ _context4.next = 33;
231
271
  break;
232
272
  }
233
- _context3.next = 30;
273
+ _context4.next = 31;
234
274
  return sendAnalytics(allUpgradeEvents, {
235
275
  dev: flags.dev,
236
276
  limit: flags.limit,
237
277
  product: flags.product,
238
278
  skipPrompt: !flags.interactive
239
279
  });
240
- case 30:
241
- _context3.next = 33;
280
+ case 31:
281
+ _context4.next = 34;
242
282
  break;
243
- case 32:
244
- console.log("Found no AK dependency changes since last run from ref \"".concat(sinceRef, "\"'"));
245
283
  case 33:
284
+ console.log("Found no dependency changes from supported scopes ".concat(supportedScopes.join(', '), " since last run from ref \"").concat(sinceRef, "\"'"));
285
+ case 34:
246
286
  if (!flags.statlas) {
247
- _context3.next = 42;
287
+ _context4.next = 43;
248
288
  break;
249
289
  }
250
- _context3.next = 36;
290
+ _context4.next = 37;
251
291
  return getHash('HEAD');
252
- case 36:
253
- currentCommit = _context3.sent;
254
- _context3.next = 39;
292
+ case 37:
293
+ currentCommit = _context4.sent;
294
+ _context4.next = 40;
255
295
  return statlas.uploadMeta(flags.product, currentCommit);
256
- case 39:
296
+ case 40:
257
297
  console.log('Finished');
258
- _context3.next = 46;
298
+ _context4.next = 47;
259
299
  break;
260
- case 42:
300
+ case 43:
261
301
  console.log('Updating tag to current commit...');
262
- _context3.next = 45;
302
+ _context4.next = 46;
263
303
  return tagCommit(DEFAULT_TAG);
264
- case 45:
265
- console.log("Finished. Run 'git push origin tag ".concat(sinceRef, "'."));
266
304
  case 46:
305
+ console.log("Finished. Run 'git push origin tag ".concat(sinceRef, "'."));
306
+ case 47:
267
307
  case "end":
268
- return _context3.stop();
308
+ return _context4.stop();
269
309
  }
270
310
  }
271
- }, _callee3);
311
+ }, _callee4);
272
312
  }));
273
313
  return _populateProduct.apply(this, arguments);
274
314
  }
@@ -0,0 +1,11 @@
1
+ var defaultScopes = ['@atlaskit', '@atlassian', '@atlassiansox'];
2
+ export var getSupportedScopes = function getSupportedScopes() {
3
+ var enableNonAtlaskitPackages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4
+ return enableNonAtlaskitPackages ? defaultScopes : ['@atlaskit'];
5
+ };
6
+ export var isPackageFromSupportedScopes = function isPackageFromSupportedScopes(packageName) {
7
+ var supportedScopes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultScopes;
8
+ return supportedScopes.some(function (scope) {
9
+ return packageName.startsWith(scope);
10
+ });
11
+ };
@@ -5,7 +5,7 @@ export var generateCSV = function generateCSV(packageChanges) {
5
5
  packageChanges.forEach(function (packageChange) {
6
6
  var firstColumn = csvData[0];
7
7
  var currentRow = firstColumn.push(packageChange.date) - 1;
8
- Object.entries(packageChange.akDeps).forEach(function (_ref) {
8
+ Object.entries(packageChange.deps).forEach(function (_ref) {
9
9
  var _ref2 = _slicedToArray(_ref, 2),
10
10
  name = _ref2[0],
11
11
  version = _ref2[1].version;
@@ -1,6 +1,7 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
5
  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; }
5
6
  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) { _defineProperty(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; }
6
7
  import chalk from 'chalk';
@@ -44,6 +45,7 @@ function getUpgradeSubType(version, previousVersion) {
44
45
  return upgradeSubType;
45
46
  }
46
47
  export function createUpgradeEvent(name, version, previousVersion, date) {
48
+ var _optionalArgs$tags, _ref, _tags$next, _tags$hotfix, _ref2;
47
49
  var optionalArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
48
50
  if (Number.isNaN(Date.parse(date))) {
49
51
  throw new Error("Invalid date: '".concat(date, "'"));
@@ -56,6 +58,14 @@ export function createUpgradeEvent(name, version, previousVersion, date) {
56
58
  var upgradeSubType = getUpgradeSubType(version, previousVersion);
57
59
  var eventVersion = upgradeType !== 'remove' ? version : previousVersion;
58
60
  var parsedVersion = semver.coerce(eventVersion);
61
+ var rcKey = null;
62
+ var tags = (_optionalArgs$tags = optionalArgs === null || optionalArgs === void 0 ? void 0 : optionalArgs.tags) !== null && _optionalArgs$tags !== void 0 ? _optionalArgs$tags : {};
63
+ Object.keys(tags).forEach(function (key) {
64
+ if (key.startsWith('rc')) {
65
+ rcKey = key;
66
+ return;
67
+ }
68
+ });
59
69
  return _objectSpread({
60
70
  cliVersion: packageVersion,
61
71
  dependencyName: name,
@@ -65,20 +75,24 @@ export function createUpgradeEvent(name, version, previousVersion, date) {
65
75
  patch: parsedVersion ? "".concat(parsedVersion.patch) : null,
66
76
  date: new Date(date).toISOString(),
67
77
  upgradeType: upgradeType,
68
- upgradeSubType: upgradeSubType
78
+ upgradeSubType: upgradeSubType,
79
+ latestTag: (_ref = tags && tags['latest']) !== null && _ref !== void 0 ? _ref : null,
80
+ nextTag: (_tags$next = tags['next']) !== null && _tags$next !== void 0 ? _tags$next : null,
81
+ hotfixTag: (_tags$hotfix = tags['hotfix']) !== null && _tags$hotfix !== void 0 ? _tags$hotfix : null,
82
+ rcTag: (_ref2 = rcKey && tags[rcKey]) !== null && _ref2 !== void 0 ? _ref2 : null
69
83
  }, optionalArgs);
70
84
  }
71
85
  export function sendAnalytics(_x, _x2) {
72
86
  return _sendAnalytics.apply(this, arguments);
73
87
  }
74
88
  function _sendAnalytics() {
75
- _sendAnalytics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(analyticsEvents, _ref) {
89
+ _sendAnalytics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(analyticsEvents, _ref3) {
76
90
  var dev, limit, product, skipPrompt, analyticsEnv, eventsToSend, client, answers, promises;
77
- return _regeneratorRuntime.wrap(function _callee$(_context) {
91
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
78
92
  while (1) {
79
93
  switch (_context.prev = _context.next) {
80
94
  case 0:
81
- dev = _ref.dev, limit = _ref.limit, product = _ref.product, skipPrompt = _ref.skipPrompt;
95
+ dev = _ref3.dev, limit = _ref3.limit, product = _ref3.product, skipPrompt = _ref3.skipPrompt;
82
96
  analyticsEnv = dev ? 'dev' : 'prod';
83
97
  eventsToSend = limit != null ? analyticsEvents.slice(0, limit) : analyticsEvents;
84
98
  client = analyticsClient({
@@ -1,7 +1,7 @@
1
1
  import { exec } from 'child_process';
2
- export default function getPackageVersionHistory(packageName) {
2
+ export default function getPackageVersionHistoryAndTags(packageName) {
3
3
  return new Promise(function (resolve, reject) {
4
- exec("yarn info ".concat(packageName, " --json time"), function (error, stdout, stderr) {
4
+ exec("yarn info ".concat(packageName, " --json"), function (error, stdout, stderr) {
5
5
  if (error) {
6
6
  reject(error);
7
7
  }
@@ -10,7 +10,11 @@ export default function getPackageVersionHistory(packageName) {
10
10
  }
11
11
  var json;
12
12
  try {
13
- json = JSON.parse(stdout).data;
13
+ var parseData = JSON.parse(stdout).data;
14
+ json = {
15
+ time: parseData['time'],
16
+ 'dist-tags': parseData['dist-tags']
17
+ };
14
18
  } catch (e) {
15
19
  reject("Error parsing json output: ".concat(e));
16
20
  }
@@ -1,7 +1,8 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
6
  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; }
6
7
  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) { _defineProperty(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; }
7
8
  // @ts-ignore
@@ -12,9 +13,9 @@ export function getChangesSince(_x) {
12
13
  return _getChangesSince.apply(this, arguments);
13
14
  }
14
15
  function _getChangesSince() {
15
- _getChangesSince = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(since) {
16
+ _getChangesSince = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(since) {
16
17
  var revisionRange, listLogSummary;
17
- return _regeneratorRuntime.wrap(function _callee$(_context) {
18
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18
19
  while (1) {
19
20
  switch (_context.prev = _context.next) {
20
21
  case 0:
@@ -91,8 +92,8 @@ export function tagCommit(_x2) {
91
92
  return _tagCommit.apply(this, arguments);
92
93
  }
93
94
  function _tagCommit() {
94
- _tagCommit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(tag) {
95
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
95
+ _tagCommit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(tag) {
96
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
96
97
  while (1) {
97
98
  switch (_context2.prev = _context2.next) {
98
99
  case 0:
@@ -110,9 +111,9 @@ export function doesTagExist(_x3) {
110
111
  return _doesTagExist.apply(this, arguments);
111
112
  }
112
113
  function _doesTagExist() {
113
- _doesTagExist = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tag) {
114
+ _doesTagExist = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(tag) {
114
115
  var tags;
115
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
116
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
116
117
  while (1) {
117
118
  switch (_context3.prev = _context3.next) {
118
119
  case 0:
@@ -134,9 +135,9 @@ export function refetchTag(_x4) {
134
135
  return _refetchTag.apply(this, arguments);
135
136
  }
136
137
  function _refetchTag() {
137
- _refetchTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(tag) {
138
+ _refetchTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(tag) {
138
139
  var fetchTagResult;
139
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
140
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
140
141
  while (1) {
141
142
  switch (_context4.prev = _context4.next) {
142
143
  case 0:
@@ -187,8 +188,8 @@ export function getHash(_x5) {
187
188
  return _getHash.apply(this, arguments);
188
189
  }
189
190
  function _getHash() {
190
- _getHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(ref) {
191
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
191
+ _getHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(ref) {
192
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
192
193
  while (1) {
193
194
  switch (_context5.prev = _context5.next) {
194
195
  case 0:
@@ -210,11 +211,11 @@ export function getFiles(_x6, _x7) {
210
211
  return _getFiles.apply(this, arguments);
211
212
  }
212
213
  function _getFiles() {
213
- _getFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(ref, glob) {
214
+ _getFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(ref, glob) {
214
215
  var opts,
215
216
  result,
216
217
  _args6 = arguments;
217
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
218
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
218
219
  while (1) {
219
220
  switch (_context6.prev = _context6.next) {
220
221
  case 0: