@toptal/davinci-cli-shared 1.6.1-alpha-fx-2996-add-error-message-for-missing-engine.21 → 1.6.1-alpha-fix-davinci-out-of-memory.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-cli-shared",
3
- "version": "1.6.1-alpha-fx-2996-add-error-message-for-missing-engine.21+227d5ea7",
3
+ "version": "1.6.1-alpha-fix-davinci-out-of-memory.2+c4e78c49",
4
4
  "description": "Shared CLI code and CLI engine for davinci",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -18,9 +18,7 @@
18
18
  "execa": "^5.1.1",
19
19
  "inquirer": "^8.2.0",
20
20
  "js-yaml": "^4.1.0",
21
- "read-pkg-up": "7.0.1",
22
- "semver": "^7.3.7",
23
21
  "vorpal": "^1.12.0"
24
22
  },
25
- "gitHead": "227d5ea750c2b2ce9f4abd1ff33bbe1838ae9d28"
23
+ "gitHead": "c4e78c49203126a96b629c50688ba162d8d4c610"
26
24
  }
package/src/index.js CHANGED
@@ -8,7 +8,6 @@ const {
8
8
  } = require('../src/utils/convert-to-cli-parameters')
9
9
  const davinciProjectConfig = require('./utils/davinci-project-config')
10
10
  const files = require('./utils/files')
11
- const packageUtils = require('./utils/package')
12
11
 
13
12
  const vorpalInstance = vorpal()
14
13
 
@@ -52,5 +51,4 @@ module.exports = {
52
51
  execCommand,
53
52
  catchErrorCommand,
54
53
  help,
55
- packageUtils,
56
54
  }
@@ -19,20 +19,9 @@ const getProjectRootFilePath = filename => {
19
19
  return path.join(currentRunningDir, filename)
20
20
  }
21
21
 
22
- const projectHasPackage = pkg => {
23
- try {
24
- require.resolve(pkg)
25
-
26
- return true
27
- } catch {
28
- return false
29
- }
30
- }
31
-
32
22
  module.exports = {
33
23
  getPackageFileContent,
34
24
  getPackageFilePath,
35
25
  getProjectRootFilePath,
36
26
  getProjectRootFileContent,
37
- projectHasPackage,
38
27
  }
@@ -1,41 +0,0 @@
1
- const semver = require('semver')
2
- const readPkgUp = require('read-pkg-up')
3
-
4
- const yarnAdapter = require('./yarn-adapter')
5
-
6
- const getPackagePackageJson = cwd => {
7
- return readPkgUp.sync({ cwd }).packageJson
8
- }
9
-
10
- const getInstalledPackageVersion = packageName => {
11
- const packageInfoList = yarnAdapter.list(packageName)
12
-
13
- if (!packageInfoList.size) {
14
- return null
15
- }
16
-
17
- return packageInfoList.get(packageName)
18
- }
19
-
20
- const checkPrerequirement = ({ dependencies, packageName }) => {
21
- const validVersionOrRange = dependencies[packageName]
22
-
23
- const installedVersion = getInstalledPackageVersion(packageName)
24
-
25
- if (!installedVersion) {
26
- return `Cannot find module '${packageName}'.`
27
- }
28
-
29
- if (semver.satisfies(installedVersion, validVersionOrRange)) {
30
- return null
31
- }
32
-
33
- return `Invalid version of package ${packageName} is installed.
34
- Installed version: ${installedVersion}
35
- Should be: ${validVersionOrRange}`
36
- }
37
-
38
- module.exports = {
39
- getPackagePackageJson,
40
- checkPrerequirement,
41
- }
@@ -1,44 +0,0 @@
1
- const { runSync } = require('./run')
2
-
3
- /**
4
- *
5
- * @param {string} treeName
6
- * @example '@toptal/davinci-engine@7.5.2'
7
- * @returns {Array} Pair package name and version, ex. ['@toptal/davinci-engine', '16.0.2']
8
- */
9
- const splitNameAndVersion = treeName => {
10
- const atPos = treeName.lastIndexOf('@')
11
-
12
- return [treeName.slice(0, atPos), treeName.slice(atPos + 1)]
13
- }
14
-
15
- const list = packageName => {
16
- const { stdout } = runSync(
17
- 'yarn',
18
- [
19
- 'list',
20
- '--json',
21
- '--no-progress',
22
- '--non-interactive',
23
- '--depth=0',
24
- '--pattern',
25
- packageName,
26
- ],
27
- {
28
- stdio: undefined,
29
- }
30
- )
31
-
32
- const listInfo = JSON.parse(stdout)
33
- const packagesFound = listInfo?.data?.trees || []
34
-
35
- if (packagesFound.length <= 0) {
36
- return new Map()
37
- }
38
-
39
- return new Map(packagesFound.map(pkg => splitNameAndVersion(pkg.name)))
40
- }
41
-
42
- module.exports = {
43
- list,
44
- }