@toptal/davinci-monorepo 8.5.2-alpha-fx-5804-prohibit-customization-of-davinci-graphql-codegen-tool-b6fc3f7c.33 → 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": "b6fc3f7ce0ed642d1004ea9a5daa8a0a2d411564"
|
|
52
|
+
}
|
|
54
53
|
}
|
package/src/commands/metrics.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import childProcessLib from 'child_process'
|
|
2
|
+
import fs from 'fs'
|
|
2
3
|
|
|
3
4
|
const lernaGraphCommand =
|
|
4
|
-
'yarn --silent --cwd=../.. lerna list --all --toposort --graph --loglevel silent'
|
|
5
|
+
'yarn --silent --cwd=../.. lerna list --all --toposort --graph --loglevel silent > lerna-output.json'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Generates and returns a graph of monorepo packages
|
|
8
9
|
*/
|
|
9
10
|
export const createGetLernaGraph =
|
|
10
|
-
|
|
11
|
+
() =>
|
|
11
12
|
(options = {}) => {
|
|
12
13
|
const { onlyLocalDependencies = false, excludedPackages = new Set() } =
|
|
13
14
|
options
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
const
|
|
16
|
+
childProcessLib.execSync(lernaGraphCommand)
|
|
17
|
+
const lernaOutput = fs.readFileSync('lerna-output.json', 'utf8')
|
|
18
|
+
|
|
19
|
+
fs.unlinkSync('lerna-output.json')
|
|
20
|
+
const packagesGraph = JSON.parse(lernaOutput)
|
|
17
21
|
|
|
18
22
|
excludedPackages.forEach(packageName => delete packagesGraph[packageName])
|
|
19
23
|
|
|
@@ -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: [
|