@toptal/davinci-cli-shared 1.5.2-alpha-fx-2723-e2e-to-integration-migration-script.128 → 1.5.2-alpha-fx-2815-trailing-comma--eslint.127
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-cli-shared",
|
|
3
|
-
"version": "1.5.2-alpha-fx-
|
|
3
|
+
"version": "1.5.2-alpha-fx-2815-trailing-comma--eslint.127+ab9fe716",
|
|
4
4
|
"description": "Shared CLI code and CLI engine for davinci",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"js-yaml": "^4.1.0",
|
|
21
21
|
"vorpal": "^1.12.0"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "ab9fe71658d458c63ac71de4b1ce828507b8487e"
|
|
24
24
|
}
|
package/src/commands.loader.js
CHANGED
|
@@ -12,7 +12,9 @@ const commandsLoader = (commandCreators, vorpalInstance) => {
|
|
|
12
12
|
|
|
13
13
|
const commandInstance = vorpalInstance
|
|
14
14
|
.command(command)
|
|
15
|
-
.parse((
|
|
15
|
+
.parse((commandText, args) =>
|
|
16
|
+
commandText.replace(args, toVorpalArgs(args))
|
|
17
|
+
)
|
|
16
18
|
|
|
17
19
|
options.forEach(option => commandInstance.option(option.name, option.label))
|
|
18
20
|
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,9 @@ const vorpal = require('vorpal')
|
|
|
3
3
|
const print = require('../src/utils/print')
|
|
4
4
|
const { run, runSync } = require('../src/utils/run')
|
|
5
5
|
const prompt = require('../src/utils/prompt')
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
convertToCLIParameters
|
|
8
|
+
} = require('../src/utils/convert-to-cli-parameters')
|
|
7
9
|
const davinciProjectConfig = require('./utils/davinci-project-config')
|
|
8
10
|
const files = require('./utils/files')
|
|
9
11
|
|
|
@@ -17,11 +19,12 @@ const execCommand = (...args) => {
|
|
|
17
19
|
return vorpalInstance.exec(...args)
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
const help =
|
|
21
|
-
return vorpalInstance.help(
|
|
22
|
+
const help = helpText => {
|
|
23
|
+
return vorpalInstance.help(helpText)
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const catchErrorCommand = callback => {
|
|
27
|
+
/* eslint-disable promise/catch-or-return, promise/valid-params */
|
|
25
28
|
vorpalInstance
|
|
26
29
|
.catch('[commands...]', 'Catches incorrect commands')
|
|
27
30
|
.action((args, cb) => {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
const convertToCLIParameters = options => {
|
|
2
2
|
const result = []
|
|
3
|
+
|
|
3
4
|
Object.keys(options).forEach(key => {
|
|
4
|
-
|
|
5
|
+
result.push(`--${key}`)
|
|
6
|
+
|
|
7
|
+
const hasTrueValue = options[key] === true
|
|
8
|
+
const optionValue = hasTrueValue ? '' : String(options[key])
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
const optionValue = hasTrueValue ? '' : String(options[key])
|
|
8
|
-
result.push(optionValue)
|
|
10
|
+
result.push(optionValue)
|
|
9
11
|
})
|
|
10
12
|
|
|
11
13
|
return result
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const yaml = require('js-yaml')
|
|
3
|
+
|
|
3
4
|
const files = require('./files')
|
|
4
5
|
|
|
5
6
|
const path = files.getProjectRootFilePath('./davinci.yaml')
|
|
6
7
|
const data = fs.existsSync(path) ? yaml.load(fs.readFileSync(path, 'utf8')) : {}
|
|
7
|
-
const resolve = (sectionName, key) =>
|
|
8
|
+
const resolve = (sectionName, key) =>
|
|
9
|
+
Boolean(data && resolveKey(data[sectionName], key))
|
|
8
10
|
const resolveKey = (section, key) => section && section[key]
|
|
9
11
|
|
|
10
12
|
const davinciProjectConfig = {
|
package/src/utils/files.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
|
|
3
3
|
const getPackageFileContent = (davinciPackageName, filename) =>
|
|
4
|
-
require(
|
|
5
|
-
getPackageFilePath(davinciPackageName, filename)
|
|
6
|
-
)
|
|
4
|
+
require(getPackageFilePath(davinciPackageName, filename))
|
|
7
5
|
|
|
8
6
|
const getPackageFilePath = (davinciPackageName, filename) => {
|
|
9
7
|
const packageIndexPath = require.resolve(davinciPackageName)
|
|
10
8
|
const davinciQARoot = path.join(packageIndexPath, '../..')
|
|
9
|
+
|
|
11
10
|
return path.join(davinciQARoot, filename)
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
const getProjectRootFileContent = filename =>
|
|
15
|
-
require(
|
|
16
|
-
getProjectRootFilePath(filename)
|
|
17
|
-
)
|
|
14
|
+
require(getProjectRootFilePath(filename))
|
|
18
15
|
|
|
19
16
|
const getProjectRootFilePath = filename => {
|
|
20
17
|
const currentRunningDir = process.cwd()
|
|
18
|
+
|
|
21
19
|
return path.join(currentRunningDir, filename)
|
|
22
20
|
}
|
|
23
21
|
|