@toptal/davinci-ci 4.0.9-alpha-CRT-5891-create-coverage-command-3e3ae146.46 → 4.0.9-alpha-chore-standardize-command-syntax-for-consistency-5feafaf6.44
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/bin/davinci-ci.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cliEngine from '@toptal/davinci-cli-shared'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { createDangerCommand } from '../src/commands/danger.js'
|
|
5
5
|
|
|
6
|
-
cliEngine.loadCommands([
|
|
6
|
+
cliEngine.loadCommands([createDangerCommand], 'davinci-ci')
|
|
7
7
|
cliEngine.bootstrap()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-ci",
|
|
3
|
-
"version": "4.0.9-alpha-
|
|
3
|
+
"version": "4.0.9-alpha-chore-standardize-command-syntax-for-consistency-5feafaf6.44+5feafaf6",
|
|
4
4
|
"description": "Continuos integrations tools for frontend projects",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@commitlint/cli": "^17.4.0",
|
|
40
40
|
"@commitlint/config-conventional": "^17.1.0",
|
|
41
|
-
"@toptal/davinci-cli-shared": "2.3.1-alpha-
|
|
41
|
+
"@toptal/davinci-cli-shared": "2.3.1-alpha-chore-standardize-command-syntax-for-consistency-5feafaf6.44+5feafaf6",
|
|
42
42
|
"danger": "^11.2.2",
|
|
43
43
|
"markdown-table": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^29.4.2"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "5feafaf623abc6ee68d727143d0ed1f387b79da1"
|
|
49
49
|
}
|
|
@@ -1,24 +1,84 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
4
|
-
{
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"description": "Run danger check",
|
|
3
|
+
exports[`createDangerCommand creates a command with the correct parameters 1`] = `
|
|
4
|
+
"{
|
|
5
|
+
"_events": {},
|
|
6
|
+
"_eventsCount": 3,
|
|
7
|
+
"commands": [],
|
|
9
8
|
"options": [
|
|
10
9
|
{
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"flags": "--check",
|
|
11
|
+
"description": "check only, without fixing the code",
|
|
12
|
+
"required": false,
|
|
13
|
+
"optional": false,
|
|
14
|
+
"variadic": false,
|
|
15
|
+
"mandatory": false,
|
|
16
|
+
"long": "--check",
|
|
17
|
+
"negate": false,
|
|
18
|
+
"hidden": false,
|
|
19
|
+
"conflictsWith": []
|
|
13
20
|
},
|
|
14
21
|
{
|
|
15
|
-
"
|
|
16
|
-
"
|
|
22
|
+
"flags": "--local",
|
|
23
|
+
"description": "checks commit message quality locally",
|
|
24
|
+
"required": false,
|
|
25
|
+
"optional": false,
|
|
26
|
+
"variadic": false,
|
|
27
|
+
"mandatory": false,
|
|
28
|
+
"long": "--local",
|
|
29
|
+
"negate": false,
|
|
30
|
+
"hidden": false,
|
|
31
|
+
"conflictsWith": []
|
|
17
32
|
},
|
|
18
33
|
{
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
34
|
+
"flags": "--dangerfile <dangerfile>",
|
|
35
|
+
"description": "specify custom danger file",
|
|
36
|
+
"required": true,
|
|
37
|
+
"optional": false,
|
|
38
|
+
"variadic": false,
|
|
39
|
+
"mandatory": false,
|
|
40
|
+
"long": "--dangerfile",
|
|
41
|
+
"negate": false,
|
|
42
|
+
"hidden": false,
|
|
43
|
+
"conflictsWith": []
|
|
44
|
+
}
|
|
22
45
|
],
|
|
23
|
-
|
|
46
|
+
"parent": null,
|
|
47
|
+
"_allowUnknownOption": true,
|
|
48
|
+
"_allowExcessArguments": true,
|
|
49
|
+
"_args": [],
|
|
50
|
+
"args": [],
|
|
51
|
+
"rawArgs": [],
|
|
52
|
+
"processedArgs": [],
|
|
53
|
+
"_scriptPath": null,
|
|
54
|
+
"_name": "danger",
|
|
55
|
+
"_optionValues": {},
|
|
56
|
+
"_optionValueSources": {},
|
|
57
|
+
"_storeOptionsAsProperties": false,
|
|
58
|
+
"_executableHandler": false,
|
|
59
|
+
"_executableFile": null,
|
|
60
|
+
"_executableDir": null,
|
|
61
|
+
"_defaultCommandName": null,
|
|
62
|
+
"_exitCallback": null,
|
|
63
|
+
"_aliases": [],
|
|
64
|
+
"_combineFlagAndOptionalValue": true,
|
|
65
|
+
"_description": "Run danger check",
|
|
66
|
+
"_summary": "",
|
|
67
|
+
"_enablePositionalOptions": false,
|
|
68
|
+
"_passThroughOptions": false,
|
|
69
|
+
"_lifeCycleHooks": {},
|
|
70
|
+
"_showHelpAfterError": false,
|
|
71
|
+
"_showSuggestionAfterError": true,
|
|
72
|
+
"_outputConfiguration": {},
|
|
73
|
+
"_hidden": false,
|
|
74
|
+
"_hasHelpOption": true,
|
|
75
|
+
"_helpFlags": "-h, --help",
|
|
76
|
+
"_helpDescription": "display help for command",
|
|
77
|
+
"_helpShortFlag": "-h",
|
|
78
|
+
"_helpLongFlag": "--help",
|
|
79
|
+
"_helpCommandName": "help",
|
|
80
|
+
"_helpCommandnameAndArgs": "help [command]",
|
|
81
|
+
"_helpCommandDescription": "display help for command",
|
|
82
|
+
"_helpConfiguration": {}
|
|
83
|
+
}"
|
|
24
84
|
`;
|
package/src/commands/danger.js
CHANGED
|
@@ -6,26 +6,9 @@ import {
|
|
|
6
6
|
files,
|
|
7
7
|
} from '@toptal/davinci-cli-shared'
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
{
|
|
11
|
-
label: 'check only, without fixing the code',
|
|
12
|
-
name: '--check',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
label: 'checks commit message quality locally',
|
|
16
|
-
name: '--local',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: 'specify custom danger file',
|
|
20
|
-
name: '--dangerfile <dangerfile>',
|
|
21
|
-
},
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
const dangerCommand = options => {
|
|
9
|
+
export const dangerCommand = options => {
|
|
25
10
|
print.header('Running danger check')
|
|
26
|
-
|
|
27
11
|
const { local, dangerfile, ...rest } = options
|
|
28
|
-
|
|
29
12
|
const conventionalCommitsDangerfilePath = files.getPackageFilePath(
|
|
30
13
|
'@toptal/davinci-ci',
|
|
31
14
|
'src/configs/danger/conventional-commits/dangerfile.cjs'
|
|
@@ -34,7 +17,6 @@ const dangerCommand = options => {
|
|
|
34
17
|
'@toptal/davinci-ci',
|
|
35
18
|
'src/configs/danger/toptal/dangerfile.cjs'
|
|
36
19
|
)
|
|
37
|
-
|
|
38
20
|
let dangerfilePath = dangerfile
|
|
39
21
|
|
|
40
22
|
if (!dangerfilePath) {
|
|
@@ -42,7 +24,6 @@ const dangerCommand = options => {
|
|
|
42
24
|
? conventionalCommitsDangerfilePath
|
|
43
25
|
: toptalCommitsDangerfilePath
|
|
44
26
|
}
|
|
45
|
-
|
|
46
27
|
runSync(
|
|
47
28
|
'yarn',
|
|
48
29
|
[
|
|
@@ -56,12 +37,13 @@ const dangerCommand = options => {
|
|
|
56
37
|
)
|
|
57
38
|
}
|
|
58
39
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
40
|
+
export const createDangerCommand = program => {
|
|
41
|
+
return program
|
|
42
|
+
.createCommand('danger')
|
|
43
|
+
.allowUnknownOption()
|
|
44
|
+
.description('Run danger check')
|
|
45
|
+
.option('--check', 'check only, without fixing the code')
|
|
46
|
+
.option('--local', 'checks commit message quality locally')
|
|
47
|
+
.option('--dangerfile <dangerfile>', 'specify custom danger file')
|
|
48
|
+
.action(dangerCommand)
|
|
65
49
|
}
|
|
66
|
-
|
|
67
|
-
export default dangerCommandCreator
|
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import { jest } from '@jest/globals'
|
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
+
import { Command } from 'commander'
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
const { createDangerCommand } = await import('./danger.js')
|
|
7
|
+
|
|
8
|
+
describe('createDangerCommand', () => {
|
|
9
|
+
let program
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
program = new Command()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
jest.clearAllMocks()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('creates a command with the correct parameters', () => {
|
|
20
|
+
const command = createDangerCommand(program)
|
|
21
|
+
|
|
22
|
+
expect(JSON.stringify(command, null, 2)).toMatchSnapshot()
|
|
6
23
|
})
|
|
7
24
|
})
|