Skip to content
Snippets Groups Projects
Commit 7cfb4f37 authored by Zdravko Iliev's avatar Zdravko Iliev
Browse files

feat: setup nx monorepo

parent 434f50ab
Branches
Tags
1 merge request!1feat: setup nx monorepo
{ {
"root": true, "root": true,
"ignorePatterns": ["**/*"], "ignorePatterns": ["**/*"],
"plugins": ["@nx"], "plugins": ["@nrwl/nx", "@typescript-eslint/eslint-plugin"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": { "rules": {
"@nx/enforce-module-boundaries": [ "@nrwl/nx/enforce-module-boundaries": [
"error", "error",
{ {
"enforceBuildableLibDependency": true, "enforceBuildableLibDependency": true,
...@@ -23,12 +23,21 @@ ...@@ -23,12 +23,21 @@
}, },
{ {
"files": ["*.ts", "*.tsx"], "files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"], "extends": [
"rules": {} "plugin:@nrwl/nx/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-explicit-any": "error"
}
}, },
{ {
"files": ["*.js", "*.jsx"], "files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"], "extends": ["plugin:@nrwl/nx/javascript"],
"rules": {} "rules": {}
}, },
{ {
......
...@@ -18,11 +18,7 @@ node_modules ...@@ -18,11 +18,7 @@ node_modules
*.sublime-workspace *.sublime-workspace
# IDE - VSCode # IDE - VSCode
.vscode/* .vscode
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc # misc
/.sass-cache /.sass-cache
......
{ {
"singleQuote": true "singleQuote": false,
"trailingComma": "all"
} }
{
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"dbaeumer.vscode-eslint"
]
}
{
"$schema": "https://json.schemastore.org/swcrc",
"sourceMaps": true,
"module": {
"type": "commonjs"
},
"jsc": {
"target": "es2017",
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"keepClassNames": true,
"baseUrl": "./"
},
"minify": false
}
...@@ -5,18 +5,15 @@ ...@@ -5,18 +5,15 @@
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
"executor": "@nx/webpack:webpack", "executor": "@nrwl/js:swc",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
"target": "node", "target": "node",
"compiler": "tsc", "compiler": "swc",
"outputPath": "dist/apps/agent", "outputPath": "dist/apps/my-nest-app",
"main": "apps/agent/src/main.ts", "main": "apps/agent/src/main.ts",
"tsConfig": "apps/agent/tsconfig.app.json", "tsConfig": "apps/agent/tsconfig.app.json"
"assets": ["apps/agent/src/assets"],
"isolatedConfig": true,
"webpackConfig": "apps/agent/webpack.config.js"
}, },
"configurations": { "configurations": {
"development": {}, "development": {},
...@@ -55,7 +52,7 @@ ...@@ -55,7 +52,7 @@
"configurations": { "configurations": {
"ci": { "ci": {
"ci": true, "ci": true,
"codeCoverage": true "codeCoverage": false
} }
} }
} }
......
...@@ -7,7 +7,7 @@ export class AppController { ...@@ -7,7 +7,7 @@ export class AppController {
constructor(private readonly appService: AppService) {} constructor(private readonly appService: AppService) {}
@Get() @Get()
getData() { getData(): { message: string } {
return this.appService.getData(); return this.appService.getData();
} }
} }
...@@ -8,14 +8,14 @@ import { NestFactory } from "@nestjs/core"; ...@@ -8,14 +8,14 @@ import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app/app.module"; import { AppModule } from "./app/app.module";
async function bootstrap() { async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
const globalPrefix = "api"; const globalPrefix = "api";
app.setGlobalPrefix(globalPrefix); app.setGlobalPrefix(globalPrefix);
const port = process.env.PORT || 3000; const port = process.env.PORT || 3000;
await app.listen(port); await app.listen(port);
Logger.log( Logger.log(
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}` `🚀 Application is running on: http://localhost:${port}/${globalPrefix}`,
); );
} }
......
const { composePlugins, withNx } = require("@nx/webpack");
// Nx plugins for webpack.
module.exports = composePlugins(withNx(), (config) => {
// Update the webpack config as needed here.
// e.g. `config.plugins.push(new MyPlugin())`
return config;
});
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment