mobbdev 0.0.45 → 0.0.47
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": "mobbdev",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "Automated secure code remediation tool",
|
|
5
5
|
"repository": "https://github.com/mobb-dev/bugsy",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dotenv": "16.0.3",
|
|
36
36
|
"extract-zip": "2.0.1",
|
|
37
37
|
"globby": "13.2.2",
|
|
38
|
-
"graphql": "16.
|
|
38
|
+
"graphql": "16.8.1",
|
|
39
39
|
"graphql-request": "5.0.0",
|
|
40
40
|
"inquirer": "9.2.7",
|
|
41
41
|
"istextorbinary": "6.0.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"tar": "6.2.0",
|
|
51
51
|
"tmp": "0.2.1",
|
|
52
52
|
"yargs": "17.7.2",
|
|
53
|
-
"zod": "3.
|
|
53
|
+
"zod": "3.22.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@octokit/plugin-rest-endpoint-methods": "7.0.1",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"files": [
|
|
82
82
|
"bin",
|
|
83
83
|
"dist",
|
|
84
|
-
".env"
|
|
84
|
+
".env",
|
|
85
|
+
"src/post_install"
|
|
85
86
|
]
|
|
86
87
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// this file is based from 'binary-install' https://www.npmjs.com/package/binary-install
|
|
2
|
+
import axios from 'axios'
|
|
3
|
+
import { existsSync, mkdirSync } from 'fs'
|
|
4
|
+
import { arch as _arch, type as _type } from 'os'
|
|
5
|
+
import { join } from 'path'
|
|
6
|
+
import tar from 'tar'
|
|
7
|
+
|
|
8
|
+
const __dirname = process.env['PWD']
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} installParams
|
|
12
|
+
* @param {string} installParams.binaryName
|
|
13
|
+
* @param {string} installParams.url
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
16
|
+
export async function install({ binaryName, url }) {
|
|
17
|
+
if (!__dirname) {
|
|
18
|
+
throw Error('pwd is undefiled')
|
|
19
|
+
}
|
|
20
|
+
const installDirectory = join(__dirname, 'node_modules', '.bin')
|
|
21
|
+
const binaryPath = join(installDirectory, binaryName)
|
|
22
|
+
if (existsSync(binaryPath)) {
|
|
23
|
+
console.log(`${binaryName} is already installed, skipping installation.`)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
mkdirSync(installDirectory, { recursive: true })
|
|
27
|
+
console.log(`Downloading release from ${url}`)
|
|
28
|
+
const binaryStream = await axios({ url, responseType: 'stream' })
|
|
29
|
+
await new Promise((resolve, reject) => {
|
|
30
|
+
const sink = binaryStream.data.pipe(
|
|
31
|
+
tar.x({
|
|
32
|
+
filter(path) {
|
|
33
|
+
return path.startsWith(binaryName)
|
|
34
|
+
},
|
|
35
|
+
C: installDirectory,
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
|
+
sink.on('finish', () => resolve(null))
|
|
39
|
+
sink.on('error', (/** @type {Error} */ err) => reject(err))
|
|
40
|
+
})
|
|
41
|
+
console.log(`${binaryName} has been installed!`)
|
|
42
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { arch as _arch, type as _type } from 'os'
|
|
2
|
+
|
|
3
|
+
import { install } from './binary.mjs'
|
|
4
|
+
import { cxOperatingSystemSupportMessage } from './constants.mjs'
|
|
5
|
+
|
|
6
|
+
const supportedPlatforms = [
|
|
7
|
+
{
|
|
8
|
+
type: 'Windows_NT',
|
|
9
|
+
architecture: 'x64',
|
|
10
|
+
target: 'windows_x64.zip',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: 'Linux',
|
|
14
|
+
architecture: 'x64',
|
|
15
|
+
target: 'linux_x64.tar.gz',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: 'Linux',
|
|
19
|
+
architecture: 'arm',
|
|
20
|
+
target: 'linux_arm6.tar.gz',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'Linux',
|
|
24
|
+
architecture: 'arm64',
|
|
25
|
+
target: 'linux_arm64.tar.gz',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'Darwin',
|
|
29
|
+
architecture: 'arm64',
|
|
30
|
+
target: 'darwin_x64.tar.gz',
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
function installBinary() {
|
|
35
|
+
const supportedPlatform = getPlatformMetadata()
|
|
36
|
+
if (!supportedPlatform) {
|
|
37
|
+
console.warn(cxOperatingSystemSupportMessage)
|
|
38
|
+
console.warn(
|
|
39
|
+
'The rest of Bugsy features and scanners will be available for use'
|
|
40
|
+
)
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
const { target } = supportedPlatform
|
|
44
|
+
|
|
45
|
+
const url = `https://github.com/Checkmarx/ast-cli/releases/download/2.0.55/ast-cli_${target}`
|
|
46
|
+
const binaryName = 'cx'
|
|
47
|
+
|
|
48
|
+
install({ binaryName, url })
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getPlatformMetadata() {
|
|
52
|
+
const type = _type()
|
|
53
|
+
const architecture = _arch()
|
|
54
|
+
|
|
55
|
+
for (const supportedPlatform of supportedPlatforms) {
|
|
56
|
+
if (
|
|
57
|
+
type === supportedPlatform.type &&
|
|
58
|
+
architecture === supportedPlatform.architecture
|
|
59
|
+
) {
|
|
60
|
+
return supportedPlatform
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return null
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
installBinary()
|