Skip to content

Commit 4edb936

Browse files
authored
chore: bump davinci-syntax version to 20 (#159)
* chore: bump davinci-syntax version to 20 * chore: update eslint
1 parent 5a2eb19 commit 4edb936

File tree

13 files changed

+989
-437
lines changed

13 files changed

+989
-437
lines changed

.changeset/wet-moose-whisper.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'davinci-github-actions': patch
3+
---
4+
5+
---
6+
7+
- bump davinci-syntax version to 20

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "./node_modules/@toptal/davinci-syntax/src/configs/.eslintrc",
2+
"extends": "./node_modules/@toptal/davinci-syntax/src/configs/.eslintrc.cjs",
33
"rules": {
44
"id-length": "off",
55
"@typescript-eslint/no-non-null-assertion": "off",

.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
...require('@toptal/davinci-syntax/src/configs/.prettierrc.js')
2+
...require('@toptal/davinci-syntax/src/configs/.prettierrc.cjs')
33
}

_scripts/documentation/generate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import fs from 'fs'
22
import { remark } from 'remark'
33
import { gfmTableToMarkdown } from 'mdast-util-gfm-table'
44

5-
import { YMLConfiguration } from './types'
5+
import type { YMLConfiguration } from './types'
66
import remarkGithubActionReadme from './remark-github-action-readme'
77
import {
88
getActionContent,
99
getReadmeSourceContent,
10-
updateReadmeFile
10+
updateReadmeFile,
1111
} from './utils/files'
1212
import { getYMLConfiguration } from './utils/yaml'
1313

_scripts/documentation/remark-github-action-readme.ts

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
import { Plugin } from 'unified'
2-
import { headingRange, Node } from 'mdast-util-heading-range'
3-
import { Heading } from 'mdast'
1+
import type { Plugin } from 'unified'
2+
import type { Node } from 'mdast-util-heading-range'
3+
import { headingRange } from 'mdast-util-heading-range'
4+
import type { Heading } from 'mdast'
45
import {
56
heading,
67
inlineCode,
78
paragraph,
89
table,
910
tableCell,
1011
tableRow,
11-
text
12+
text,
1213
} from 'mdast-builder'
1314
import { fromMarkdown } from 'mdast-util-from-markdown'
1415

15-
import { YMLConfiguration } from './types'
16+
import type { YMLConfiguration } from './types'
1617
import { parseActionDescription, parseInputDescription } from './utils/yaml'
1718

1819
const buildTable = (headers: string[], rows: any[][]) => {
@@ -28,7 +29,7 @@ const buildTable = (headers: string[], rows: any[][]) => {
2829
)
2930
)
3031
)
31-
)
32+
),
3233
]
3334
)
3435
}
@@ -51,9 +52,9 @@ const injectTableToSection = (
5152
? paragraph(text('Not specified'))
5253
: paragraph([
5354
paragraph(text(options.subtitle || '')),
54-
buildTable(tableHeaders, rows)
55+
buildTable(tableHeaders, rows),
5556
]),
56-
end
57+
end,
5758
])
5859
}
5960

@@ -82,7 +83,7 @@ const remarkGithubActionReadme: Plugin<
8283
heading(2, [text(yamlContent.name)]),
8384
paragraph(fromMarkdown(description)),
8485
...filteredNodes,
85-
end
86+
end,
8687
]
8788
})
8889

@@ -96,7 +97,7 @@ const remarkGithubActionReadme: Plugin<
9697
type || 'string',
9798
input.required ? '✅' : '',
9899
input.default || '',
99-
description
100+
description,
100101
]
101102
}
102103
)
@@ -106,7 +107,7 @@ const remarkGithubActionReadme: Plugin<
106107
['name', 'type', 'required', 'default', 'description'],
107108
inputs,
108109
{
109-
subtitle: 'The list of arguments, that are used in GH Action:\n\n'
110+
subtitle: 'The list of arguments, that are used in GH Action:\n\n',
110111
}
111112
)
112113

@@ -124,19 +125,19 @@ const remarkGithubActionReadme: Plugin<
124125
['name', 'type', 'description'],
125126
outputs,
126127
{
127-
subtitle: 'The list of variables, that are returned by GH Action:\n\n'
128+
subtitle: 'The list of variables, that are returned by GH Action:\n\n',
128129
}
129130
)
130131

131132
// inject `ENV Variables` table
132133
const env = Object.keys(envInputs || {}).map(envKey => [
133134
inlineCode(envKey) as Node,
134-
envInputs![envKey]
135+
envInputs![envKey],
135136
])
136137
injectTableToSection(tree, 'ENV Variables', ['name', 'description'], env, {
137138
subtitle:
138139
'All ENV Variables, defined in a GH Workflow are also passed to a GH Action. It means, the might be reused as is.\n' +
139-
'This is a list of ENV Variables that are used in GH Action:\n\n'
140+
'This is a list of ENV Variables that are used in GH Action:\n\n',
140141
})
141142
}
142143
}

_scripts/documentation/utils/files.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ export const updateReadmeFile = (
3535
content: string
3636
) => {
3737
fs.writeFileSync(getActionReadmeFilePath(rootDir, folder), content, {
38-
encoding: 'utf8'
38+
encoding: 'utf8',
3939
})
4040
}

_scripts/documentation/utils/yaml.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import yaml from 'js-yaml'
33
import {
44
getYMLConfiguration,
55
parseActionDescription,
6-
parseInputDescription
6+
parseInputDescription,
77
} from './yaml'
8-
import { YMLConfiguration } from '../types'
8+
import type { YMLConfiguration } from '../types'
99

1010
jest.mock('js-yaml', () => ({
11-
load: jest.fn()
11+
load: jest.fn(),
1212
}))
1313

1414
const mockedLoad = yaml.load as jest.Mock<YMLConfiguration>
@@ -28,7 +28,7 @@ describe('yaml util', () => {
2828
name: '__NAME__',
2929
description: '__DESC__',
3030
inputs: {},
31-
outputs: {}
31+
outputs: {},
3232
}
3333
mockedLoad.mockReturnValueOnce(content)
3434

@@ -45,12 +45,12 @@ describe('yaml util', () => {
4545
content = {
4646
envInputs: {
4747
ENV_VARIABLE1: 'description1',
48-
ENV_VARIABLE2: 'description2'
48+
ENV_VARIABLE2: 'description2',
4949
},
5050
name: '__NAME__',
5151
description: '__DESC__',
5252
inputs: {},
53-
outputs: {}
53+
outputs: {},
5454
}
5555
mockedLoad.mockReturnValueOnce(content)
5656
})

_scripts/documentation/utils/yaml.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import yaml from 'js-yaml'
22

3-
import { YMLConfiguration } from '../types'
3+
import type { YMLConfiguration } from '../types'
44

55
export const getYMLConfiguration = (content: string): YMLConfiguration => {
66
return yaml.load(content) as YMLConfiguration
@@ -12,7 +12,7 @@ export const parseActionDescription = (information: string) => {
1212

1313
return {
1414
description,
15-
envInputs: envInputs ? envInputs.envInputs : null
15+
envInputs: envInputs ? envInputs.envInputs : null,
1616
}
1717
}
1818

@@ -21,6 +21,6 @@ export const parseInputDescription = (information: string) => {
2121

2222
return {
2323
description,
24-
type
24+
type,
2525
}
2626
}

create-matrix/dist/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2757,7 +2757,7 @@
27572757
/***/
27582758
},
27592759

2760-
/***/ 7740: /***/ (
2760+
/***/ 1585: /***/ (
27612761
module,
27622762
__unused_webpack_exports,
27632763
__nccwpck_require__
@@ -2819,7 +2819,7 @@
28192819
/***/
28202820
},
28212821

2822-
/***/ 1336: /***/ (
2822+
/***/ 1766: /***/ (
28232823
module,
28242824
__unused_webpack_exports,
28252825
__nccwpck_require__
@@ -2829,7 +2829,7 @@
28292829
const { constants: BufferConstants } = __nccwpck_require__(4300)
28302830
const stream = __nccwpck_require__(2781)
28312831
const { promisify } = __nccwpck_require__(3837)
2832-
const bufferStream = __nccwpck_require__(7740)
2832+
const bufferStream = __nccwpck_require__(1585)
28332833

28342834
const streamPipelinePromisified = promisify(stream.pipeline)
28352835

@@ -5574,8 +5574,8 @@
55745574
return isDuplexStream(stream) && typeof stream._transform === 'function'
55755575
}
55765576

5577-
// EXTERNAL MODULE: ./node_modules/execa/node_modules/get-stream/index.js
5578-
var get_stream = __nccwpck_require__(1336)
5577+
// EXTERNAL MODULE: ./node_modules/get-stream/index.js
5578+
var get_stream = __nccwpck_require__(1766)
55795579
// EXTERNAL MODULE: ./node_modules/merge-stream/index.js
55805580
var merge_stream = __nccwpck_require__(2621) // CONCATENATED MODULE: ./node_modules/execa/lib/stream.js
55815581
// `input` option

create-matrix/index.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ const execa = require('execa').execa
44
const getWorkspaces = async () => {
55
const { exitCode, stdout } = await execa(
66
'yarn',
7-
[
8-
'workspaces',
9-
'--no-default-rc',
10-
'info'
11-
],
7+
['workspaces', '--no-default-rc', 'info'],
128
{
139
reject: false,
1410
}
@@ -35,7 +31,9 @@ const run = async () => {
3531

3632
core.setOutput('is-monorepo', isMonorepo)
3733

38-
let groups = workspaces ? Object.entries(workspaces) : [['default', { location: '.' }]]
34+
let groups = workspaces
35+
? Object.entries(workspaces)
36+
: [['default', { location: '.' }]]
3937

4038
// custom matrix
4139
if (parallelMatrixInput) {
@@ -47,7 +45,7 @@ const run = async () => {
4745

4846
groups = parallelMatrix.map(({ pkg, location, parallelGroups }) => [
4947
pkg,
50-
{ location, parallelGroups }
48+
{ location, parallelGroups },
5149
])
5250
}
5351

@@ -56,20 +54,23 @@ const run = async () => {
5654
const matrix = groups.reduce((acc, [pkg, { location, parallelGroups }]) => {
5755
const groupsTotal = parallelGroups || parallelGroupsInput
5856

59-
Array(groupsTotal).fill().forEach((_, index) => acc.push({
60-
pkg,
61-
location,
62-
index,
63-
total: groupsTotal,
64-
}))
57+
Array(groupsTotal)
58+
.fill()
59+
.forEach((_, index) =>
60+
acc.push({
61+
pkg,
62+
location,
63+
index,
64+
total: groupsTotal,
65+
})
66+
)
6567

6668
return acc
6769
}, [])
6870

6971
core.setOutput('matrix', matrix)
7072

7173
console.log('Done.')
72-
7374
} catch (error) {
7475
core.setFailed(error.message)
7576
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"@actions/core": "^1.10.0",
2020
"@actions/github": "^5.1.1",
2121
"@changesets/changelog-github": "^0.4.8",
22-
"@changesets/get-github-info": "^0.5.2",
2322
"@changesets/cli": "^2.26.0",
23+
"@changesets/get-github-info": "^0.5.2",
2424
"@changesets/get-release-plan": "^3.0.16",
2525
"@changesets/git": "^1.5.0",
2626
"@toptal/browserslist-config": "^1.2.0",
2727
"@toptal/davinci-qa": "^12.1.0",
28-
"@toptal/davinci-syntax": "^16.2.0",
28+
"@toptal/davinci-syntax": "^20.0.6",
2929
"@types/js-yaml": "^4.0.5",
3030
"@types/marked": "^4.0.3",
3131
"@types/node": "^17.0.34",

report-affected-packages/diagram.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const dependents = {}
2323
*/
2424
const changedPackages = changedFiles
2525
.map(file => {
26-
for (let packageName in info) {
26+
for (const packageName in info) {
2727
if (file.startsWith(info[packageName].location)) {
2828
return packageName
2929
}
@@ -38,10 +38,10 @@ const highlights = [...new Set(changedPackages)]
3838
/**
3939
* Reverse the dependency tree from the info file for easy access to the dependent packages.
4040
*/
41-
for (let packageName in info) {
41+
for (const packageName in info) {
4242
const package = info[packageName]
4343

44-
for (let dependency of package.workspaceDependencies) {
44+
for (const dependency of package.workspaceDependencies) {
4545
dependents[dependency] = dependents[dependency] || []
4646
dependents[dependency].push(packageName)
4747
}
@@ -50,7 +50,7 @@ for (let packageName in info) {
5050
/**
5151
* Compile a list of packages directly or indirectly depending on the modified packages
5252
*/
53-
function getDependents(packageName, ancestors = []) {
53+
const getDependents = (packageName, ancestors = []) => {
5454
const list = dependents[packageName] || []
5555

5656
// Detect a cycle and bail
@@ -60,15 +60,19 @@ function getDependents(packageName, ancestors = []) {
6060

6161
return [
6262
...list,
63-
...list.map(dependentName => getDependents(dependentName, [...ancestors, packageName])).flat()
63+
...list
64+
.map(dependentName =>
65+
getDependents(dependentName, [...ancestors, packageName])
66+
)
67+
.flat(),
6468
]
6569
}
6670

6771
const includeList = [
6872
...new Set([
6973
...highlights,
70-
...highlights.map(packageName => getDependents(packageName)).flat()
71-
])
74+
...highlights.map(packageName => getDependents(packageName)).flat(),
75+
]),
7276
]
7377

7478
/**
@@ -114,14 +118,14 @@ const assignNode = (node, paths, content) => {
114118
assignNode(node.nodes[step], rest, content)
115119
}
116120

117-
for (let package of packages) {
121+
for (const package of packages) {
118122
if (isIncluded(package)) {
119123
const paths = getGroup(package)
120124
const color = highlights.includes(package) ? ':::highlighted' : ''
121125
assignNode(root, paths, ` ${getId(package)}["${package}"]${color}`)
122126
}
123127

124-
for (let dependency of info[package].workspaceDependencies) {
128+
for (const dependency of info[package].workspaceDependencies) {
125129
if (!isIncluded(dependency)) {
126130
continue
127131
}

0 commit comments

Comments
 (0)