@atlaskit/dependency-version-analytics 1.5.1 → 1.6.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 +6 -0
- package/dist/cjs/commands/populate-historic-data/lib/dependency-store.js +16 -8
- package/dist/cjs/commands/populate-historic-data/product.js +10 -12
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/cjs/util/yarn.js +9 -12
- package/dist/es2019/commands/populate-historic-data/lib/dependency-store.js +15 -8
- package/dist/es2019/commands/populate-historic-data/product.js +10 -12
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/es2019/util/yarn.js +9 -12
- package/dist/esm/commands/populate-historic-data/lib/dependency-store.js +25 -22
- package/dist/esm/commands/populate-historic-data/product.js +25 -24
- package/dist/esm/util/analytics.js +1 -1
- package/dist/esm/util/yarn.js +29 -32
- package/dist/types/commands/populate-historic-data/lib/dependency-store.d.ts +11 -2
- package/dist/types/commands/populate-historic-data/product.d.ts +1 -0
- package/dist/types/util/yarn.d.ts +2 -2
- package/dist/types-ts4.5/commands/populate-historic-data/lib/dependency-store.d.ts +11 -2
- package/dist/types-ts4.5/commands/populate-historic-data/product.d.ts +1 -0
- package/dist/types-ts4.5/util/yarn.d.ts +2 -2
- package/package.json +1 -1
- package/report.api.md +1 -0
- package/tmp/api-report-tmp.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -20,6 +20,12 @@ const debug = (0, _debug.default)('atlaskit:dependency');
|
|
|
20
20
|
* Stores the state of atlaskit dependencies in a repository
|
|
21
21
|
*/
|
|
22
22
|
class DependencyStore {
|
|
23
|
+
/**
|
|
24
|
+
* We may want to work not in root, but in specific directory
|
|
25
|
+
* The reason is - some repositories have their package.json not in root
|
|
26
|
+
* For example "confluence-frontend" repo has package.json at "confluence-frontend/confluence/package.json"
|
|
27
|
+
*/
|
|
28
|
+
|
|
23
29
|
/** Mapping of dependency names to arrays of unique dependency type + versions */
|
|
24
30
|
dependencies = {};
|
|
25
31
|
/** Mapping of workspaces to their dependency map. Each dependency in their map links to an entry in `dependencies` */
|
|
@@ -27,8 +33,12 @@ class DependencyStore {
|
|
|
27
33
|
/** Set of workspace paths to their "package.json". Used to verify that a package.json is a valid workspace */
|
|
28
34
|
workspacePackageJsonPaths = new Set();
|
|
29
35
|
initialised = false;
|
|
30
|
-
constructor(
|
|
31
|
-
|
|
36
|
+
constructor({
|
|
37
|
+
subWorkDir,
|
|
38
|
+
supportedScopes,
|
|
39
|
+
supportedPackages
|
|
40
|
+
}) {
|
|
41
|
+
this.subWorkDir = subWorkDir;
|
|
32
42
|
this.supportedScopes = supportedScopes;
|
|
33
43
|
this.supportedPackages = supportedPackages;
|
|
34
44
|
}
|
|
@@ -52,7 +62,7 @@ class DependencyStore {
|
|
|
52
62
|
const changedPackageJsons = logItem.diff.files.filter(f => f.file.endsWith('package.json')).map(f => f.file);
|
|
53
63
|
const didRootPackageJsonChange = !!changedPackageJsons.find(file => file === 'package.json');
|
|
54
64
|
if (didRootPackageJsonChange) {
|
|
55
|
-
const workspacePackageJsonPaths = await (0, _yarn.getWorkspacePackageJsonPaths)(hash, this.
|
|
65
|
+
const workspacePackageJsonPaths = await (0, _yarn.getWorkspacePackageJsonPaths)(hash, this.subWorkDir);
|
|
56
66
|
const workspacePackageJsonPathsChanged = workspacePackageJsonPaths !== null && (this.workspacePackageJsonPaths.size !== workspacePackageJsonPaths.size || [...this.workspacePackageJsonPaths].some(glob => !workspacePackageJsonPaths.has(glob)));
|
|
57
67
|
if (workspacePackageJsonPathsChanged) {
|
|
58
68
|
debug(`Workspace globs changed: ${[...workspacePackageJsonPaths]}. Resetting store.`);
|
|
@@ -107,11 +117,11 @@ class DependencyStore {
|
|
|
107
117
|
async resetStore(hash) {
|
|
108
118
|
this.dependencies = {};
|
|
109
119
|
this.workspaces = {};
|
|
110
|
-
const workspaceGlobs = await (0, _yarn.getWorkspacePackageJsonPaths)(hash, this.
|
|
120
|
+
const workspaceGlobs = await (0, _yarn.getWorkspacePackageJsonPaths)(hash, this.subWorkDir);
|
|
111
121
|
if (workspaceGlobs !== null) {
|
|
112
122
|
this.workspacePackageJsonPaths = workspaceGlobs;
|
|
113
123
|
}
|
|
114
|
-
const workspacePaths = await (0, _yarn.getWorkspacePaths)(hash, this.workspacePackageJsonPaths
|
|
124
|
+
const workspacePaths = await (0, _yarn.getWorkspacePaths)(hash, this.workspacePackageJsonPaths);
|
|
115
125
|
debug(`Workspace paths: ${workspacePaths}`);
|
|
116
126
|
for (const wsPath of workspacePaths) {
|
|
117
127
|
if (this.workspaces[wsPath]) {
|
|
@@ -127,9 +137,7 @@ class DependencyStore {
|
|
|
127
137
|
async getWorkspaceDependencies(hash, workspacePath) {
|
|
128
138
|
let file;
|
|
129
139
|
try {
|
|
130
|
-
file = await (0, _git.showFile)(hash, workspacePath
|
|
131
|
-
cwd: this.cwd
|
|
132
|
-
});
|
|
140
|
+
file = await (0, _git.showFile)(hash, workspacePath);
|
|
133
141
|
} catch (e) {
|
|
134
142
|
debug(`Could not show file ${workspacePath}@${hash}`);
|
|
135
143
|
return null;
|
|
@@ -50,13 +50,15 @@ const getUpgradeEventsFromPkgChange = (oldDeps, newDeps, {
|
|
|
50
50
|
}).filter(e => e != null);
|
|
51
51
|
return [...addOrUpgradeEvents, ...removeEvents];
|
|
52
52
|
};
|
|
53
|
-
const getEventsFromHistory = async (packageChangesLog, prevRunHash, {
|
|
54
|
-
cwd
|
|
55
|
-
}, supportedScopes, supportedPackages) => {
|
|
53
|
+
const getEventsFromHistory = async (packageChangesLog, prevRunHash, directoryOptions, supportedScopes, supportedPackages) => {
|
|
56
54
|
const allPackageChanges = [];
|
|
57
55
|
let allUpgradeEvents = [];
|
|
58
56
|
(0, _assert.assert)(packageChangesLog.all.length > 0, '');
|
|
59
|
-
let dependencyStore = new _dependencyStore.DependencyStore(
|
|
57
|
+
let dependencyStore = new _dependencyStore.DependencyStore({
|
|
58
|
+
...directoryOptions,
|
|
59
|
+
supportedScopes,
|
|
60
|
+
supportedPackages
|
|
61
|
+
});
|
|
60
62
|
let dependencies = await dependencyStore.initialise(prevRunHash);
|
|
61
63
|
for (let i = 0; i < packageChangesLog.all.length; i++) {
|
|
62
64
|
let item = packageChangesLog.all[i];
|
|
@@ -99,14 +101,10 @@ async function getSinceRef(flags) {
|
|
|
99
101
|
return tag;
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
|
-
const getWorkDir = cwd => {
|
|
103
|
-
const workDir = cwd ?? process.cwd();
|
|
104
|
-
// Make sure that we're working in needed directory
|
|
105
|
-
process.chdir(workDir);
|
|
106
|
-
return workDir;
|
|
107
|
-
};
|
|
108
104
|
async function populateProduct(flags) {
|
|
109
|
-
|
|
105
|
+
if (flags.cwd) {
|
|
106
|
+
process.chdir(flags.cwd);
|
|
107
|
+
}
|
|
110
108
|
const sinceRef = flags.reset ? undefined : await getSinceRef(flags);
|
|
111
109
|
const log = await (0, _git.getChangesSince)(sinceRef);
|
|
112
110
|
const supportedScopes = (0, _allowedScopes.getSupportedScopes)(flags.includeRestrictedScopes);
|
|
@@ -120,7 +118,7 @@ async function populateProduct(flags) {
|
|
|
120
118
|
allPackageChanges,
|
|
121
119
|
allUpgradeEvents
|
|
122
120
|
} = await getEventsFromHistory(log, sinceRef, {
|
|
123
|
-
|
|
121
|
+
subWorkDir: flags.subWorkDir
|
|
124
122
|
}, supportedScopes, supportedPackages);
|
|
125
123
|
if (!allUpgradeEvents.length) {
|
|
126
124
|
console.log(`Found no dependency changes from supported scopes ${supportedScopes.join(', ')} since last run from ref "${sinceRef}"'`);
|
|
@@ -67,7 +67,7 @@ function createUpgradeEvent(name, version, previousVersion, date, optionalEventA
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
return {
|
|
70
|
-
cliVersion: "1.
|
|
70
|
+
cliVersion: "1.6.0",
|
|
71
71
|
dependencyName: name,
|
|
72
72
|
versionString: eventVersion,
|
|
73
73
|
major: parsedVersion ? `${parsedVersion.major}` : null,
|
package/dist/cjs/util/yarn.js
CHANGED
|
@@ -13,19 +13,18 @@ var git = _interopRequireWildcard(require("./git"));
|
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
const debug = (0, _debug.default)('atlaskit:yarn');
|
|
16
|
-
async function getWorkspacePackageJsonPaths(hash,
|
|
16
|
+
async function getWorkspacePackageJsonPaths(hash, subWorkDir) {
|
|
17
17
|
let file;
|
|
18
|
+
const rootPackageJson = `${subWorkDir ? `${subWorkDir}/` : ''}package.json`;
|
|
18
19
|
try {
|
|
19
20
|
/**
|
|
20
21
|
* We need to use package.json from current working directory, not from root
|
|
21
22
|
* The reason is - some repositories have their package.json not in root
|
|
22
23
|
* For example "confluence-frontend" repo has package.json at "confluence-frontend/confluence/package.json"
|
|
23
24
|
*/
|
|
24
|
-
file = await git.showFile(hash,
|
|
25
|
-
cwd
|
|
26
|
-
});
|
|
25
|
+
file = await git.showFile(hash, rootPackageJson);
|
|
27
26
|
} catch (error) {
|
|
28
|
-
const errorMessage = `File by hash "${hash}" and path "${
|
|
27
|
+
const errorMessage = `File by hash "${hash}" and path "${rootPackageJson}" does not exist`;
|
|
29
28
|
debug(errorMessage, {
|
|
30
29
|
error
|
|
31
30
|
});
|
|
@@ -41,22 +40,20 @@ async function getWorkspacePackageJsonPaths(hash, cwd) {
|
|
|
41
40
|
}
|
|
42
41
|
const workspaces = rootPackageJsonFile.workspaces;
|
|
43
42
|
if (!workspaces) {
|
|
44
|
-
return new Set([
|
|
43
|
+
return new Set([rootPackageJson]);
|
|
45
44
|
}
|
|
46
45
|
// There are actually two formats for workspaces and they are poorly documented
|
|
47
46
|
const workspacePackages = Array.isArray(workspaces) ? workspaces : workspaces.packages;
|
|
48
|
-
return new Set([
|
|
47
|
+
return new Set([rootPackageJson, ...workspacePackages.map(glob => _path.default.join(glob, 'package.json'))]);
|
|
49
48
|
}
|
|
50
|
-
async function getWorkspacePaths(ref, workspaceGlobs
|
|
49
|
+
async function getWorkspacePaths(ref, workspaceGlobs) {
|
|
51
50
|
if (workspaceGlobs.size === 0) {
|
|
52
51
|
return [];
|
|
53
52
|
}
|
|
54
|
-
const workspacePackageJsons = await git.getFiles(ref, '**/package.json'
|
|
55
|
-
cwd
|
|
56
|
-
});
|
|
53
|
+
const workspacePackageJsons = await git.getFiles(ref, '**/package.json');
|
|
57
54
|
const matchedWorkspaces = (0, _micromatch.default)(workspacePackageJsons, [...workspaceGlobs]);
|
|
58
55
|
if (matchedWorkspaces.length === 0) {
|
|
59
|
-
throw new Error(`Could not find any workspace or package.json under "${cwd}" for "${ref}" tag`);
|
|
56
|
+
throw new Error(`Could not find any workspace or package.json under "${process.cwd()}" for "${ref}" tag`);
|
|
60
57
|
}
|
|
61
58
|
return matchedWorkspaces;
|
|
62
59
|
}
|
|
@@ -14,7 +14,16 @@ const debug = debugModule('atlaskit:dependency');
|
|
|
14
14
|
* Stores the state of atlaskit dependencies in a repository
|
|
15
15
|
*/
|
|
16
16
|
export class DependencyStore {
|
|
17
|
-
constructor(
|
|
17
|
+
constructor({
|
|
18
|
+
subWorkDir,
|
|
19
|
+
supportedScopes,
|
|
20
|
+
supportedPackages
|
|
21
|
+
}) {
|
|
22
|
+
/**
|
|
23
|
+
* We may want to work not in root, but in specific directory
|
|
24
|
+
* The reason is - some repositories have their package.json not in root
|
|
25
|
+
* For example "confluence-frontend" repo has package.json at "confluence-frontend/confluence/package.json"
|
|
26
|
+
*/
|
|
18
27
|
/** Mapping of dependency names to arrays of unique dependency type + versions */
|
|
19
28
|
_defineProperty(this, "dependencies", {});
|
|
20
29
|
/** Mapping of workspaces to their dependency map. Each dependency in their map links to an entry in `dependencies` */
|
|
@@ -22,7 +31,7 @@ export class DependencyStore {
|
|
|
22
31
|
/** Set of workspace paths to their "package.json". Used to verify that a package.json is a valid workspace */
|
|
23
32
|
_defineProperty(this, "workspacePackageJsonPaths", new Set());
|
|
24
33
|
_defineProperty(this, "initialised", false);
|
|
25
|
-
this.
|
|
34
|
+
this.subWorkDir = subWorkDir;
|
|
26
35
|
this.supportedScopes = supportedScopes;
|
|
27
36
|
this.supportedPackages = supportedPackages;
|
|
28
37
|
}
|
|
@@ -46,7 +55,7 @@ export class DependencyStore {
|
|
|
46
55
|
const changedPackageJsons = logItem.diff.files.filter(f => f.file.endsWith('package.json')).map(f => f.file);
|
|
47
56
|
const didRootPackageJsonChange = !!changedPackageJsons.find(file => file === 'package.json');
|
|
48
57
|
if (didRootPackageJsonChange) {
|
|
49
|
-
const workspacePackageJsonPaths = await getWorkspacePackageJsonPaths(hash, this.
|
|
58
|
+
const workspacePackageJsonPaths = await getWorkspacePackageJsonPaths(hash, this.subWorkDir);
|
|
50
59
|
const workspacePackageJsonPathsChanged = workspacePackageJsonPaths !== null && (this.workspacePackageJsonPaths.size !== workspacePackageJsonPaths.size || [...this.workspacePackageJsonPaths].some(glob => !workspacePackageJsonPaths.has(glob)));
|
|
51
60
|
if (workspacePackageJsonPathsChanged) {
|
|
52
61
|
debug(`Workspace globs changed: ${[...workspacePackageJsonPaths]}. Resetting store.`);
|
|
@@ -101,11 +110,11 @@ export class DependencyStore {
|
|
|
101
110
|
async resetStore(hash) {
|
|
102
111
|
this.dependencies = {};
|
|
103
112
|
this.workspaces = {};
|
|
104
|
-
const workspaceGlobs = await getWorkspacePackageJsonPaths(hash, this.
|
|
113
|
+
const workspaceGlobs = await getWorkspacePackageJsonPaths(hash, this.subWorkDir);
|
|
105
114
|
if (workspaceGlobs !== null) {
|
|
106
115
|
this.workspacePackageJsonPaths = workspaceGlobs;
|
|
107
116
|
}
|
|
108
|
-
const workspacePaths = await getWorkspacePaths(hash, this.workspacePackageJsonPaths
|
|
117
|
+
const workspacePaths = await getWorkspacePaths(hash, this.workspacePackageJsonPaths);
|
|
109
118
|
debug(`Workspace paths: ${workspacePaths}`);
|
|
110
119
|
for (const wsPath of workspacePaths) {
|
|
111
120
|
if (this.workspaces[wsPath]) {
|
|
@@ -121,9 +130,7 @@ export class DependencyStore {
|
|
|
121
130
|
async getWorkspaceDependencies(hash, workspacePath) {
|
|
122
131
|
let file;
|
|
123
132
|
try {
|
|
124
|
-
file = await showFile(hash, workspacePath
|
|
125
|
-
cwd: this.cwd
|
|
126
|
-
});
|
|
133
|
+
file = await showFile(hash, workspacePath);
|
|
127
134
|
} catch (e) {
|
|
128
135
|
debug(`Could not show file ${workspacePath}@${hash}`);
|
|
129
136
|
return null;
|
|
@@ -41,13 +41,15 @@ const getUpgradeEventsFromPkgChange = (oldDeps, newDeps, {
|
|
|
41
41
|
}).filter(e => e != null);
|
|
42
42
|
return [...addOrUpgradeEvents, ...removeEvents];
|
|
43
43
|
};
|
|
44
|
-
const getEventsFromHistory = async (packageChangesLog, prevRunHash, {
|
|
45
|
-
cwd
|
|
46
|
-
}, supportedScopes, supportedPackages) => {
|
|
44
|
+
const getEventsFromHistory = async (packageChangesLog, prevRunHash, directoryOptions, supportedScopes, supportedPackages) => {
|
|
47
45
|
const allPackageChanges = [];
|
|
48
46
|
let allUpgradeEvents = [];
|
|
49
47
|
assert(packageChangesLog.all.length > 0, '');
|
|
50
|
-
let dependencyStore = new DependencyStore(
|
|
48
|
+
let dependencyStore = new DependencyStore({
|
|
49
|
+
...directoryOptions,
|
|
50
|
+
supportedScopes,
|
|
51
|
+
supportedPackages
|
|
52
|
+
});
|
|
51
53
|
let dependencies = await dependencyStore.initialise(prevRunHash);
|
|
52
54
|
for (let i = 0; i < packageChangesLog.all.length; i++) {
|
|
53
55
|
let item = packageChangesLog.all[i];
|
|
@@ -90,14 +92,10 @@ async function getSinceRef(flags) {
|
|
|
90
92
|
return tag;
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
|
-
const getWorkDir = cwd => {
|
|
94
|
-
const workDir = cwd !== null && cwd !== void 0 ? cwd : process.cwd();
|
|
95
|
-
// Make sure that we're working in needed directory
|
|
96
|
-
process.chdir(workDir);
|
|
97
|
-
return workDir;
|
|
98
|
-
};
|
|
99
95
|
export default async function populateProduct(flags) {
|
|
100
|
-
|
|
96
|
+
if (flags.cwd) {
|
|
97
|
+
process.chdir(flags.cwd);
|
|
98
|
+
}
|
|
101
99
|
const sinceRef = flags.reset ? undefined : await getSinceRef(flags);
|
|
102
100
|
const log = await getChangesSince(sinceRef);
|
|
103
101
|
const supportedScopes = getSupportedScopes(flags.includeRestrictedScopes);
|
|
@@ -111,7 +109,7 @@ export default async function populateProduct(flags) {
|
|
|
111
109
|
allPackageChanges,
|
|
112
110
|
allUpgradeEvents
|
|
113
111
|
} = await getEventsFromHistory(log, sinceRef, {
|
|
114
|
-
|
|
112
|
+
subWorkDir: flags.subWorkDir
|
|
115
113
|
}, supportedScopes, supportedPackages);
|
|
116
114
|
if (!allUpgradeEvents.length) {
|
|
117
115
|
console.log(`Found no dependency changes from supported scopes ${supportedScopes.join(', ')} since last run from ref "${sinceRef}"'`);
|
|
@@ -59,7 +59,7 @@ export function createUpgradeEvent(name, version, previousVersion, date, optiona
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
return {
|
|
62
|
-
cliVersion: "1.
|
|
62
|
+
cliVersion: "1.6.0",
|
|
63
63
|
dependencyName: name,
|
|
64
64
|
versionString: eventVersion,
|
|
65
65
|
major: parsedVersion ? `${parsedVersion.major}` : null,
|
package/dist/es2019/util/yarn.js
CHANGED
|
@@ -3,19 +3,18 @@ import debugModule from 'debug';
|
|
|
3
3
|
import micromatch from 'micromatch';
|
|
4
4
|
import * as git from './git';
|
|
5
5
|
const debug = debugModule('atlaskit:yarn');
|
|
6
|
-
export async function getWorkspacePackageJsonPaths(hash,
|
|
6
|
+
export async function getWorkspacePackageJsonPaths(hash, subWorkDir) {
|
|
7
7
|
let file;
|
|
8
|
+
const rootPackageJson = `${subWorkDir ? `${subWorkDir}/` : ''}package.json`;
|
|
8
9
|
try {
|
|
9
10
|
/**
|
|
10
11
|
* We need to use package.json from current working directory, not from root
|
|
11
12
|
* The reason is - some repositories have their package.json not in root
|
|
12
13
|
* For example "confluence-frontend" repo has package.json at "confluence-frontend/confluence/package.json"
|
|
13
14
|
*/
|
|
14
|
-
file = await git.showFile(hash,
|
|
15
|
-
cwd
|
|
16
|
-
});
|
|
15
|
+
file = await git.showFile(hash, rootPackageJson);
|
|
17
16
|
} catch (error) {
|
|
18
|
-
const errorMessage = `File by hash "${hash}" and path "${
|
|
17
|
+
const errorMessage = `File by hash "${hash}" and path "${rootPackageJson}" does not exist`;
|
|
19
18
|
debug(errorMessage, {
|
|
20
19
|
error
|
|
21
20
|
});
|
|
@@ -31,22 +30,20 @@ export async function getWorkspacePackageJsonPaths(hash, cwd) {
|
|
|
31
30
|
}
|
|
32
31
|
const workspaces = rootPackageJsonFile.workspaces;
|
|
33
32
|
if (!workspaces) {
|
|
34
|
-
return new Set([
|
|
33
|
+
return new Set([rootPackageJson]);
|
|
35
34
|
}
|
|
36
35
|
// There are actually two formats for workspaces and they are poorly documented
|
|
37
36
|
const workspacePackages = Array.isArray(workspaces) ? workspaces : workspaces.packages;
|
|
38
|
-
return new Set([
|
|
37
|
+
return new Set([rootPackageJson, ...workspacePackages.map(glob => path.join(glob, 'package.json'))]);
|
|
39
38
|
}
|
|
40
|
-
export async function getWorkspacePaths(ref, workspaceGlobs
|
|
39
|
+
export async function getWorkspacePaths(ref, workspaceGlobs) {
|
|
41
40
|
if (workspaceGlobs.size === 0) {
|
|
42
41
|
return [];
|
|
43
42
|
}
|
|
44
|
-
const workspacePackageJsons = await git.getFiles(ref, '**/package.json'
|
|
45
|
-
cwd
|
|
46
|
-
});
|
|
43
|
+
const workspacePackageJsons = await git.getFiles(ref, '**/package.json');
|
|
47
44
|
const matchedWorkspaces = micromatch(workspacePackageJsons, [...workspaceGlobs]);
|
|
48
45
|
if (matchedWorkspaces.length === 0) {
|
|
49
|
-
throw new Error(`Could not find any workspace or package.json under "${cwd}" for "${ref}" tag`);
|
|
46
|
+
throw new Error(`Could not find any workspace or package.json under "${process.cwd()}" for "${ref}" tag`);
|
|
50
47
|
}
|
|
51
48
|
return matchedWorkspaces;
|
|
52
49
|
}
|
|
@@ -25,11 +25,16 @@ var debug = debugModule('atlaskit:dependency');
|
|
|
25
25
|
* Stores the state of atlaskit dependencies in a repository
|
|
26
26
|
*/
|
|
27
27
|
export var DependencyStore = /*#__PURE__*/function () {
|
|
28
|
-
function DependencyStore() {
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
function DependencyStore(_ref) {
|
|
29
|
+
var subWorkDir = _ref.subWorkDir,
|
|
30
|
+
supportedScopes = _ref.supportedScopes,
|
|
31
|
+
supportedPackages = _ref.supportedPackages;
|
|
32
32
|
_classCallCheck(this, DependencyStore);
|
|
33
|
+
/**
|
|
34
|
+
* We may want to work not in root, but in specific directory
|
|
35
|
+
* The reason is - some repositories have their package.json not in root
|
|
36
|
+
* For example "confluence-frontend" repo has package.json at "confluence-frontend/confluence/package.json"
|
|
37
|
+
*/
|
|
33
38
|
/** Mapping of dependency names to arrays of unique dependency type + versions */
|
|
34
39
|
_defineProperty(this, "dependencies", {});
|
|
35
40
|
/** Mapping of workspaces to their dependency map. Each dependency in their map links to an entry in `dependencies` */
|
|
@@ -37,7 +42,7 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
37
42
|
/** Set of workspace paths to their "package.json". Used to verify that a package.json is a valid workspace */
|
|
38
43
|
_defineProperty(this, "workspacePackageJsonPaths", new Set());
|
|
39
44
|
_defineProperty(this, "initialised", false);
|
|
40
|
-
this.
|
|
45
|
+
this.subWorkDir = subWorkDir;
|
|
41
46
|
this.supportedScopes = supportedScopes;
|
|
42
47
|
this.supportedPackages = supportedPackages;
|
|
43
48
|
}
|
|
@@ -97,7 +102,7 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
97
102
|
break;
|
|
98
103
|
}
|
|
99
104
|
_context2.next = 8;
|
|
100
|
-
return getWorkspacePackageJsonPaths(hash, this.
|
|
105
|
+
return getWorkspacePackageJsonPaths(hash, this.subWorkDir);
|
|
101
106
|
case 8:
|
|
102
107
|
workspacePackageJsonPaths = _context2.sent;
|
|
103
108
|
workspacePackageJsonPathsChanged = workspacePackageJsonPaths !== null && (this.workspacePackageJsonPaths.size !== workspacePackageJsonPaths.size || _toConsumableArray(this.workspacePackageJsonPaths).some(function (glob) {
|
|
@@ -184,14 +189,14 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
184
189
|
}, {
|
|
185
190
|
key: "getFlattenedDeps",
|
|
186
191
|
value: function getFlattenedDeps() {
|
|
187
|
-
var deps = Object.entries(this.dependencies).filter(function (
|
|
188
|
-
var
|
|
189
|
-
versions =
|
|
192
|
+
var deps = Object.entries(this.dependencies).filter(function (_ref2) {
|
|
193
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
194
|
+
versions = _ref3[1];
|
|
190
195
|
return versions.length > 0;
|
|
191
|
-
}).map(function (
|
|
192
|
-
var
|
|
193
|
-
depName =
|
|
194
|
-
versions =
|
|
196
|
+
}).map(function (_ref4) {
|
|
197
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
198
|
+
depName = _ref5[0],
|
|
199
|
+
versions = _ref5[1];
|
|
195
200
|
return [depName, DependencyStore.getMinimumVersion(versions, depName)];
|
|
196
201
|
});
|
|
197
202
|
return Object.fromEntries(deps);
|
|
@@ -216,14 +221,14 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
216
221
|
this.dependencies = {};
|
|
217
222
|
this.workspaces = {};
|
|
218
223
|
_context3.next = 4;
|
|
219
|
-
return getWorkspacePackageJsonPaths(hash, this.
|
|
224
|
+
return getWorkspacePackageJsonPaths(hash, this.subWorkDir);
|
|
220
225
|
case 4:
|
|
221
226
|
workspaceGlobs = _context3.sent;
|
|
222
227
|
if (workspaceGlobs !== null) {
|
|
223
228
|
this.workspacePackageJsonPaths = workspaceGlobs;
|
|
224
229
|
}
|
|
225
230
|
_context3.next = 8;
|
|
226
|
-
return getWorkspacePaths(hash, this.workspacePackageJsonPaths
|
|
231
|
+
return getWorkspacePaths(hash, this.workspacePackageJsonPaths);
|
|
227
232
|
case 8:
|
|
228
233
|
workspacePaths = _context3.sent;
|
|
229
234
|
debug("Workspace paths: ".concat(workspacePaths));
|
|
@@ -288,9 +293,7 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
288
293
|
case 0:
|
|
289
294
|
_context4.prev = 0;
|
|
290
295
|
_context4.next = 3;
|
|
291
|
-
return showFile(hash, workspacePath
|
|
292
|
-
cwd: this.cwd
|
|
293
|
-
});
|
|
296
|
+
return showFile(hash, workspacePath);
|
|
294
297
|
case 3:
|
|
295
298
|
file = _context4.sent;
|
|
296
299
|
_context4.next = 10;
|
|
@@ -408,10 +411,10 @@ export var DependencyStore = /*#__PURE__*/function () {
|
|
|
408
411
|
key: "getSupportedDependencies",
|
|
409
412
|
value: function getSupportedDependencies(depMap, dependencyType) {
|
|
410
413
|
var _this = this;
|
|
411
|
-
return Object.entries(depMap).reduce(function (supportedDependencies,
|
|
412
|
-
var
|
|
413
|
-
rawPackageName =
|
|
414
|
-
packageVersion =
|
|
414
|
+
return Object.entries(depMap).reduce(function (supportedDependencies, _ref6) {
|
|
415
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
416
|
+
rawPackageName = _ref7[0],
|
|
417
|
+
packageVersion = _ref7[1];
|
|
415
418
|
// Ignore suffixed `--next` deps in jira used for independent upgrades
|
|
416
419
|
if (rawPackageName.endsWith('--next')) {
|
|
417
420
|
return supportedDependencies;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
8
|
import { DEFAULT_TAG } from '../../constants';
|
|
6
9
|
import chalk from 'chalk';
|
|
7
10
|
import { createUpgradeEvent, sendAnalytics } from '../../util/analytics';
|
|
@@ -57,33 +60,35 @@ var getUpgradeEventsFromPkgChange = function getUpgradeEventsFromPkgChange(oldDe
|
|
|
57
60
|
return [].concat(_toConsumableArray(addOrUpgradeEvents), _toConsumableArray(removeEvents));
|
|
58
61
|
};
|
|
59
62
|
var getEventsFromHistory = /*#__PURE__*/function () {
|
|
60
|
-
var
|
|
61
|
-
var
|
|
63
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(packageChangesLog, prevRunHash, directoryOptions, supportedScopes, supportedPackages) {
|
|
64
|
+
var allPackageChanges, allUpgradeEvents, dependencyStore, dependencies, i, item, newDependencies, packageChange, upgradeEvents;
|
|
62
65
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
63
66
|
while (1) switch (_context.prev = _context.next) {
|
|
64
67
|
case 0:
|
|
65
|
-
cwd = _ref8.cwd;
|
|
66
68
|
allPackageChanges = [];
|
|
67
69
|
allUpgradeEvents = [];
|
|
68
70
|
assert(packageChangesLog.all.length > 0, '');
|
|
69
|
-
dependencyStore = new DependencyStore(
|
|
70
|
-
|
|
71
|
+
dependencyStore = new DependencyStore(_objectSpread(_objectSpread({}, directoryOptions), {}, {
|
|
72
|
+
supportedScopes: supportedScopes,
|
|
73
|
+
supportedPackages: supportedPackages
|
|
74
|
+
}));
|
|
75
|
+
_context.next = 6;
|
|
71
76
|
return dependencyStore.initialise(prevRunHash);
|
|
72
|
-
case
|
|
77
|
+
case 6:
|
|
73
78
|
dependencies = _context.sent;
|
|
74
79
|
i = 0;
|
|
75
|
-
case
|
|
80
|
+
case 8:
|
|
76
81
|
if (!(i < packageChangesLog.all.length)) {
|
|
77
|
-
_context.next =
|
|
82
|
+
_context.next = 20;
|
|
78
83
|
break;
|
|
79
84
|
}
|
|
80
85
|
item = packageChangesLog.all[i];
|
|
81
86
|
if (allPackageChanges.length > 0) {
|
|
82
87
|
dependencies = allPackageChanges[allPackageChanges.length - 1].deps;
|
|
83
88
|
}
|
|
84
|
-
_context.next =
|
|
89
|
+
_context.next = 13;
|
|
85
90
|
return dependencyStore.update(item);
|
|
86
|
-
case
|
|
91
|
+
case 13:
|
|
87
92
|
newDependencies = _context.sent;
|
|
88
93
|
packageChange = {
|
|
89
94
|
date: new Date(item.date).toISOString(),
|
|
@@ -97,23 +102,23 @@ var getEventsFromHistory = /*#__PURE__*/function () {
|
|
|
97
102
|
allUpgradeEvents.push.apply(allUpgradeEvents, _toConsumableArray(upgradeEvents));
|
|
98
103
|
allPackageChanges.push(packageChange);
|
|
99
104
|
}
|
|
100
|
-
case
|
|
105
|
+
case 17:
|
|
101
106
|
i++;
|
|
102
|
-
_context.next =
|
|
107
|
+
_context.next = 8;
|
|
103
108
|
break;
|
|
104
|
-
case
|
|
109
|
+
case 20:
|
|
105
110
|
return _context.abrupt("return", {
|
|
106
111
|
allPackageChanges: allPackageChanges,
|
|
107
112
|
allUpgradeEvents: allUpgradeEvents
|
|
108
113
|
});
|
|
109
|
-
case
|
|
114
|
+
case 21:
|
|
110
115
|
case "end":
|
|
111
116
|
return _context.stop();
|
|
112
117
|
}
|
|
113
118
|
}, _callee);
|
|
114
119
|
}));
|
|
115
120
|
return function getEventsFromHistory(_x, _x2, _x3, _x4, _x5) {
|
|
116
|
-
return
|
|
121
|
+
return _ref8.apply(this, arguments);
|
|
117
122
|
};
|
|
118
123
|
}();
|
|
119
124
|
function getSinceRef(_x6) {
|
|
@@ -164,22 +169,18 @@ function _getSinceRef() {
|
|
|
164
169
|
}));
|
|
165
170
|
return _getSinceRef.apply(this, arguments);
|
|
166
171
|
}
|
|
167
|
-
var getWorkDir = function getWorkDir(cwd) {
|
|
168
|
-
var workDir = cwd !== null && cwd !== void 0 ? cwd : process.cwd();
|
|
169
|
-
// Make sure that we're working in needed directory
|
|
170
|
-
process.chdir(workDir);
|
|
171
|
-
return workDir;
|
|
172
|
-
};
|
|
173
172
|
export default function populateProduct(_x7) {
|
|
174
173
|
return _populateProduct.apply(this, arguments);
|
|
175
174
|
}
|
|
176
175
|
function _populateProduct() {
|
|
177
176
|
_populateProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(flags) {
|
|
178
|
-
var
|
|
177
|
+
var sinceRef, log, supportedScopes, supportedPackages, _yield$getEventsFromH, allPackageChanges, allUpgradeEvents, csv, currentCommit;
|
|
179
178
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
180
179
|
while (1) switch (_context3.prev = _context3.next) {
|
|
181
180
|
case 0:
|
|
182
|
-
|
|
181
|
+
if (flags.cwd) {
|
|
182
|
+
process.chdir(flags.cwd);
|
|
183
|
+
}
|
|
183
184
|
if (!flags.reset) {
|
|
184
185
|
_context3.next = 5;
|
|
185
186
|
break;
|
|
@@ -210,7 +211,7 @@ function _populateProduct() {
|
|
|
210
211
|
case 18:
|
|
211
212
|
_context3.next = 20;
|
|
212
213
|
return getEventsFromHistory(log, sinceRef, {
|
|
213
|
-
|
|
214
|
+
subWorkDir: flags.subWorkDir
|
|
214
215
|
}, supportedScopes, supportedPackages);
|
|
215
216
|
case 20:
|
|
216
217
|
_yield$getEventsFromH = _context3.sent;
|
|
@@ -66,7 +66,7 @@ export function createUpgradeEvent(name, version, previousVersion, date) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
return _objectSpread({
|
|
69
|
-
cliVersion: "1.
|
|
69
|
+
cliVersion: "1.6.0",
|
|
70
70
|
dependencyName: name,
|
|
71
71
|
versionString: eventVersion,
|
|
72
72
|
major: parsedVersion ? "".concat(parsedVersion.major) : null,
|
package/dist/esm/util/yarn.js
CHANGED
|
@@ -10,65 +10,64 @@ export function getWorkspacePackageJsonPaths(_x, _x2) {
|
|
|
10
10
|
return _getWorkspacePackageJsonPaths.apply(this, arguments);
|
|
11
11
|
}
|
|
12
12
|
function _getWorkspacePackageJsonPaths() {
|
|
13
|
-
_getWorkspacePackageJsonPaths = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(hash,
|
|
14
|
-
var file, errorMessage, rootPackageJsonFile, workspaces, workspacePackages;
|
|
13
|
+
_getWorkspacePackageJsonPaths = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(hash, subWorkDir) {
|
|
14
|
+
var file, rootPackageJson, errorMessage, rootPackageJsonFile, workspaces, workspacePackages;
|
|
15
15
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
16
16
|
while (1) switch (_context.prev = _context.next) {
|
|
17
17
|
case 0:
|
|
18
|
-
|
|
19
|
-
_context.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case 3:
|
|
18
|
+
rootPackageJson = "".concat(subWorkDir ? "".concat(subWorkDir, "/") : '', "package.json");
|
|
19
|
+
_context.prev = 1;
|
|
20
|
+
_context.next = 4;
|
|
21
|
+
return git.showFile(hash, rootPackageJson);
|
|
22
|
+
case 4:
|
|
24
23
|
file = _context.sent;
|
|
25
|
-
_context.next =
|
|
24
|
+
_context.next = 13;
|
|
26
25
|
break;
|
|
27
|
-
case
|
|
28
|
-
_context.prev =
|
|
29
|
-
_context.t0 = _context["catch"](
|
|
30
|
-
errorMessage = "File by hash \"".concat(hash, "\" and path \"").concat(
|
|
26
|
+
case 7:
|
|
27
|
+
_context.prev = 7;
|
|
28
|
+
_context.t0 = _context["catch"](1);
|
|
29
|
+
errorMessage = "File by hash \"".concat(hash, "\" and path \"").concat(rootPackageJson, "\" does not exist");
|
|
31
30
|
debug(errorMessage, {
|
|
32
31
|
error: _context.t0
|
|
33
32
|
});
|
|
34
33
|
console.error(errorMessage, _context.t0);
|
|
35
34
|
return _context.abrupt("return", new Set([]));
|
|
36
|
-
case
|
|
37
|
-
_context.prev =
|
|
35
|
+
case 13:
|
|
36
|
+
_context.prev = 13;
|
|
38
37
|
rootPackageJsonFile = JSON.parse(file);
|
|
39
|
-
_context.next =
|
|
38
|
+
_context.next = 21;
|
|
40
39
|
break;
|
|
41
|
-
case
|
|
42
|
-
_context.prev =
|
|
43
|
-
_context.t1 = _context["catch"](
|
|
40
|
+
case 17:
|
|
41
|
+
_context.prev = 17;
|
|
42
|
+
_context.t1 = _context["catch"](13);
|
|
44
43
|
console.error("Error parsing ".concat(file, "@").concat(hash, ": ").concat(_context.t1));
|
|
45
44
|
return _context.abrupt("return", null);
|
|
46
|
-
case
|
|
45
|
+
case 21:
|
|
47
46
|
workspaces = rootPackageJsonFile.workspaces;
|
|
48
47
|
if (workspaces) {
|
|
49
|
-
_context.next =
|
|
48
|
+
_context.next = 24;
|
|
50
49
|
break;
|
|
51
50
|
}
|
|
52
|
-
return _context.abrupt("return", new Set([
|
|
53
|
-
case
|
|
51
|
+
return _context.abrupt("return", new Set([rootPackageJson]));
|
|
52
|
+
case 24:
|
|
54
53
|
// There are actually two formats for workspaces and they are poorly documented
|
|
55
54
|
workspacePackages = Array.isArray(workspaces) ? workspaces : workspaces.packages;
|
|
56
|
-
return _context.abrupt("return", new Set([
|
|
55
|
+
return _context.abrupt("return", new Set([rootPackageJson].concat(_toConsumableArray(workspacePackages.map(function (glob) {
|
|
57
56
|
return path.join(glob, 'package.json');
|
|
58
57
|
})))));
|
|
59
|
-
case
|
|
58
|
+
case 26:
|
|
60
59
|
case "end":
|
|
61
60
|
return _context.stop();
|
|
62
61
|
}
|
|
63
|
-
}, _callee, null, [[
|
|
62
|
+
}, _callee, null, [[1, 7], [13, 17]]);
|
|
64
63
|
}));
|
|
65
64
|
return _getWorkspacePackageJsonPaths.apply(this, arguments);
|
|
66
65
|
}
|
|
67
|
-
export function getWorkspacePaths(_x3, _x4
|
|
66
|
+
export function getWorkspacePaths(_x3, _x4) {
|
|
68
67
|
return _getWorkspacePaths.apply(this, arguments);
|
|
69
68
|
}
|
|
70
69
|
function _getWorkspacePaths() {
|
|
71
|
-
_getWorkspacePaths = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(ref, workspaceGlobs
|
|
70
|
+
_getWorkspacePaths = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(ref, workspaceGlobs) {
|
|
72
71
|
var workspacePackageJsons, matchedWorkspaces;
|
|
73
72
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
74
73
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -80,9 +79,7 @@ function _getWorkspacePaths() {
|
|
|
80
79
|
return _context2.abrupt("return", []);
|
|
81
80
|
case 2:
|
|
82
81
|
_context2.next = 4;
|
|
83
|
-
return git.getFiles(ref, '**/package.json'
|
|
84
|
-
cwd: cwd
|
|
85
|
-
});
|
|
82
|
+
return git.getFiles(ref, '**/package.json');
|
|
86
83
|
case 4:
|
|
87
84
|
workspacePackageJsons = _context2.sent;
|
|
88
85
|
matchedWorkspaces = micromatch(workspacePackageJsons, _toConsumableArray(workspaceGlobs));
|
|
@@ -90,7 +87,7 @@ function _getWorkspacePaths() {
|
|
|
90
87
|
_context2.next = 8;
|
|
91
88
|
break;
|
|
92
89
|
}
|
|
93
|
-
throw new Error("Could not find any workspace or package.json under \"".concat(cwd, "\" for \"").concat(ref, "\" tag"));
|
|
90
|
+
throw new Error("Could not find any workspace or package.json under \"".concat(process.cwd(), "\" for \"").concat(ref, "\" tag"));
|
|
94
91
|
case 8:
|
|
95
92
|
return _context2.abrupt("return", matchedWorkspaces);
|
|
96
93
|
case 9:
|
|
@@ -5,7 +5,12 @@ import type { DefaultLogFields, ListLogLine } from 'simple-git';
|
|
|
5
5
|
* Stores the state of atlaskit dependencies in a repository
|
|
6
6
|
*/
|
|
7
7
|
export declare class DependencyStore {
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* We may want to work not in root, but in specific directory
|
|
10
|
+
* The reason is - some repositories have their package.json not in root
|
|
11
|
+
* For example "confluence-frontend" repo has package.json at "confluence-frontend/confluence/package.json"
|
|
12
|
+
*/
|
|
13
|
+
private subWorkDir?;
|
|
9
14
|
/** Mapping of dependency names to arrays of unique dependency type + versions */
|
|
10
15
|
private dependencies;
|
|
11
16
|
/** Mapping of workspaces to their dependency map. Each dependency in their map links to an entry in `dependencies` */
|
|
@@ -15,7 +20,11 @@ export declare class DependencyStore {
|
|
|
15
20
|
private initialised;
|
|
16
21
|
private supportedScopes;
|
|
17
22
|
private supportedPackages;
|
|
18
|
-
constructor(
|
|
23
|
+
constructor({ subWorkDir, supportedScopes, supportedPackages, }: {
|
|
24
|
+
subWorkDir?: string;
|
|
25
|
+
supportedScopes: string[];
|
|
26
|
+
supportedPackages: string[];
|
|
27
|
+
});
|
|
19
28
|
/** Scans the repo for dependencies at the specified git ref and return the flattened dependency map */
|
|
20
29
|
initialise(gitRef?: string): Promise<DependencyMap>;
|
|
21
30
|
/** Updates the repo dependency store based on the changes in `logItem`.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getWorkspacePackageJsonPaths(hash: string,
|
|
2
|
-
export declare function getWorkspacePaths(ref: string, workspaceGlobs: Set<string
|
|
1
|
+
export declare function getWorkspacePackageJsonPaths(hash: string, subWorkDir?: string): Promise<Set<string> | null>;
|
|
2
|
+
export declare function getWorkspacePaths(ref: string, workspaceGlobs: Set<string>): Promise<string[]>;
|
|
@@ -5,7 +5,12 @@ import type { DefaultLogFields, ListLogLine } from 'simple-git';
|
|
|
5
5
|
* Stores the state of atlaskit dependencies in a repository
|
|
6
6
|
*/
|
|
7
7
|
export declare class DependencyStore {
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* We may want to work not in root, but in specific directory
|
|
10
|
+
* The reason is - some repositories have their package.json not in root
|
|
11
|
+
* For example "confluence-frontend" repo has package.json at "confluence-frontend/confluence/package.json"
|
|
12
|
+
*/
|
|
13
|
+
private subWorkDir?;
|
|
9
14
|
/** Mapping of dependency names to arrays of unique dependency type + versions */
|
|
10
15
|
private dependencies;
|
|
11
16
|
/** Mapping of workspaces to their dependency map. Each dependency in their map links to an entry in `dependencies` */
|
|
@@ -15,7 +20,11 @@ export declare class DependencyStore {
|
|
|
15
20
|
private initialised;
|
|
16
21
|
private supportedScopes;
|
|
17
22
|
private supportedPackages;
|
|
18
|
-
constructor(
|
|
23
|
+
constructor({ subWorkDir, supportedScopes, supportedPackages, }: {
|
|
24
|
+
subWorkDir?: string;
|
|
25
|
+
supportedScopes: string[];
|
|
26
|
+
supportedPackages: string[];
|
|
27
|
+
});
|
|
19
28
|
/** Scans the repo for dependencies at the specified git ref and return the flattened dependency map */
|
|
20
29
|
initialise(gitRef?: string): Promise<DependencyMap>;
|
|
21
30
|
/** Updates the repo dependency store based on the changes in `logItem`.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getWorkspacePackageJsonPaths(hash: string,
|
|
2
|
-
export declare function getWorkspacePaths(ref: string, workspaceGlobs: Set<string
|
|
1
|
+
export declare function getWorkspacePackageJsonPaths(hash: string, subWorkDir?: string): Promise<Set<string> | null>;
|
|
2
|
+
export declare function getWorkspacePaths(ref: string, workspaceGlobs: Set<string>): Promise<string[]>;
|
package/package.json
CHANGED
package/report.api.md
CHANGED