Skip to content

Commit b496ad3

Browse files
committed
feat: migrate over old ionic app into monorepo
1 parent 906421f commit b496ad3

File tree

103 files changed

+64602
-18464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+64602
-18464
lines changed

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
# MariMedical
12

3+
## Getting started
24

3-
# MariMedical
5+
```
6+
nx serve web
7+
nx serve desktop
8+
nx serve api
9+
```
410

511
This project was generated using [Nx](https://nx.dev).
612

@@ -79,8 +85,6 @@ Run `nx graph` to see a diagram of the dependencies of your projects.
7985

8086
Visit the [Nx Documentation](https://nx.dev) to learn more.
8187

82-
83-
8488
## ☁ Nx Cloud
8589

8690
### Distributed Computation Caching & Distributed Task Execution

apps/api/.eslintrc.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

apps/api/jest.config.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'api',
4+
preset: '../../jest.preset.js',
5+
globals: {
6+
'ts-jest': {
7+
tsconfig: '<rootDir>/tsconfig.spec.json',
8+
},
9+
},
10+
testEnvironment: 'node',
11+
transform: {
12+
'^.+\\.[tj]s$': 'ts-jest',
13+
},
14+
moduleFileExtensions: ['ts', 'js', 'html'],
15+
coverageDirectory: '../../coverage/apps/api',
16+
};

apps/api/project.json

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
3+
"sourceRoot": "apps/api/src",
4+
"projectType": "application",
5+
"targets": {
6+
"build": {
7+
"executor": "@nrwl/node:webpack",
8+
"outputs": [
9+
"{options.outputPath}"
10+
],
11+
"options": {
12+
"outputPath": "dist/apps/api",
13+
"main": "apps/api/src/main.ts",
14+
"tsConfig": "apps/api/tsconfig.app.json",
15+
"assets": [
16+
"apps/api/src/assets"
17+
]
18+
},
19+
"configurations": {
20+
"production": {
21+
"optimization": true,
22+
"extractLicenses": true,
23+
"inspect": false,
24+
"fileReplacements": [
25+
{
26+
"replace": "apps/api/src/environments/environment.ts",
27+
"with": "apps/api/src/environments/environment.prod.ts"
28+
}
29+
]
30+
}
31+
}
32+
},
33+
"serve": {
34+
"executor": "@nrwl/node:node",
35+
"options": {
36+
"buildTarget": "api:build"
37+
},
38+
"configurations": {
39+
"production": {
40+
"buildTarget": "api:build:production"
41+
}
42+
}
43+
},
44+
"lint": {
45+
"executor": "@nrwl/linter:eslint",
46+
"outputs": [
47+
"{options.outputFile}"
48+
],
49+
"options": {
50+
"lintFilePatterns": [
51+
"apps/api/**/*.ts"
52+
]
53+
}
54+
},
55+
"test": {
56+
"executor": "@nrwl/jest:jest",
57+
"outputs": [
58+
"coverage/apps/api"
59+
],
60+
"options": {
61+
"jestConfig": "apps/api/jest.config.ts",
62+
"passWithNoTests": true
63+
}
64+
}
65+
},
66+
"tags": []
67+
}

apps/api/src/app/.gitkeep

Whitespace-only changes.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Test, TestingModule } from '@nestjs/testing';
2+
3+
import { AppController } from './app.controller';
4+
import { AppService } from './app.service';
5+
6+
describe('AppController', () => {
7+
let app: TestingModule;
8+
9+
beforeAll(async () => {
10+
app = await Test.createTestingModule({
11+
controllers: [AppController],
12+
providers: [AppService],
13+
}).compile();
14+
});
15+
16+
describe('getData', () => {
17+
it('should return "Welcome to api!"', () => {
18+
const appController = app.get<AppController>(AppController);
19+
expect(appController.getData()).toEqual({ message: 'Welcome to api!' });
20+
});
21+
});
22+
});

apps/api/src/app/app.controller.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Controller, Get } from '@nestjs/common';
2+
3+
import { AppService } from './app.service';
4+
5+
@Controller()
6+
export class AppController {
7+
constructor(private readonly appService: AppService) {}
8+
9+
@Get()
10+
getData() {
11+
return this.appService.getData();
12+
}
13+
}

apps/api/src/app/app.module.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Module } from '@nestjs/common';
2+
3+
import { AppController } from './app.controller';
4+
import { AppService } from './app.service';
5+
6+
@Module({
7+
imports: [],
8+
controllers: [AppController],
9+
providers: [AppService],
10+
})
11+
export class AppModule {}

apps/api/src/app/app.service.spec.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Test } from '@nestjs/testing';
2+
3+
import { AppService } from './app.service';
4+
5+
describe('AppService', () => {
6+
let service: AppService;
7+
8+
beforeAll(async () => {
9+
const app = await Test.createTestingModule({
10+
providers: [AppService],
11+
}).compile();
12+
13+
service = app.get<AppService>(AppService);
14+
});
15+
16+
describe('getData', () => {
17+
it('should return "Welcome to api!"', () => {
18+
expect(service.getData()).toEqual({ message: 'Welcome to api!' });
19+
});
20+
});
21+
});

apps/api/src/app/app.service.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Injectable } from '@nestjs/common';
2+
3+
@Injectable()
4+
export class AppService {
5+
getData(): { message: string } {
6+
return { message: 'Welcome to api!' };
7+
}
8+
}

apps/api/src/assets/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true,
3+
};
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: false,
3+
};

apps/api/src/main.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* This is not a production server yet!
3+
* This is only a minimal backend to get started.
4+
*/
5+
6+
import { Logger } from '@nestjs/common';
7+
import { NestFactory } from '@nestjs/core';
8+
9+
import { AppModule } from './app/app.module';
10+
11+
async function bootstrap() {
12+
const app = await NestFactory.create(AppModule);
13+
const globalPrefix = 'api';
14+
app.setGlobalPrefix(globalPrefix);
15+
const port = process.env.PORT || 3333;
16+
await app.listen(port);
17+
Logger.log(
18+
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
19+
);
20+
}
21+
22+
bootstrap();

apps/api/tsconfig.app.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"module": "commonjs",
6+
"types": ["node"],
7+
"emitDecoratorMetadata": true,
8+
"target": "es2015"
9+
},
10+
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"],
11+
"include": ["**/*.ts"]
12+
}

apps/api/tsconfig.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{
7+
"path": "./tsconfig.app.json"
8+
},
9+
{
10+
"path": "./tsconfig.spec.json"
11+
}
12+
]
13+
}

apps/api/tsconfig.spec.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"module": "commonjs",
6+
"types": ["jest", "node"]
7+
},
8+
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
9+
}

apps/desktop/.eslintrc.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

apps/desktop/jest.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
displayName: 'desktop',
3+
preset: '../../jest.preset.js',
4+
globals: {
5+
'ts-jest': {
6+
tsconfig: '<rootDir>/tsconfig.spec.json',
7+
},
8+
},
9+
testEnvironment: 'node',
10+
transform: {
11+
'^.+\\.[tj]s$': 'ts-jest',
12+
},
13+
moduleFileExtensions: ['ts', 'js', 'html'],
14+
coverageDirectory: '../../coverage/apps/desktop',
15+
};

apps/desktop/project.json

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"sourceRoot": "apps/desktop/src",
3+
"projectType": "application",
4+
"targets": {
5+
"build": {
6+
"executor": "nx-electron:build",
7+
"outputs": [
8+
"{options.outputPath}"
9+
],
10+
"options": {
11+
"outputPath": "dist/apps/desktop",
12+
"main": "apps/desktop/src/main.ts",
13+
"tsConfig": "apps/desktop/tsconfig.app.json",
14+
"assets": [
15+
"apps/desktop/src/assets"
16+
]
17+
},
18+
"configurations": {
19+
"production": {
20+
"optimization": true,
21+
"extractLicenses": true,
22+
"inspect": false,
23+
"fileReplacements": [
24+
{
25+
"replace": "apps/desktop/src/environments/environment.ts",
26+
"with": "apps/desktop/src/environments/environment.prod.ts"
27+
}
28+
]
29+
}
30+
}
31+
},
32+
"serve": {
33+
"executor": "nx-electron:execute",
34+
"options": {
35+
"buildTarget": "desktop:build"
36+
}
37+
},
38+
"package": {
39+
"executor": "nx-electron:package",
40+
"options": {
41+
"name": "desktop",
42+
"frontendProject": "web",
43+
"outputPath": "dist/packages",
44+
"prepackageOnly": true
45+
}
46+
},
47+
"make": {
48+
"executor": "nx-electron:make",
49+
"options": {
50+
"name": "desktop",
51+
"frontendProject": "web",
52+
"outputPath": "dist/executables"
53+
}
54+
},
55+
"lint": {
56+
"executor": "@nrwl/linter:eslint",
57+
"outputs": [
58+
"{options.outputFile}"
59+
],
60+
"options": {
61+
"lintFilePatterns": [
62+
"apps/desktop/**/*.ts"
63+
]
64+
}
65+
},
66+
"test": {
67+
"executor": "@nrwl/jest:jest",
68+
"outputs": [
69+
"coverage/apps/desktop"
70+
],
71+
"options": {
72+
"jestConfig": "apps/desktop/jest.config.js",
73+
"passWithNoTests": true
74+
}
75+
}
76+
}
77+
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { contextBridge, ipcRenderer } from 'electron';
2+
3+
contextBridge.exposeInMainWorld('electron', {
4+
getAppVersion: () => ipcRenderer.invoke('get-app-version'),
5+
platform: process.platform,
6+
});

0 commit comments

Comments
 (0)