@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.
- package/CHANGELOG.md +12 -0
- package/README.md +7 -4
- package/dist/cjs/cli.js +52 -17
- package/dist/cjs/commands/populate-historic-data/index.js +2 -2
- package/dist/cjs/commands/populate-historic-data/lib/dependency-store.js +227 -451
- package/dist/cjs/commands/populate-historic-data/package.js +31 -71
- package/dist/cjs/commands/populate-historic-data/product.js +130 -253
- package/dist/cjs/commands/populate-historic-data/util/allowed-scopes.js +15 -0
- package/dist/cjs/commands/populate-historic-data/util/generate-csv.js +16 -21
- package/dist/cjs/constants.js +2 -2
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/util/analytics.js +82 -94
- package/dist/cjs/util/get-file-history-from-git.js +4 -4
- package/dist/cjs/util/get-package-version-history.js +11 -7
- package/dist/cjs/util/git.js +75 -205
- package/dist/cjs/util/statlas.js +27 -97
- package/dist/cjs/util/yarn.js +40 -101
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/cli.js +10 -4
- package/dist/es2019/commands/populate-historic-data/lib/dependency-store.js +6 -4
- package/dist/es2019/commands/populate-historic-data/package.js +11 -6
- package/dist/es2019/commands/populate-historic-data/product.js +25 -7
- package/dist/es2019/commands/populate-historic-data/util/allowed-scopes.js +7 -0
- package/dist/es2019/commands/populate-historic-data/util/generate-csv.js +1 -1
- package/dist/es2019/util/analytics.js +13 -0
- package/dist/es2019/util/get-package-version-history.js +7 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/cli.js +8 -3
- package/dist/esm/commands/populate-historic-data/lib/dependency-store.js +20 -15
- package/dist/esm/commands/populate-historic-data/package.js +27 -21
- package/dist/esm/commands/populate-historic-data/product.js +121 -81
- package/dist/esm/commands/populate-historic-data/util/allowed-scopes.js +11 -0
- package/dist/esm/commands/populate-historic-data/util/generate-csv.js +1 -1
- package/dist/esm/util/analytics.js +19 -5
- package/dist/esm/util/get-package-version-history.js +7 -3
- package/dist/esm/util/git.js +14 -13
- package/dist/esm/util/statlas.js +8 -7
- package/dist/esm/util/yarn.js +6 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/commands/populate-historic-data/lib/dependency-store.d.ts +3 -2
- package/dist/types/commands/populate-historic-data/types.d.ts +3 -2
- package/dist/types/commands/populate-historic-data/util/allowed-scopes.d.ts +2 -0
- package/dist/types/commands/populate-historic-data/util/generate-csv.d.ts +2 -2
- package/dist/types/types.d.ts +7 -0
- package/dist/types/util/analytics.d.ts +2 -1
- package/dist/types/util/get-package-version-history.d.ts +7 -3
- package/package.json +2 -2
- package/report.api.md +5 -0
- package/tmp/api-report-tmp.d.ts +5 -0
- package/tokenize-arg-string.ts +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
@@ -9,7 +10,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
10
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
|
+
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; }
|
|
13
14
|
/** Workspace code */
|
|
14
15
|
|
|
15
16
|
import debugModule from 'debug';
|
|
@@ -19,6 +20,7 @@ import { showFile } from '../../../util/git';
|
|
|
19
20
|
import { DEP_TYPES } from '../../../constants';
|
|
20
21
|
import { assert } from '../../../util/assert';
|
|
21
22
|
import micromatch from 'micromatch';
|
|
23
|
+
import { isPackageFromSupportedScopes } from '../util/allowed-scopes';
|
|
22
24
|
var debug = debugModule('atlaskit:dependency');
|
|
23
25
|
/**
|
|
24
26
|
* Stores the state of atlaskit dependencies in a repository
|
|
@@ -32,20 +34,22 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
32
34
|
|
|
33
35
|
function DependencyStore() {
|
|
34
36
|
var cwd = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : process.cwd();
|
|
37
|
+
var supportedScopes = arguments.length > 1 ? arguments[1] : undefined;
|
|
35
38
|
_classCallCheck(this, DependencyStore);
|
|
36
39
|
_defineProperty(this, "dependencies", {});
|
|
37
40
|
_defineProperty(this, "workspaces", {});
|
|
38
41
|
_defineProperty(this, "workspaceGlobs", new Set());
|
|
39
42
|
_defineProperty(this, "initialised", false);
|
|
40
43
|
this.cwd = cwd;
|
|
44
|
+
this.supportedScopes = supportedScopes;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
/** Scans the repo for dependencies at the specified git ref and return the flattened dependency map */
|
|
44
48
|
_createClass(DependencyStore, [{
|
|
45
49
|
key: "initialise",
|
|
46
50
|
value: function () {
|
|
47
|
-
var _initialise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(gitRef) {
|
|
48
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
51
|
+
var _initialise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(gitRef) {
|
|
52
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
49
53
|
while (1) {
|
|
50
54
|
switch (_context.prev = _context.next) {
|
|
51
55
|
case 0:
|
|
@@ -76,9 +80,9 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
76
80
|
}, {
|
|
77
81
|
key: "update",
|
|
78
82
|
value: function () {
|
|
79
|
-
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(logItem) {
|
|
83
|
+
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(logItem) {
|
|
80
84
|
var hash, changedPackageJsons, didRootPackageJsonChange, workspaceGlobs, globsChanged, changedWorkspaces, _iterator, _step, workspacePath, workspaceDeps, validWorkspace, noLongerWorkspace;
|
|
81
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
85
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
82
86
|
while (1) {
|
|
83
87
|
switch (_context2.prev = _context2.next) {
|
|
84
88
|
case 0:
|
|
@@ -210,9 +214,9 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
210
214
|
}, {
|
|
211
215
|
key: "resetStore",
|
|
212
216
|
value: function () {
|
|
213
|
-
var _resetStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(gitRef) {
|
|
217
|
+
var _resetStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(gitRef) {
|
|
214
218
|
var workspaceGlobs, workspacePaths, _iterator2, _step2, wsPath, workspaceDeps;
|
|
215
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
219
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
216
220
|
while (1) {
|
|
217
221
|
switch (_context3.prev = _context3.next) {
|
|
218
222
|
case 0:
|
|
@@ -285,9 +289,9 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
285
289
|
}, {
|
|
286
290
|
key: "getWorkspaceDependencies",
|
|
287
291
|
value: function () {
|
|
288
|
-
var _getWorkspaceDependencies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(hash, workspacePath) {
|
|
292
|
+
var _getWorkspaceDependencies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(hash, workspacePath) {
|
|
289
293
|
var file, json, workspaceDeps, _iterator3, _step3, _step3$value, packageJsonKey, depTypeName, wsDeps;
|
|
290
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
294
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
291
295
|
while (1) {
|
|
292
296
|
switch (_context4.prev = _context4.next) {
|
|
293
297
|
case 0:
|
|
@@ -321,7 +325,7 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
321
325
|
try {
|
|
322
326
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
323
327
|
_step3$value = _step3.value, packageJsonKey = _step3$value.packageJsonKey, depTypeName = _step3$value.depTypeName;
|
|
324
|
-
wsDeps =
|
|
328
|
+
wsDeps = this.getSupportedDependencies(json[packageJsonKey] || {}, depTypeName);
|
|
325
329
|
workspaceDeps = _objectSpread(_objectSpread({}, workspaceDeps), wsDeps);
|
|
326
330
|
}
|
|
327
331
|
} catch (err) {
|
|
@@ -410,15 +414,16 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
410
414
|
});
|
|
411
415
|
}
|
|
412
416
|
}
|
|
413
|
-
}
|
|
414
|
-
key: "
|
|
415
|
-
value: function
|
|
417
|
+
}, {
|
|
418
|
+
key: "getSupportedDependencies",
|
|
419
|
+
value: function getSupportedDependencies(depMap, type) {
|
|
420
|
+
var _this = this;
|
|
416
421
|
return fromEntries(Object.entries(depMap).filter(
|
|
417
422
|
// Ignore suffixed `--next` deps in jira used for independent upgrades
|
|
418
423
|
function (_ref5) {
|
|
419
424
|
var _ref6 = _slicedToArray(_ref5, 1),
|
|
420
425
|
name = _ref6[0];
|
|
421
|
-
return name.
|
|
426
|
+
return isPackageFromSupportedScopes(name, _this.supportedScopes) && !name.endsWith('--next');
|
|
422
427
|
}).map(function (_ref7) {
|
|
423
428
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
424
429
|
name = _ref8[0],
|
|
@@ -429,7 +434,7 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
429
434
|
}];
|
|
430
435
|
}));
|
|
431
436
|
}
|
|
432
|
-
}, {
|
|
437
|
+
}], [{
|
|
433
438
|
key: "getMinimumVersion",
|
|
434
439
|
value: function getMinimumVersion(versions, depName) {
|
|
435
440
|
var depOrder = ['dependency', 'peerDependency', 'devDependency', 'optionalDependency'];
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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
|
import semver from 'semver';
|
|
5
|
-
import
|
|
6
|
+
import getPackageVersionHistoryAndTags from '../../util/get-package-version-history';
|
|
6
7
|
import { createUpgradeEvent, sendAnalytics } from '../../util/analytics';
|
|
7
|
-
|
|
8
|
+
import { getSupportedScopes, isPackageFromSupportedScopes } from './util/allowed-scopes';
|
|
9
|
+
var createAnalyticsEvents = function createAnalyticsEvents(packageName, packageVersionHistoryAndTags, since) {
|
|
10
|
+
var packageVersionHistory = packageVersionHistoryAndTags['time'];
|
|
11
|
+
var tags = packageVersionHistoryAndTags['dist-tags'];
|
|
8
12
|
var sortedPackageVersionHistory = Object.entries(packageVersionHistory).filter(function (_ref) {
|
|
9
13
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
10
14
|
version = _ref2[0];
|
|
@@ -21,7 +25,8 @@ var createAnalyticsEvents = function createAnalyticsEvents(packageName, packageV
|
|
|
21
25
|
}
|
|
22
26
|
var previousVersion = sortedPackageVersionHistory[i - 1] && sortedPackageVersionHistory[i - 1][0];
|
|
23
27
|
return createUpgradeEvent(packageName, version, previousVersion, time, {
|
|
24
|
-
historical: true
|
|
28
|
+
historical: true,
|
|
29
|
+
tags: tags
|
|
25
30
|
});
|
|
26
31
|
}).filter(function (e) {
|
|
27
32
|
return e != null;
|
|
@@ -32,46 +37,47 @@ export default function populatePackage(_x) {
|
|
|
32
37
|
return _populatePackage.apply(this, arguments);
|
|
33
38
|
}
|
|
34
39
|
function _populatePackage() {
|
|
35
|
-
_populatePackage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(flags) {
|
|
36
|
-
var packageVersionHistory, analyticsEvents;
|
|
37
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
|
+
_populatePackage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(flags) {
|
|
41
|
+
var supportedScopes, packageVersionHistory, analyticsEvents;
|
|
42
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
43
|
while (1) {
|
|
39
44
|
switch (_context.prev = _context.next) {
|
|
40
45
|
case 0:
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
supportedScopes = getSupportedScopes(flags.includeRestrictedScopes);
|
|
47
|
+
if (isPackageFromSupportedScopes(flags.pkg, supportedScopes)) {
|
|
48
|
+
_context.next = 3;
|
|
43
49
|
break;
|
|
44
50
|
}
|
|
45
|
-
throw new Error("Package must start with '
|
|
46
|
-
case
|
|
47
|
-
_context.next =
|
|
48
|
-
return
|
|
49
|
-
case
|
|
51
|
+
throw new Error("Package must start with ".concat(supportedScopes.join(', ')));
|
|
52
|
+
case 3:
|
|
53
|
+
_context.next = 5;
|
|
54
|
+
return getPackageVersionHistoryAndTags(flags.pkg);
|
|
55
|
+
case 5:
|
|
50
56
|
packageVersionHistory = _context.sent;
|
|
51
57
|
if (!(flags.since && Number.isNaN(Number(new Date(flags.since))))) {
|
|
52
|
-
_context.next =
|
|
58
|
+
_context.next = 8;
|
|
53
59
|
break;
|
|
54
60
|
}
|
|
55
61
|
throw new Error("'since' flag is an invalid date");
|
|
56
|
-
case
|
|
62
|
+
case 8:
|
|
57
63
|
analyticsEvents = createAnalyticsEvents(flags.pkg, packageVersionHistory, flags.since);
|
|
58
64
|
if (!flags.dryRun) {
|
|
59
|
-
_context.next =
|
|
65
|
+
_context.next = 12;
|
|
60
66
|
break;
|
|
61
67
|
}
|
|
62
68
|
console.log(JSON.stringify(analyticsEvents));
|
|
63
69
|
return _context.abrupt("return", analyticsEvents);
|
|
64
|
-
case
|
|
65
|
-
_context.next =
|
|
70
|
+
case 12:
|
|
71
|
+
_context.next = 14;
|
|
66
72
|
return sendAnalytics(analyticsEvents, {
|
|
67
73
|
dev: flags.dev,
|
|
68
74
|
limit: flags.limit,
|
|
69
75
|
product: 'atlaskit',
|
|
70
76
|
skipPrompt: !flags.interactive
|
|
71
77
|
});
|
|
72
|
-
case 13:
|
|
73
|
-
return _context.abrupt("return", analyticsEvents);
|
|
74
78
|
case 14:
|
|
79
|
+
return _context.abrupt("return", analyticsEvents);
|
|
80
|
+
case 15:
|
|
75
81
|
case "end":
|
|
76
82
|
return _context.stop();
|
|
77
83
|
}
|