Skip to content

fix(refactor): migrate remixjs to react router v7 #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .cursor/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"mcpServers": {
"nx-mcp": {
"url": "http://localhost:9774/sse"
},
"playwright": {
"command": "npx",
"args": [
"-y",
"@playwright/mcp@latest",
"--vision"
]
},
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://postgres:postgres@localhost:5432/postgres"
]
},
"stripe": {
"command": "npx",
"args": ["-y", "@stripe/mcp@latest", "--tools=all"]
},
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ Thumbs.db
.nx/cache
.nx/workspace-data

vite.config.*.timestamp*
vitest.config.*.timestamp*
**/vite.config.{js,ts,mjs,mts,cjs,cts}.timestamp*

test-output


storybook-static

# env files
.env
**/vite.config.{js,ts,mjs,mts,cjs,cts}.timestamp*
.env
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
legacy-peer-deps=true
engine-strict=false
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
"firsttris.vscode-jest-runner",
"ms-playwright.playwright"
]
}
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"nxConsole.nxWorkspacePath": "${workspaceFolder}/nx.json"
}
"nxConsole.nxWorkspacePath": "${workspaceFolder}/nx.json",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"nxConsole.generateAiAgentRules": true
}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json .
COPY package-lock.json .
COPY .npmrc .

# Clean npm cache and rebuild node-gyp
RUN npm cache clean --force
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ stripe trigger payment_intent.succeeded
stripe listen --forward-to localhost:8081/order/webhook // or using the secure tunnel created by Ngrok
```

## MCP Servers
- [Nx MCP Server](https://nx.dev/blog/nx-made-cursor-smarter)

## Supporting 🍻
I believe in Unicorns 🦄
Support [me](http://www.paypal.me/jdnichollsc/2), if you do too.
Expand Down
3 changes: 0 additions & 3 deletions apps/auth-e2e/eslint.config.js

This file was deleted.

18 changes: 0 additions & 18 deletions apps/auth-e2e/jest.config.ts

This file was deleted.

17 changes: 0 additions & 17 deletions apps/auth-e2e/project.json

This file was deleted.

10 changes: 0 additions & 10 deletions apps/auth-e2e/src/auth/auth.spec.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/auth-e2e/src/support/global-setup.ts

This file was deleted.

7 changes: 0 additions & 7 deletions apps/auth-e2e/src/support/global-teardown.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/auth-e2e/src/support/test-setup.ts

This file was deleted.

13 changes: 0 additions & 13 deletions apps/auth-e2e/tsconfig.json

This file was deleted.

9 changes: 0 additions & 9 deletions apps/auth-e2e/tsconfig.spec.json

This file was deleted.

22 changes: 22 additions & 0 deletions apps/auth/.spec.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"jsc": {
"target": "es2017",
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true
},
"keepClassNames": true,
"externalHelpers": true,
"loose": true
},
"module": {
"type": "es6"
},
"sourceMaps": true,
"exclude": []
}
3 changes: 0 additions & 3 deletions apps/auth/eslint.config.js

This file was deleted.

3 changes: 3 additions & 0 deletions apps/auth/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import baseConfig from '../../eslint.config.mjs';

export default [...baseConfig];
28 changes: 15 additions & 13 deletions apps/auth/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import type { Config } from '@jest/types';
/* eslint-disable */
import { readFileSync } from 'fs';

const config: Config.InitialOptions = {
displayName: 'auth',
// Reading the SWC compilation config for the spec files
const swcJestConfig = JSON.parse(
readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8')
);

// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
swcJestConfig.swcrc = false;

export default {
displayName: '@projectx/auth',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
coverageDirectory: '../../coverage/apps/auth',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': 'ts-jest',
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
moduleFileExtensions: ['ts', 'js', 'html'],
testEnvironment: 'node',
coverageDirectory: 'test-output/jest/coverage',
};

export default config;
15 changes: 10 additions & 5 deletions apps/auth/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
"apps/auth/src/assets",
"apps/auth/src/workflows"
],
"isolatedConfig": true,
"webpackConfig": "apps/auth/webpack.config.js"
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production"
"mode": "production",
"optimization": true,
"extractLicenses": true,
"inspect": false
}
}
},
Expand All @@ -40,12 +42,15 @@
},
"configurations": {
"development": {
"buildTarget": "auth:build:development"
"buildTarget": "auth:build:development",
"watch": true,
"inspect": true
},
"production": {
"buildTarget": "auth:build:production"
"buildTarget": "auth:build:production",
"watch": false
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion apps/auth/src/app/app.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('AppController', () => {
it('should do something', () => {
const appController = app.get<AppController>(AppController);
expect(appController.login({ email: '[email protected]' })).toBeDefined();
expect(appService.sendLoginEmail).toHaveBeenCalled();
expect(appService.login).toHaveBeenCalled();
});
});
});
2 changes: 1 addition & 1 deletion apps/auth/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ActivitiesModule } from './activities/activities.module';
EmailModule,
WorkflowsModule.registerAsync({
imports: [ActivitiesModule],
useFactory: async (activitiesService: ActivitiesService) => ({
useFactory: (activitiesService: ActivitiesService) => ({
activitiesService,
workflowsPath: path.join(__dirname, '/workflows'),
}),
Expand Down
29 changes: 23 additions & 6 deletions apps/auth/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,46 @@ import { loginUserWorkflow } from '../workflows';
@Injectable()
export class AppService {
readonly logger = new Logger(AppService.name);
private readonly taskQueue: string;

constructor(
private readonly configService: ConfigService,
private readonly clientService: ClientService,
private readonly authService: AuthService
) {}
) {
const taskQueue = this.configService.get<string>('temporal.taskQueue');
if (!taskQueue) {
throw new Error('Task queue not found');
}
this.taskQueue = taskQueue;
}

getWorkflowIdByEmail(email: string) {
return `login-${email}`;
}

getWorkflowClient() {
const workflowClient = this.clientService.client?.workflow;
if (!workflowClient) {
throw new HttpException(
'The workflow client was not initialized correctly',
HttpStatus.INTERNAL_SERVER_ERROR
);
}
return workflowClient;
}

/**
* Initiates the login process by sending a verification email.
* @param body AuthLoginDto containing the user's email.
* @returns A message indicating the email was sent.
*/
async login(body: AuthLoginDto) {
this.logger.log(`sendLoginEmail(${body.email}) - sending email`);
const taskQueue = this.configService.get<string>('temporal.taskQueue');
try {
await this.clientService.client?.workflow.start(loginUserWorkflow, {
await this.getWorkflowClient().start(loginUserWorkflow, {
args: [body],
taskQueue,
taskQueue: this.taskQueue,
workflowId: this.getWorkflowIdByEmail(body.email),
searchAttributes: {
Email: [body.email],
Expand Down Expand Up @@ -72,7 +89,7 @@ export class AppService {
const workflowId = this.getWorkflowIdByEmail(body.email);

const description = await getWorkflowDescription(
this.clientService.client?.workflow,
this.getWorkflowClient(),
workflowId
);
const isLoginRunning = isWorkflowRunning(description);
Expand All @@ -81,7 +98,7 @@ export class AppService {
throw new HttpException('The code has expired', HttpStatus.BAD_REQUEST);
}

const handle = this.clientService.client?.workflow.getHandle(workflowId);
const handle = this.getWorkflowClient().getHandle(workflowId);
const result = await handle.executeUpdate(verifyLoginCodeUpdate, {
args: [body.code],
});
Expand Down
Loading
Loading