@atlaskit/dependency-version-analytics 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/commands/populate-historic-data/lib/dependency-store.js +9 -5
- package/dist/cjs/commands/populate-historic-data/product.js +4 -1
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/commands/populate-historic-data/lib/dependency-store.js +9 -5
- package/dist/es2019/commands/populate-historic-data/product.js +4 -1
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/commands/populate-historic-data/lib/dependency-store.js +46 -44
- package/dist/esm/commands/populate-historic-data/product.js +4 -1
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/commands/populate-historic-data/lib/dependency-store.d.ts +4 -1
- package/dist/types-ts4.5/commands/populate-historic-data/lib/dependency-store.d.ts +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/dependency-version-analytics
|
|
2
2
|
|
|
3
|
+
## 1.6.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#68871](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68871) [`1cb2b8f4e1d7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1cb2b8f4e1d7) - Take subWorkDir into consideration when checking for root package.json changes
|
|
8
|
+
|
|
3
9
|
## 1.6.4
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -55,12 +55,16 @@ class DependencyStore {
|
|
|
55
55
|
/** Updates the repo dependency store based on the changes in `logItem`.
|
|
56
56
|
* Returns the updated flattened dependencies
|
|
57
57
|
*/
|
|
58
|
-
async update(
|
|
58
|
+
async update({
|
|
59
|
+
item,
|
|
60
|
+
subWorkDir
|
|
61
|
+
}) {
|
|
59
62
|
this.assertInitialised();
|
|
60
|
-
const hash =
|
|
61
|
-
(0, _assert.assert)(!!
|
|
62
|
-
const changedPackageJsons =
|
|
63
|
-
const
|
|
63
|
+
const hash = item.hash;
|
|
64
|
+
(0, _assert.assert)(!!item.diff, `Diff must exist in log ${item} ${hash}`);
|
|
65
|
+
const changedPackageJsons = item.diff.files.filter(f => f.file.endsWith('package.json')).map(f => f.file);
|
|
66
|
+
const rootPackageJson = `${subWorkDir ? `${subWorkDir}/` : ''}package.json`;
|
|
67
|
+
const didRootPackageJsonChange = !!changedPackageJsons.find(file => file === rootPackageJson);
|
|
64
68
|
if (didRootPackageJsonChange) {
|
|
65
69
|
const workspacePackageJsonPaths = await (0, _yarn.getWorkspacePackageJsonPaths)(hash, this.subWorkDir);
|
|
66
70
|
const workspacePackageJsonPathsChanged = workspacePackageJsonPaths !== null && (this.workspacePackageJsonPaths.size !== workspacePackageJsonPaths.size || [...this.workspacePackageJsonPaths].some(glob => !workspacePackageJsonPaths.has(glob)));
|
|
@@ -67,7 +67,10 @@ const getEventsFromHistory = async (packageChangesLog, prevRunHash, directoryOpt
|
|
|
67
67
|
if (allPackageChanges.length > 0) {
|
|
68
68
|
dependencies = allPackageChanges[allPackageChanges.length - 1].deps;
|
|
69
69
|
}
|
|
70
|
-
const newDependencies = await dependencyStore.update(
|
|
70
|
+
const newDependencies = await dependencyStore.update({
|
|
71
|
+
item,
|
|
72
|
+
subWorkDir: directoryOptions.subWorkDir
|
|
73
|
+
});
|
|
71
74
|
const packageChange = {
|
|
72
75
|
date: new Date(item.date).toISOString(),
|
|
73
76
|
deps: newDependencies
|
|
@@ -67,7 +67,7 @@ function createUpgradeEvent(name, version, previousVersion, date, optionalEventA
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
return {
|
|
70
|
-
cliVersion: "1.6.
|
|
70
|
+
cliVersion: "1.6.5",
|
|
71
71
|
dependencyName: name,
|
|
72
72
|
versionString: eventVersion,
|
|
73
73
|
major: parsedVersion ? `${parsedVersion.major}` : null,
|
|
@@ -48,12 +48,16 @@ export class DependencyStore {
|
|
|
48
48
|
/** Updates the repo dependency store based on the changes in `logItem`.
|
|
49
49
|
* Returns the updated flattened dependencies
|
|
50
50
|
*/
|
|
51
|
-
async update(
|
|
51
|
+
async update({
|
|
52
|
+
item,
|
|
53
|
+
subWorkDir
|
|
54
|
+
}) {
|
|
52
55
|
this.assertInitialised();
|
|
53
|
-
const hash =
|
|
54
|
-
assert(!!
|
|
55
|
-
const changedPackageJsons =
|
|
56
|
-
const
|
|
56
|
+
const hash = item.hash;
|
|
57
|
+
assert(!!item.diff, `Diff must exist in log ${item} ${hash}`);
|
|
58
|
+
const changedPackageJsons = item.diff.files.filter(f => f.file.endsWith('package.json')).map(f => f.file);
|
|
59
|
+
const rootPackageJson = `${subWorkDir ? `${subWorkDir}/` : ''}package.json`;
|
|
60
|
+
const didRootPackageJsonChange = !!changedPackageJsons.find(file => file === rootPackageJson);
|
|
57
61
|
if (didRootPackageJsonChange) {
|
|
58
62
|
const workspacePackageJsonPaths = await getWorkspacePackageJsonPaths(hash, this.subWorkDir);
|
|
59
63
|
const workspacePackageJsonPathsChanged = workspacePackageJsonPaths !== null && (this.workspacePackageJsonPaths.size !== workspacePackageJsonPaths.size || [...this.workspacePackageJsonPaths].some(glob => !workspacePackageJsonPaths.has(glob)));
|
|
@@ -58,7 +58,10 @@ const getEventsFromHistory = async (packageChangesLog, prevRunHash, directoryOpt
|
|
|
58
58
|
if (allPackageChanges.length > 0) {
|
|
59
59
|
dependencies = allPackageChanges[allPackageChanges.length - 1].deps;
|
|
60
60
|
}
|
|
61
|
-
const newDependencies = await dependencyStore.update(
|
|
61
|
+
const newDependencies = await dependencyStore.update({
|
|
62
|
+
item,
|
|
63
|
+
subWorkDir: directoryOptions.subWorkDir
|
|
64
|
+
});
|
|
62
65
|
const packageChange = {
|
|
63
66
|
date: new Date(item.date).toISOString(),
|
|
64
67
|
deps: newDependencies
|
|
@@ -59,7 +59,7 @@ export function createUpgradeEvent(name, version, previousVersion, date, optiona
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
return {
|
|
62
|
-
cliVersion: "1.6.
|
|
62
|
+
cliVersion: "1.6.5",
|
|
63
63
|
dependencyName: name,
|
|
64
64
|
versionString: eventVersion,
|
|
65
65
|
major: parsedVersion ? `${parsedVersion.major}` : null,
|
|
@@ -81,68 +81,70 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
81
81
|
}, {
|
|
82
82
|
key: "update",
|
|
83
83
|
value: function () {
|
|
84
|
-
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(
|
|
85
|
-
var hash, changedPackageJsons, didRootPackageJsonChange, workspacePackageJsonPaths, workspacePackageJsonPathsChanged, changedWorkspaces, _iterator, _step, workspacePath, workspaceDeps, validWorkspace, noLongerWorkspace;
|
|
84
|
+
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
85
|
+
var item, subWorkDir, hash, changedPackageJsons, rootPackageJson, didRootPackageJsonChange, workspacePackageJsonPaths, workspacePackageJsonPathsChanged, changedWorkspaces, _iterator, _step, workspacePath, workspaceDeps, validWorkspace, noLongerWorkspace;
|
|
86
86
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
87
87
|
while (1) switch (_context2.prev = _context2.next) {
|
|
88
88
|
case 0:
|
|
89
|
+
item = _ref2.item, subWorkDir = _ref2.subWorkDir;
|
|
89
90
|
this.assertInitialised();
|
|
90
|
-
hash =
|
|
91
|
-
assert(!!
|
|
92
|
-
changedPackageJsons =
|
|
91
|
+
hash = item.hash;
|
|
92
|
+
assert(!!item.diff, "Diff must exist in log ".concat(item, " ").concat(hash));
|
|
93
|
+
changedPackageJsons = item.diff.files.filter(function (f) {
|
|
93
94
|
return f.file.endsWith('package.json');
|
|
94
95
|
}).map(function (f) {
|
|
95
96
|
return f.file;
|
|
96
97
|
});
|
|
98
|
+
rootPackageJson = "".concat(subWorkDir ? "".concat(subWorkDir, "/") : '', "package.json");
|
|
97
99
|
didRootPackageJsonChange = !!changedPackageJsons.find(function (file) {
|
|
98
|
-
return file ===
|
|
100
|
+
return file === rootPackageJson;
|
|
99
101
|
});
|
|
100
102
|
if (!didRootPackageJsonChange) {
|
|
101
|
-
_context2.next =
|
|
103
|
+
_context2.next = 17;
|
|
102
104
|
break;
|
|
103
105
|
}
|
|
104
|
-
_context2.next =
|
|
106
|
+
_context2.next = 10;
|
|
105
107
|
return getWorkspacePackageJsonPaths(hash, this.subWorkDir);
|
|
106
|
-
case
|
|
108
|
+
case 10:
|
|
107
109
|
workspacePackageJsonPaths = _context2.sent;
|
|
108
110
|
workspacePackageJsonPathsChanged = workspacePackageJsonPaths !== null && (this.workspacePackageJsonPaths.size !== workspacePackageJsonPaths.size || _toConsumableArray(this.workspacePackageJsonPaths).some(function (glob) {
|
|
109
111
|
return !workspacePackageJsonPaths.has(glob);
|
|
110
112
|
}));
|
|
111
113
|
if (!workspacePackageJsonPathsChanged) {
|
|
112
|
-
_context2.next =
|
|
114
|
+
_context2.next = 17;
|
|
113
115
|
break;
|
|
114
116
|
}
|
|
115
117
|
debug("Workspace globs changed: ".concat(_toConsumableArray(workspacePackageJsonPaths), ". Resetting store."));
|
|
116
|
-
_context2.next =
|
|
118
|
+
_context2.next = 16;
|
|
117
119
|
return this.resetStore(hash);
|
|
118
|
-
case
|
|
120
|
+
case 16:
|
|
119
121
|
return _context2.abrupt("return", this.getFlattenedDeps());
|
|
120
|
-
case
|
|
122
|
+
case 17:
|
|
121
123
|
changedWorkspaces = micromatch(changedPackageJsons, _toConsumableArray(this.workspacePackageJsonPaths));
|
|
122
124
|
debug("Updating changed workspaces@".concat(hash, ": ").concat(changedWorkspaces));
|
|
123
125
|
|
|
124
126
|
// Iterate over all changed package.jsons rather than only valid workspaces so that we can
|
|
125
127
|
// remove older workspaces that are no longer valid
|
|
126
128
|
_iterator = _createForOfIteratorHelper(changedPackageJsons);
|
|
127
|
-
_context2.prev =
|
|
129
|
+
_context2.prev = 20;
|
|
128
130
|
_iterator.s();
|
|
129
|
-
case
|
|
131
|
+
case 22:
|
|
130
132
|
if ((_step = _iterator.n()).done) {
|
|
131
|
-
_context2.next =
|
|
133
|
+
_context2.next = 35;
|
|
132
134
|
break;
|
|
133
135
|
}
|
|
134
136
|
workspacePath = _step.value;
|
|
135
|
-
_context2.next =
|
|
137
|
+
_context2.next = 26;
|
|
136
138
|
return this.getWorkspaceDependencies(hash, workspacePath);
|
|
137
|
-
case
|
|
139
|
+
case 26:
|
|
138
140
|
workspaceDeps = _context2.sent;
|
|
139
141
|
validWorkspace = changedWorkspaces.includes(workspacePath);
|
|
140
142
|
if (!(!validWorkspace && !this.workspaces[workspacePath])) {
|
|
141
|
-
_context2.next =
|
|
143
|
+
_context2.next = 30;
|
|
142
144
|
break;
|
|
143
145
|
}
|
|
144
|
-
return _context2.abrupt("continue",
|
|
145
|
-
case
|
|
146
|
+
return _context2.abrupt("continue", 33);
|
|
147
|
+
case 30:
|
|
146
148
|
// For workspaces that are no longer a valid workspace but were previously, explicitly remove them
|
|
147
149
|
noLongerWorkspace = !validWorkspace && this.workspaces[workspacePath];
|
|
148
150
|
if (workspaceDeps == null || noLongerWorkspace) {
|
|
@@ -155,27 +157,27 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
155
157
|
workspaceDeps = {};
|
|
156
158
|
}
|
|
157
159
|
this.updateWorkspaces(workspacePath, workspaceDeps);
|
|
158
|
-
case 31:
|
|
159
|
-
_context2.next = 20;
|
|
160
|
-
break;
|
|
161
160
|
case 33:
|
|
162
|
-
_context2.next =
|
|
161
|
+
_context2.next = 22;
|
|
163
162
|
break;
|
|
164
163
|
case 35:
|
|
165
|
-
_context2.
|
|
166
|
-
|
|
164
|
+
_context2.next = 40;
|
|
165
|
+
break;
|
|
166
|
+
case 37:
|
|
167
|
+
_context2.prev = 37;
|
|
168
|
+
_context2.t0 = _context2["catch"](20);
|
|
167
169
|
_iterator.e(_context2.t0);
|
|
168
|
-
case
|
|
169
|
-
_context2.prev =
|
|
170
|
+
case 40:
|
|
171
|
+
_context2.prev = 40;
|
|
170
172
|
_iterator.f();
|
|
171
|
-
return _context2.finish(
|
|
172
|
-
case
|
|
173
|
+
return _context2.finish(40);
|
|
174
|
+
case 43:
|
|
173
175
|
return _context2.abrupt("return", this.getFlattenedDeps());
|
|
174
|
-
case
|
|
176
|
+
case 44:
|
|
175
177
|
case "end":
|
|
176
178
|
return _context2.stop();
|
|
177
179
|
}
|
|
178
|
-
}, _callee2, this, [[
|
|
180
|
+
}, _callee2, this, [[20, 37, 40, 43]]);
|
|
179
181
|
}));
|
|
180
182
|
function update(_x2) {
|
|
181
183
|
return _update.apply(this, arguments);
|
|
@@ -189,14 +191,14 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
189
191
|
}, {
|
|
190
192
|
key: "getFlattenedDeps",
|
|
191
193
|
value: function getFlattenedDeps() {
|
|
192
|
-
var deps = Object.entries(this.dependencies).filter(function (
|
|
193
|
-
var
|
|
194
|
-
versions =
|
|
194
|
+
var deps = Object.entries(this.dependencies).filter(function (_ref3) {
|
|
195
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
196
|
+
versions = _ref4[1];
|
|
195
197
|
return versions.length > 0;
|
|
196
|
-
}).map(function (
|
|
197
|
-
var
|
|
198
|
-
depName =
|
|
199
|
-
versions =
|
|
198
|
+
}).map(function (_ref5) {
|
|
199
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
200
|
+
depName = _ref6[0],
|
|
201
|
+
versions = _ref6[1];
|
|
200
202
|
return [depName, DependencyStore.getMinimumVersion(versions, depName)];
|
|
201
203
|
});
|
|
202
204
|
return Object.fromEntries(deps);
|
|
@@ -411,10 +413,10 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
411
413
|
key: "getSupportedDependencies",
|
|
412
414
|
value: function getSupportedDependencies(depMap, dependencyType) {
|
|
413
415
|
var _this = this;
|
|
414
|
-
return Object.entries(depMap).reduce(function (supportedDependencies,
|
|
415
|
-
var
|
|
416
|
-
rawPackageName =
|
|
417
|
-
packageVersion =
|
|
416
|
+
return Object.entries(depMap).reduce(function (supportedDependencies, _ref7) {
|
|
417
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
418
|
+
rawPackageName = _ref8[0],
|
|
419
|
+
packageVersion = _ref8[1];
|
|
418
420
|
// Ignore suffixed `--next` deps in jira used for independent upgrades
|
|
419
421
|
if (rawPackageName.endsWith('--next')) {
|
|
420
422
|
return supportedDependencies;
|
|
@@ -91,7 +91,10 @@ var getEventsFromHistory = /*#__PURE__*/function () {
|
|
|
91
91
|
dependencies = allPackageChanges[allPackageChanges.length - 1].deps;
|
|
92
92
|
}
|
|
93
93
|
_context.next = 13;
|
|
94
|
-
return dependencyStore.update(
|
|
94
|
+
return dependencyStore.update({
|
|
95
|
+
item: item,
|
|
96
|
+
subWorkDir: directoryOptions.subWorkDir
|
|
97
|
+
});
|
|
95
98
|
case 13:
|
|
96
99
|
newDependencies = _context.sent;
|
|
97
100
|
packageChange = {
|
|
@@ -66,7 +66,7 @@ export function createUpgradeEvent(name, version, previousVersion, date) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
return _objectSpread({
|
|
69
|
-
cliVersion: "1.6.
|
|
69
|
+
cliVersion: "1.6.5",
|
|
70
70
|
dependencyName: name,
|
|
71
71
|
versionString: eventVersion,
|
|
72
72
|
major: parsedVersion ? "".concat(parsedVersion.major) : null,
|
|
@@ -30,7 +30,10 @@ export declare class DependencyStore {
|
|
|
30
30
|
/** Updates the repo dependency store based on the changes in `logItem`.
|
|
31
31
|
* Returns the updated flattened dependencies
|
|
32
32
|
*/
|
|
33
|
-
update(
|
|
33
|
+
update({ item, subWorkDir, }: {
|
|
34
|
+
item: DefaultLogFields & ListLogLine;
|
|
35
|
+
subWorkDir?: string;
|
|
36
|
+
}): Promise<DependencyMap>;
|
|
34
37
|
/** Retrieve a flattened list of p repo dependencies.
|
|
35
38
|
* If multiple versions of a dependency exist, the lowest version is returned.
|
|
36
39
|
* If the dependency is listed under multiple dependency types, 'dependencies' is prioritised over 'devDependencies'
|
|
@@ -30,7 +30,10 @@ export declare class DependencyStore {
|
|
|
30
30
|
/** Updates the repo dependency store based on the changes in `logItem`.
|
|
31
31
|
* Returns the updated flattened dependencies
|
|
32
32
|
*/
|
|
33
|
-
update(
|
|
33
|
+
update({ item, subWorkDir, }: {
|
|
34
|
+
item: DefaultLogFields & ListLogLine;
|
|
35
|
+
subWorkDir?: string;
|
|
36
|
+
}): Promise<DependencyMap>;
|
|
34
37
|
/** Retrieve a flattened list of p repo dependencies.
|
|
35
38
|
* If multiple versions of a dependency exist, the lowest version is returned.
|
|
36
39
|
* If the dependency is listed under multiple dependency types, 'dependencies' is prioritised over 'devDependencies'
|