Update yarn commands (#4644)
* Simplify commands * Simplify commands * Migrate all dev commands to project.json * Fix tests
This commit is contained in:
@ -7,29 +7,10 @@
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
"nx": "NX_DEFAULT_PROJECT=twenty-server node ../../node_modules/nx/bin/nx.js",
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "npx nx prebuild && nest build --path ./tsconfig.build.json",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "NODE_ENV=development && nest start",
|
||||
"start:dev": "npx nx start --watch",
|
||||
"start:debug": "npx nx start:dev --debug",
|
||||
"start:prod": "node dist/src/main",
|
||||
"lint": "eslint \"src/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:watch": "npx nx test --watch",
|
||||
"test:cov": "npx nx test --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register ../../node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "./scripts/run-integration.sh",
|
||||
"typeorm": "npx ts-node ../../node_modules/typeorm/cli.js",
|
||||
"database:init": "npx nx database:setup && npx nx database:seed:dev",
|
||||
"database:setup": "npx ts-node ./scripts/setup-db.ts && npx nx database:migrate",
|
||||
"database:truncate": "npx ts-node ./scripts/truncate-db.ts",
|
||||
"database:migrate": "npx nx typeorm -- migration:run -d src/database/typeorm/metadata/metadata.datasource && npx nx typeorm -- migration:run -d src/database/typeorm/core/core.datasource",
|
||||
"database:seed:dev": "npx nx command -- workspace:seed:dev",
|
||||
"database:seed:demo": "npx nx command -- workspace:seed:demo",
|
||||
"database:reset": "npx nx database:truncate && npx nx database:init",
|
||||
"command": "node dist/src/command/command",
|
||||
"queue:work": "node dist/src/queue-worker/queue-worker",
|
||||
"command:prod": "node dist/src/command/command",
|
||||
"worker:prod": "node dist/src/queue-worker/queue-worker",
|
||||
"database:init:prod": "npx ts-node ./scripts/setup-db.ts && yarn database:migrate:prod",
|
||||
"database:migrate:prod": "npx -y typeorm migration:run -d dist/src/database/typeorm/metadata/metadata.datasource && npx -y typeorm migration:run -d dist/src/database/typeorm/core/core.datasource"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@ -1,34 +1,155 @@
|
||||
{
|
||||
"name": "twenty-server",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"build:packageJson": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"dependsOn": [
|
||||
"prebuild"
|
||||
],
|
||||
"options": {
|
||||
"main": "packages/twenty-server/dist/src/main.js",
|
||||
"tsConfig": "packages/twenty-server/tsconfig.json",
|
||||
"outputPath": "packages/twenty-server/dist",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
}
|
||||
},
|
||||
"command": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "node dist/src/command/command.js"
|
||||
}
|
||||
},
|
||||
"test:debug": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
"name": "twenty-server",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"commands": ["rimraf dist", "nest build --path ./tsconfig.build.json"]
|
||||
}
|
||||
},
|
||||
"build:packageJson": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"options": {
|
||||
"main": "packages/twenty-server/dist/src/main.js",
|
||||
"tsConfig": "packages/twenty-server/tsconfig.json",
|
||||
"outputPath": "packages/twenty-server/dist",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
}
|
||||
},
|
||||
"start": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "NODE_ENV=development && nest start --watch"
|
||||
}
|
||||
},
|
||||
"start:debug": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "nx start --debug"
|
||||
}
|
||||
},
|
||||
"command": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "node dist/src/command/command.js"
|
||||
}
|
||||
},
|
||||
"command-no-deps": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "node dist/src/command/command.js"
|
||||
}
|
||||
},
|
||||
"worker": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "node dist/src/queue-worker/queue-worker.js"
|
||||
}
|
||||
},
|
||||
"typeorm": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "ts-node ../../node_modules/typeorm/cli.js"
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "ts-node"
|
||||
}
|
||||
},
|
||||
"ts-node-no-deps": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "ts-node"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "eslint \"src/**/*.ts\" --fix"
|
||||
}
|
||||
},
|
||||
"test:unit": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "jest"
|
||||
}
|
||||
},
|
||||
"test:unit:watch": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "jest --watch"
|
||||
}
|
||||
},
|
||||
"test:unit:coverage": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "jest --coverage"
|
||||
}
|
||||
},
|
||||
"test:unit:debug": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register ../../node_modules/.bin/jest --runInBand"
|
||||
}
|
||||
},
|
||||
"test:e2e": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "./scripts/run-integration.sh"
|
||||
}
|
||||
},
|
||||
"database:migrate": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"commands": [
|
||||
"nx typeorm -- migration:run -d src/database/typeorm/metadata/metadata.datasource",
|
||||
"nx typeorm -- migration:run -d src/database/typeorm/core/core.datasource"
|
||||
],
|
||||
"parallel": false
|
||||
}
|
||||
},
|
||||
"database:reset": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"commands": [
|
||||
"nx ts-node-no-deps -- ./scripts/truncate-db.ts",
|
||||
"nx ts-node-no-deps -- ./scripts/setup-db.ts",
|
||||
"nx database:migrate",
|
||||
"nx command-no-deps -- workspace:seed:dev"
|
||||
],
|
||||
"parallel": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
export PG_DATABASE_URL=postgres://twenty:twenty@$PG_DATABASE_HOST:$PG_DATABASE_PORT/default
|
||||
yarn database:setup
|
||||
yarn database:init:prod
|
||||
node dist/src/main
|
||||
|
||||
@ -4,5 +4,5 @@
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
source $DIR/set-env-test.sh
|
||||
|
||||
yarn database:init
|
||||
yarn jest --config ./test/jest-e2e.json
|
||||
yarn nx database:reset
|
||||
yarn nx jest --config ./test/jest-e2e.json
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
||||
|
||||
const environmentService = new EnvironmentService(new ConfigService());
|
||||
|
||||
Reference in New Issue
Block a user