mirror of
https://github.com/OpenCTI-Platform/opencti.git
synced 2025-12-22 08:17:08 +00:00
committed by
GitHub
parent
298c9c5958
commit
e65b8a179e
5
.gitignore
vendored
5
.gitignore
vendored
@@ -19,8 +19,3 @@ node_modules/
|
||||
.venv
|
||||
venv
|
||||
/licenses/
|
||||
|
||||
|
||||
|
||||
.nx/cache
|
||||
.nx/workspace-data
|
||||
@@ -1 +0,0 @@
|
||||
nodeLinker: node-modules
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "client-python",
|
||||
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "client-python",
|
||||
"projectType": "application",
|
||||
"types": ["python"],
|
||||
"targets": {
|
||||
"install": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "client-python",
|
||||
"command": "pip install -r requirements.txt && pip install -e ."
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Install the OpenCTI Python client dependencies"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
4
nx.json
4
nx.json
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/nx/schemas/nx-schema.json",
|
||||
"defaultBase": "master"
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
{
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "opencti-platform/opencti-front",
|
||||
"projectType": "application",
|
||||
"types": ["yarn"],
|
||||
"targets": {
|
||||
"install": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-front",
|
||||
"command": "yarn install"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Install the OpenCTI front dependencies"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": [{ "projects": ["opencti-graphql"], "target": "build" }],
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-front",
|
||||
"command": "yarn build"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Build the OpenCTI front"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-front",
|
||||
"command": "yarn check-ts && yarn lint && yarn verify-translation"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Check TS, lint and verify translations in the OpenCTI front"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-front",
|
||||
"command": "yarn test"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Run the tests of the OpenCTI front"
|
||||
}
|
||||
},
|
||||
"e2e": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": [
|
||||
{ "projects": ["opencti-graphql"], "target": "wait-api" },
|
||||
{ "projects": ["opencti-worker"], "target": "dev" }
|
||||
],
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-front",
|
||||
"command": "yarn test:e2e"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Run the tests of the OpenCTI front"
|
||||
}
|
||||
},
|
||||
"dev": {
|
||||
"executor": "nx:run-commands",
|
||||
"continuous": true,
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-front",
|
||||
"command": "yarn dev"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Run the OpenCTI front in development mode"
|
||||
}
|
||||
},
|
||||
"graphql": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-front",
|
||||
"command": "yarn relay"
|
||||
},
|
||||
"dependsOn": [{ "projects": ["opencti-graphql"], "target": "graphql" }],
|
||||
"metadata": {
|
||||
"description": "Generate the relay schema based on the backend GraphQL schema"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "opencti-platform/opencti-graphql",
|
||||
"projectType": "application",
|
||||
"types": ["yarn"],
|
||||
"targets": {
|
||||
"install": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": [{ "projects": ["client-python"], "target": "install" }],
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-graphql",
|
||||
"command": "yarn install && yarn install:python"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Install the OpenCTI GraphQL server dependencies"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-graphql",
|
||||
"command": "yarn build"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Build the OpenCTI GraphQL server"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-graphql",
|
||||
"command": "yarn lint"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Lint the OpenCTI GraphQL server"
|
||||
}
|
||||
},
|
||||
"wait-api": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-graphql",
|
||||
"command": "yarn wait-api"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Wait for the API to be available"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-graphql",
|
||||
"command": "yarn test"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Run the tests of the OpenCTI GraphQL server"
|
||||
}
|
||||
},
|
||||
"dev": {
|
||||
"executor": "nx:run-commands",
|
||||
"continuous": true,
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-graphql",
|
||||
"command": "yarn start"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Run the OpenCTI GraphQL server in development mode"
|
||||
}
|
||||
},
|
||||
"graphql": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "opencti-platform/opencti-graphql",
|
||||
"command": "yarn build:schema"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Build the GraphQL schema"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "opencti-worker",
|
||||
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "opencti-worker",
|
||||
"projectType": "application",
|
||||
"types": ["python"],
|
||||
"targets": {
|
||||
"install": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": [{ "projects": ["client-python"], "target": "install" }],
|
||||
"options": {
|
||||
"cwd": "opencti-worker/src",
|
||||
"command": "pip install -r requirements.txt"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Install the OpenCTI worker dependencies"
|
||||
}
|
||||
},
|
||||
"dev": {
|
||||
"executor": "nx:run-commands",
|
||||
"continuous": true,
|
||||
"dependsOn": [{ "projects": ["opencti-graphql"], "target": "dev" }],
|
||||
"options": {
|
||||
"cwd": "opencti-worker/src",
|
||||
"command": "python worker.py"
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Run the OpenCTI worker in development mode"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
package.json
26
package.json
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"name": "opencti",
|
||||
"packageManager": "yarn@4.12.0",
|
||||
"workspaces": [
|
||||
"opencti-platform/opencti-front",
|
||||
"opencti-platform/opencti-graphql",
|
||||
"client-python",
|
||||
"opencti-worker"
|
||||
],
|
||||
"devDependencies": {
|
||||
"nx": "22.2.5"
|
||||
},
|
||||
"scripts": {
|
||||
"deps": "nx run-many --tuiAutoExit --target install",
|
||||
"dev": "nx run-many --target dev",
|
||||
"build": "nx run-many --tuiAutoExit --target build",
|
||||
"test": "nx run-many --tuiAutoExit --target test,e2e",
|
||||
"lint": "nx run-many --tuiAutoExit --target lint",
|
||||
"graphql": "nx run-many --tuiAutoExit --target graphql",
|
||||
"with-python-venv": "node scripts/with_python_virtual_env.mjs",
|
||||
"deps:venv": "yarn with-python-venv yarn deps",
|
||||
"build:venv": "yarn with-python-venv yarn build",
|
||||
"dev:venv": "yarn with-python-venv yarn dev",
|
||||
"test:venv": "yarn with-python-venv yarn test"
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Wrapper script to run commands within a Python virtual environment using sh.
|
||||
*
|
||||
* This allows running commands if your default shell is not POSIX-compliant,
|
||||
* if you don't want to activate the virtual environment globally, if you
|
||||
* often forget to activate it, or if you want to specify the virtual environment
|
||||
* path via an environment variable.
|
||||
*
|
||||
* Usage:
|
||||
* ./with_python_virtual_env.mjs <command> Run command in venv
|
||||
* ./with_python_virtual_env.mjs Output activation command for eval
|
||||
*
|
||||
* Environment variables:
|
||||
* VENV_PATH Path to virtual environment (default: ../.python-venv)
|
||||
*/
|
||||
|
||||
import { spawn } from 'node:child_process'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const VENV_PATH = process.env.VENV_PATH || join(process.cwd(), '..', '.python-venv')
|
||||
const commandToRun = process.argv.slice(2).join(' ')
|
||||
const activateScript = join(VENV_PATH, 'bin', 'activate')
|
||||
|
||||
if (!existsSync(activateScript)) {
|
||||
console.error(`Python virtual env activation script not found: ${activateScript}`)
|
||||
process.exit(2)
|
||||
}
|
||||
|
||||
if (commandToRun) {
|
||||
const fullCommand = `. ${activateScript} && ${commandToRun}`
|
||||
console.log(`Running in python virtual environment: ${commandToRun}`)
|
||||
|
||||
const child = spawn('sh', ['-c', fullCommand], {
|
||||
stdio: 'inherit',
|
||||
cwd: process.cwd(),
|
||||
env: process.env
|
||||
})
|
||||
|
||||
child.on('error', (error) => {
|
||||
console.error(`Failed to spawn shell: ${error.message}`)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
child.on('exit', (code) => {
|
||||
process.exit(code ?? 0)
|
||||
})
|
||||
} else {
|
||||
// No command provided: output activation command for manual eval
|
||||
console.log(`. ${activateScript}`)
|
||||
}
|
||||
Reference in New Issue
Block a user