@toptal/davinci-monorepo 8.5.2-alpha-fx-5898-fix-metrics-issue-bf194466.12 → 8.5.2
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
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @toptal/davinci-monorepo
|
|
2
2
|
|
|
3
|
+
## 8.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2475](https://github.com/toptal/davinci/pull/2475) [`7d8e3041`](https://github.com/toptal/davinci/commit/7d8e3041dc38fdaf2ab3996375d301472535c878) Thanks [@dmaklygin](https://github.com/dmaklygin)!
|
|
8
|
+
- fix monorepo metrics command
|
|
9
|
+
|
|
3
10
|
## 8.5.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-monorepo",
|
|
3
|
-
"version": "8.5.2
|
|
3
|
+
"version": "8.5.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"lint"
|
|
6
6
|
],
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@nodelib/fs.walk": "^1.2.6",
|
|
29
29
|
"@oclif/core": "^1.16.1",
|
|
30
|
-
"@toptal/davinci-cli-shared": "2.5.
|
|
30
|
+
"@toptal/davinci-cli-shared": "^2.5.0",
|
|
31
31
|
"chalk": "^4.1.2",
|
|
32
32
|
"codeowners": "5.1.1",
|
|
33
33
|
"dependency-cruiser": "^16.3.0",
|
|
@@ -49,6 +49,5 @@
|
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
|
-
}
|
|
53
|
-
"gitHead": "bf1944664ac1673c7a55917fb929b55182895cf9"
|
|
52
|
+
}
|
|
54
53
|
}
|
|
@@ -13,14 +13,10 @@ export const createGetLernaGraph =
|
|
|
13
13
|
const { onlyLocalDependencies = false, excludedPackages = new Set() } =
|
|
14
14
|
options
|
|
15
15
|
|
|
16
|
-
// execute lerna command
|
|
17
16
|
childProcessLib.execSync(lernaGraphCommand)
|
|
18
|
-
// read from lerna-output.json
|
|
19
17
|
const lernaOutput = fs.readFileSync('lerna-output.json', 'utf8')
|
|
20
18
|
|
|
21
|
-
// remove lerna-output.json
|
|
22
19
|
fs.unlinkSync('lerna-output.json')
|
|
23
|
-
// parse the output
|
|
24
20
|
const packagesGraph = JSON.parse(lernaOutput)
|
|
25
21
|
|
|
26
22
|
excludedPackages.forEach(packageName => delete packagesGraph[packageName])
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jest } from '@jest/globals'
|
|
2
2
|
import childProcess from 'child_process'
|
|
3
|
+
import fs from 'fs'
|
|
3
4
|
|
|
4
5
|
import { createGetLernaGraph } from './get-lerna-graph.js'
|
|
5
6
|
|
|
@@ -11,29 +12,38 @@ const graph = {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
describe('getLernaGraph', () => {
|
|
14
|
-
let execSyncMock
|
|
15
|
+
let execSyncMock, readFileSyncMock, unlinkSync
|
|
15
16
|
|
|
16
17
|
beforeEach(() => {
|
|
17
18
|
execSyncMock = jest.spyOn(childProcess, 'execSync')
|
|
19
|
+
readFileSyncMock = jest.spyOn(fs, 'readFileSync')
|
|
20
|
+
unlinkSync = jest.spyOn(fs, 'unlinkSync')
|
|
18
21
|
})
|
|
19
22
|
|
|
20
23
|
afterEach(() => {
|
|
21
24
|
execSyncMock.mockReset()
|
|
25
|
+
readFileSyncMock.mockReset()
|
|
26
|
+
unlinkSync.mockReset()
|
|
22
27
|
})
|
|
23
28
|
|
|
24
29
|
it('executes the command', () => {
|
|
25
|
-
|
|
30
|
+
readFileSyncMock.mockReturnValue(JSON.stringify(graph))
|
|
26
31
|
|
|
27
32
|
getLernaGraph()
|
|
28
33
|
|
|
29
34
|
expect(execSyncMock).toHaveBeenCalledTimes(1)
|
|
30
35
|
expect(execSyncMock).toHaveBeenCalledWith(
|
|
31
|
-
'yarn --silent --cwd=../.. lerna list --all --toposort --graph --loglevel silent'
|
|
36
|
+
'yarn --silent --cwd=../.. lerna list --all --toposort --graph --loglevel silent > lerna-output.json'
|
|
32
37
|
)
|
|
38
|
+
expect(readFileSyncMock).toHaveBeenCalledTimes(1)
|
|
39
|
+
expect(readFileSyncMock).toHaveBeenCalledWith('lerna-output.json', 'utf8')
|
|
40
|
+
|
|
41
|
+
expect(unlinkSync).toHaveBeenCalledTimes(1)
|
|
42
|
+
expect(unlinkSync).toHaveBeenCalledWith('lerna-output.json')
|
|
33
43
|
})
|
|
34
44
|
|
|
35
45
|
it('returns a graph', () => {
|
|
36
|
-
|
|
46
|
+
readFileSyncMock.mockReturnValue(JSON.stringify(graph))
|
|
37
47
|
|
|
38
48
|
const result = getLernaGraph()
|
|
39
49
|
|
|
@@ -42,7 +52,7 @@ describe('getLernaGraph', () => {
|
|
|
42
52
|
|
|
43
53
|
describe('when onlyLocalDependencies option is true', () => {
|
|
44
54
|
it('returns graph with only internal dependencies', () => {
|
|
45
|
-
|
|
55
|
+
readFileSyncMock.mockReturnValue(JSON.stringify(graph))
|
|
46
56
|
|
|
47
57
|
const result = getLernaGraph({ onlyLocalDependencies: true })
|
|
48
58
|
|
|
@@ -52,7 +62,7 @@ describe('getLernaGraph', () => {
|
|
|
52
62
|
|
|
53
63
|
describe('when there are some excluded packages', () => {
|
|
54
64
|
it('returns graph without excluded packages', () => {
|
|
55
|
-
|
|
65
|
+
readFileSyncMock.mockReturnValue(
|
|
56
66
|
JSON.stringify({
|
|
57
67
|
package1: ['externalDependency1', 'package2'],
|
|
58
68
|
package2: [
|