From 88b4b00f7795348a182f5076b6b06c973e71eb3e Mon Sep 17 00:00:00 2001 From: Sawan Bhattacharya <74916308+kriptonian1@users.noreply.github.com> Date: Sun, 25 Feb 2024 19:45:51 +0530 Subject: [PATCH] refactor(monorepo): Migrate from nx to turbo (#153) Co-authored-by: rajdip-b --- .eslintignore | 1 - .eslintrc.json | 61 ------ .github/workflows/stage-api.yml | 3 +- .gitignore | 7 +- .husky/pre-commit | 2 +- .prettierignore | 5 +- apps/api/.eslintrc.js | 25 +++ apps/api/.eslintrc.json | 18 -- apps/api/Dockerfile | 30 +-- apps/api/nest-cli.json | 9 + apps/api/package.json | 85 +++++++++ apps/api/project.json | 103 ----------- .../dto/create.api-key/create.api-key.spec.ts | 8 +- .../dto/update.api-key/update.api-key.spec.ts | 8 +- apps/api/src/auth/guard/auth/auth.guard.ts | 3 + apps/api/src/common/create-key-pair.ts | 2 +- apps/api/src/common/decrypt.ts | 2 +- apps/api/src/common/encrypt.ts | 2 +- apps/api/src/common/fetch-events.ts | 2 +- .../src/common/query.transform.pipe.spec.ts | 8 +- .../create.environment.spec.ts | 8 +- .../update.environment.spec.ts | 8 +- apps/api/src/main.ts | 4 +- .../dto/create.project/create.project.spec.ts | 8 +- .../dto/update.project/update.project.spec.ts | 8 +- apps/api/src/project/project.e2e.spec.ts | 4 +- .../dto/create.secret/create.secret.spec.ts | 8 +- .../dto/update.secret/update.secret.spec.ts | 8 +- .../create.variable/create.variable.spec.ts | 8 +- .../update.variable/update.variable.spec.ts | 8 +- .../create-workspace-role.spec.ts | 8 +- .../update-workspace-role.spec.ts | 8 +- .../create.workspace/create.workspace.spec.ts | 8 +- .../update.workspace/update.workspace.spec.ts | 8 +- apps/api/src/workspace/workspace.e2e.spec.ts | 4 +- apps/api/tsconfig.app.json | 2 +- apps/api/tsconfig.build.json | 4 + apps/api/tsconfig.json | 31 ++-- apps/api/tsconfig.spec.json | 2 +- apps/web/.eslintrc.js | 8 + apps/web/.eslintrc.json | 31 ---- apps/web/Dockerfile | 13 +- apps/web/app/api/hello/route.ts | 3 - apps/web/app/layout.tsx | 111 +++++------ apps/web/app/page.tsx | 11 +- apps/web/components/Killers.tsx | 32 ---- apps/web/components/Links.tsx | 34 ---- apps/web/components/killers.tsx | 40 ++++ apps/web/components/links.tsx | 32 ++++ apps/web/index.d.ts | 6 +- apps/web/jest.config.ts | 11 -- apps/web/next.config.js | 32 +--- apps/web/package.json | 31 ++++ apps/web/project.json | 60 ------ apps/web/tsconfig.json | 49 +---- apps/web/tsconfig.spec.json | 21 --- apps/workspace/.eslintrc.js | 8 + apps/workspace/.eslintrc.json | 31 ---- apps/workspace/app/api/hello/route.ts | 3 - apps/workspace/app/global.css | 4 +- apps/workspace/app/layout.tsx | 14 +- apps/workspace/app/page.tsx | 2 +- apps/workspace/index.d.ts | 6 +- apps/workspace/jest.config.ts | 6 +- apps/workspace/next.config.js | 31 ++-- apps/workspace/package.json | 30 +++ apps/workspace/tsconfig.json | 46 +---- apps/workspace/tsconfig.spec.json | 21 --- jest.config.ts | 5 - jest.preset.js | 2 - nx.json | 52 ------ package.json | 173 +++++------------- packages/.gitkeep | 0 packages/eslint-config-custom/next.js | 42 +++++ packages/eslint-config-custom/package.json | 11 ++ .../eslint-config-custom/react-internal.js | 39 ++++ packages/tsconfig/base.json | 21 +++ packages/tsconfig/nextjs.json | 21 +++ packages/tsconfig/package.json | 9 + packages/tsconfig/react-library.json | 11 ++ prettier.config.js | 3 + tsconfig.base.json | 26 --- turbo.json | 29 +++ 83 files changed, 756 insertions(+), 946 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.json create mode 100644 apps/api/.eslintrc.js delete mode 100644 apps/api/.eslintrc.json create mode 100644 apps/api/nest-cli.json create mode 100644 apps/api/package.json delete mode 100644 apps/api/project.json create mode 100644 apps/api/tsconfig.build.json create mode 100644 apps/web/.eslintrc.js delete mode 100644 apps/web/.eslintrc.json delete mode 100644 apps/web/app/api/hello/route.ts delete mode 100644 apps/web/components/Killers.tsx delete mode 100644 apps/web/components/Links.tsx create mode 100644 apps/web/components/killers.tsx create mode 100644 apps/web/components/links.tsx delete mode 100644 apps/web/jest.config.ts create mode 100644 apps/web/package.json delete mode 100644 apps/web/project.json delete mode 100644 apps/web/tsconfig.spec.json create mode 100644 apps/workspace/.eslintrc.js delete mode 100644 apps/workspace/.eslintrc.json delete mode 100644 apps/workspace/app/api/hello/route.ts create mode 100644 apps/workspace/package.json delete mode 100644 apps/workspace/tsconfig.spec.json delete mode 100644 jest.config.ts delete mode 100644 nx.json delete mode 100644 packages/.gitkeep create mode 100644 packages/eslint-config-custom/next.js create mode 100644 packages/eslint-config-custom/package.json create mode 100644 packages/eslint-config-custom/react-internal.js create mode 100644 packages/tsconfig/base.json create mode 100644 packages/tsconfig/nextjs.json create mode 100644 packages/tsconfig/package.json create mode 100644 packages/tsconfig/react-library.json create mode 100644 prettier.config.js delete mode 100644 tsconfig.base.json create mode 100644 turbo.json diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 3c3629e6..00000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index f3f431e9..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "root": true, - "ignorePatterns": ["**/*"], - "plugins": ["@nx"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": { - "@nx/enforce-module-boundaries": [ - "error", - { - "enforceBuildableLibDependency": true, - "allow": [], - "depConstraints": [ - { - "sourceTag": "*", - "onlyDependOnLibsWithTags": ["*"] - } - ] - } - ] - } - }, - { - "files": ["*.ts", "*.tsx"], - "extends": ["plugin:@nx/typescript"], - "rules": { - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/no-unused-vars": "warn", - "@typescript-eslint/no-unused-expressions": "warn" - } - }, - { - "files": ["*.js", "*.jsx"], - "extends": ["plugin:@nx/javascript"], - "rules": {} - }, - { - "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], - "env": { - "jest": true - }, - "rules": {} - }, - { - "files": ["{package,project}.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/dependency-checks": [ - "warn", - { - "checkMissingDependencies": true, - "checkObsoleteDependencies": true, - "checkVersionMismatches": true - } - ] - } - } - ] -} diff --git a/.github/workflows/stage-api.yml b/.github/workflows/stage-api.yml index 13488fc5..707b79a8 100644 --- a/.github/workflows/stage-api.yml +++ b/.github/workflows/stage-api.yml @@ -6,6 +6,7 @@ on: env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + DATABASE_URL: ${{ secrets.DATABASE_URL }} jobs: deploy-api-stage: @@ -20,4 +21,4 @@ jobs: run: | curl -L https://fly.io/install.sh | sh - name: Deploy to stage - run: ~/.fly/bin/fly deploy --config fly.api.toml --dockerfile ./apps/api/Dockerfile --app keyshade-api-stage --access-token ${{ secrets.FLY_ACCESS_TOKEN }} --build-arg SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} --build-arg SENTRY_PROJECT=keyshade-api --build-arg SENTRY_ORG=keyshade --build-arg SENTRY_ENVIRONMENT=stage + run: ~/.fly/bin/fly deploy --config fly.api.toml --dockerfile ./apps/api/Dockerfile --app keyshade-api-stage --access-token ${{ secrets.FLY_ACCESS_TOKEN }} --build-arg SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} --build-arg SENTRY_PROJECT=keyshade-api --build-arg SENTRY_ORG=keyshade --build-arg SENTRY_ENVIRONMENT=stage --build-arg DATABASE_URL=${DATABASE_URL} diff --git a/.gitignore b/.gitignore index 327d76e7..6086f4f1 100644 --- a/.gitignore +++ b/.gitignore @@ -39,8 +39,6 @@ testem.log .DS_Store Thumbs.db -.nx/cache - # Next.js .next .vscode @@ -49,9 +47,12 @@ Thumbs.db pnpm-lock.yaml # Database -data/ +/data # Sentry Config File .sentryclirc # Sentry Config File .env.sentry-build-plugin + +# turbo +.turbo \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index dd83bc3e..d522362e 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -pnpm run lint:fix && pnpm run prettier:fix && pnpm run test:api \ No newline at end of file +pnpm lint && pnpm format && pnpm test:api \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index b7ce5ef0..84b56355 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,6 @@ # Add files here to ignore them from prettier formatting /dist /coverage -/.nx/cache -auto-changelog-template.hbs \ No newline at end of file +/data +/node_modules +.turbo \ No newline at end of file diff --git a/apps/api/.eslintrc.js b/apps/api/.eslintrc.js new file mode 100644 index 00000000..259de13c --- /dev/null +++ b/apps/api/.eslintrc.js @@ -0,0 +1,25 @@ +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: __dirname, + sourceType: 'module', + }, + plugins: ['@typescript-eslint/eslint-plugin'], + extends: [ + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', + ], + root: true, + env: { + node: true, + jest: true, + }, + ignorePatterns: ['.eslintrc.js'], + rules: { + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-explicit-any': 'off', + }, +}; diff --git a/apps/api/.eslintrc.json b/apps/api/.eslintrc.json deleted file mode 100644 index 9d9c0db5..00000000 --- a/apps/api/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index b121b720..b7f17afa 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -2,27 +2,31 @@ FROM node:20-alpine AS build WORKDIR /app -RUN apk add --no-cache bash +ARG SENTRY_ORG=${SENTRY_ORG} +ARG SENTRY_PROJECT=${SENTRY_PROJECT} +ARG SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT} +ARG SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} +ARG DATABASE_URL=${DATABASE_URL} + RUN npm i -g pnpm COPY package.json . -COPY tsconfig.base.json . +COPY turbo.json . +COPY pnpm-workspace.yaml . -RUN pnpm install +COPY apps/api/package.json apps/api/package.json +COPY apps/api/tsconfig.json apps/api/tsconfig.json -COPY apps/api apps/api +COPY apps/api/src apps/api/src -COPY apps/api/startup.sh . -RUN chmod +x startup.sh +COPY packages packages -ARG SENTRY_ORG=${SENTRY_ORG} -ARG SENTRY_PROJECT=${SENTRY_PROJECT} -ARG SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT} -ARG SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} +RUN pnpm install -RUN pnpm run db:generate-types -RUN pnpm run build:api +RUN pnpm db:generate-types +RUN pnpm build:api +RUN pnpm sourcemaps:api EXPOSE 4200 -ENTRYPOINT ["/bin/bash", "startup.sh"] \ No newline at end of file +ENTRYPOINT ["node", "apps/api/dist/main.js"] \ No newline at end of file diff --git a/apps/api/nest-cli.json b/apps/api/nest-cli.json new file mode 100644 index 00000000..bf3b6624 --- /dev/null +++ b/apps/api/nest-cli.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json.schemastore.org/nest-cli", + "collection": "@nestjs/schematics", + "sourceRoot": "src", + "compilerOptions": { + "deleteOutDir": true + }, + "entryFile": "main.js" +} diff --git a/apps/api/package.json b/apps/api/package.json new file mode 100644 index 00000000..1620011a --- /dev/null +++ b/apps/api/package.json @@ -0,0 +1,85 @@ +{ + "name": "api", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "nest build", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "start": "node dist/main", + "dev": "nest start --watch", + "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "test": "jest", + "sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist || echo 'Failed to upload source maps to Sentry'" + }, + "dependencies": { + "@nestjs/common": "^10.0.0", + "@nestjs/config": "^3.2.0", + "@nestjs/core": "^10.0.0", + "@nestjs/jwt": "^10.2.0", + "@nestjs/passport": "^10.0.3", + "@nestjs/platform-express": "^10.0.0", + "@nestjs/platform-fastify": "^10.3.3", + "@nestjs/schedule": "^4.0.1", + "@nestjs/swagger": "^7.3.0", + "@prisma/client": "^5.10.1", + "@supabase/supabase-js": "^2.39.6", + "chalk": "^4.1.2", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.1", + "eccrypto": "^1.1.6", + "moment": "^2.30.1", + "nodemailer": "^6.9.9", + "passport-github2": "^0.1.12", + "prisma": "^5.10.1", + "reflect-metadata": "^0.2.0", + "rxjs": "^7.8.1", + "uuid": "^9.0.1" + }, + "devDependencies": { + "@nestjs/cli": "^10.0.0", + "@nestjs/schematics": "^10.0.0", + "@nestjs/testing": "^10.0.0", + "@types/eccrypto": "^1.1.6", + "@types/express": "^4.17.17", + "@types/jest": "^29.5.2", + "@types/node": "^20.3.1", + "@types/supertest": "^6.0.0", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", + "eslint": "^8.42.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^5.0.0", + "jest": "^29.5.0", + "jest-mock-extended": "^3.0.5", + "prettier": "^3.0.0", + "source-map-support": "^0.5.21", + "supertest": "^6.3.3", + "ts-jest": "^29.1.0", + "ts-loader": "^9.4.3", + "ts-node": "^10.9.1", + "tsconfig-paths": "^4.2.0", + "typescript": "^5.1.3" + }, + "jest": { + "moduleFileExtensions": [ + "js", + "json", + "ts" + ], + "rootDir": "src", + "testRegex": ".*\\.spec\\.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + }, + "collectCoverageFrom": [ + "**/*.(t|j)s" + ], + "coverageDirectory": "../coverage", + "testEnvironment": "node" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/apps/api/project.json b/apps/api/project.json deleted file mode 100644 index dc984dde..00000000 --- a/apps/api/project.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "name": "api", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/api/src", - "projectType": "application", - "targets": { - "build": { - "executor": "@nx/webpack:webpack", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "production", - "options": { - "target": "node", - "compiler": "tsc", - "outputPath": "dist/apps/api", - "main": "apps/api/src/main.ts", - "tsConfig": "apps/api/tsconfig.app.json", - "webpackConfig": "apps/api/webpack.config.js" - }, - "configurations": { - "development": {}, - "production": {} - } - }, - "serve": { - "executor": "@nx/js:node", - "defaultConfiguration": "development", - "options": { - "buildTarget": "api:build" - }, - "configurations": { - "development": { - "buildTarget": "api:build:development" - }, - "production": { - "buildTarget": "api:build:production" - } - } - }, - "lint": { - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": [ - "apps/api/**/*.ts", - "apps/api/package.json", - "apps/api/project.json" - ] - } - }, - "prettier:fix": { - "command": "pnpx prettier -w .", - "options": { - "cwd": "apps/api" - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "apps/api/jest.config.ts" - } - }, - "test:e2e": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage-e2e/{projectRoot}"], - "options": { - "runInBand": true, - "devServerTarget": "api:serve", - "jestConfig": "apps/api/jest.e2e-config.ts" - }, - "configurations": { - "development": { - "devServerTarget": "api:serve:development" - } - } - }, - "prisma:generate": { - "command": "prisma generate", - "options": { - "cwd": "apps/api/src/prisma" - } - }, - "prisma:format": { - "command": "prisma format", - "options": { - "cwd": "apps/api/src/prisma" - } - }, - "prisma:validate": { - "command": "prisma validate", - "options": { - "cwd": "apps/api/src/prisma" - } - }, - "prisma:reset": { - "command": "prisma migrate reset --force", - "options": { - "cwd": "apps/api/src/prisma" - } - } - }, - "tags": [] -} diff --git a/apps/api/src/api-key/dto/create.api-key/create.api-key.spec.ts b/apps/api/src/api-key/dto/create.api-key/create.api-key.spec.ts index c862c808..cba82381 100644 --- a/apps/api/src/api-key/dto/create.api-key/create.api-key.spec.ts +++ b/apps/api/src/api-key/dto/create.api-key/create.api-key.spec.ts @@ -1,7 +1,7 @@ -import { CreateApiKey } from './create.api-key'; +import { CreateApiKey } from './create.api-key' describe('CreateApiKey', () => { it('should be defined', () => { - expect(new CreateApiKey()).toBeDefined(); - }); -}); + expect(new CreateApiKey()).toBeDefined() + }) +}) diff --git a/apps/api/src/api-key/dto/update.api-key/update.api-key.spec.ts b/apps/api/src/api-key/dto/update.api-key/update.api-key.spec.ts index cb98ad4c..60cbbaa5 100644 --- a/apps/api/src/api-key/dto/update.api-key/update.api-key.spec.ts +++ b/apps/api/src/api-key/dto/update.api-key/update.api-key.spec.ts @@ -1,7 +1,7 @@ -import { UpdateApiKey } from './update.api-key'; +import { UpdateApiKey } from './update.api-key' describe('UpdateApiKey', () => { it('should be defined', () => { - expect(new UpdateApiKey()).toBeDefined(); - }); -}); + expect(new UpdateApiKey()).toBeDefined() + }) +}) diff --git a/apps/api/src/auth/guard/auth/auth.guard.ts b/apps/api/src/auth/guard/auth/auth.guard.ts index 779418d9..7baced91 100644 --- a/apps/api/src/auth/guard/auth/auth.guard.ts +++ b/apps/api/src/auth/guard/auth/auth.guard.ts @@ -145,6 +145,9 @@ export class AuthGuard implements CanActivate { } private extractApiKeyFromHeader(request: Request): string | undefined { + if (Array.isArray(request.headers[X_KEYSHADE_TOKEN])) { + throw new Error('Bad auth') + } return request.headers[X_KEYSHADE_TOKEN] } } diff --git a/apps/api/src/common/create-key-pair.ts b/apps/api/src/common/create-key-pair.ts index 46eecbd7..05665c08 100644 --- a/apps/api/src/common/create-key-pair.ts +++ b/apps/api/src/common/create-key-pair.ts @@ -1,4 +1,4 @@ -import eccrypto from 'eccrypto' +import * as eccrypto from 'eccrypto' export const createKeyPair = (): { publicKey: string diff --git a/apps/api/src/common/decrypt.ts b/apps/api/src/common/decrypt.ts index 906ef486..29a6417f 100644 --- a/apps/api/src/common/decrypt.ts +++ b/apps/api/src/common/decrypt.ts @@ -1,4 +1,4 @@ -import eccrypto from 'eccrypto' +import * as eccrypto from 'eccrypto' export const decrypt = async ( privateKey: string, diff --git a/apps/api/src/common/encrypt.ts b/apps/api/src/common/encrypt.ts index f82a17e5..3a043c62 100644 --- a/apps/api/src/common/encrypt.ts +++ b/apps/api/src/common/encrypt.ts @@ -1,4 +1,4 @@ -import eccrypto from 'eccrypto' +import * as eccrypto from 'eccrypto' export const encrypt = async ( publicKey: string, diff --git a/apps/api/src/common/fetch-events.ts b/apps/api/src/common/fetch-events.ts index de40a9e6..18f8e178 100644 --- a/apps/api/src/common/fetch-events.ts +++ b/apps/api/src/common/fetch-events.ts @@ -5,7 +5,7 @@ export default async function fetchEvents( app: NestFastifyApplication, user: User, query?: string -) { +): Promise { return app.inject({ method: 'GET', headers: { diff --git a/apps/api/src/common/query.transform.pipe.spec.ts b/apps/api/src/common/query.transform.pipe.spec.ts index f178f1e6..c76a47d5 100644 --- a/apps/api/src/common/query.transform.pipe.spec.ts +++ b/apps/api/src/common/query.transform.pipe.spec.ts @@ -1,7 +1,7 @@ -import { QueryTransformPipe } from './query.transform.pipe'; +import { QueryTransformPipe } from './query.transform.pipe' describe('QueryTransformPipe', () => { it('should be defined', () => { - expect(new QueryTransformPipe()).toBeDefined(); - }); -}); + expect(new QueryTransformPipe()).toBeDefined() + }) +}) diff --git a/apps/api/src/environment/dto/create.environment/create.environment.spec.ts b/apps/api/src/environment/dto/create.environment/create.environment.spec.ts index 1d1bfde2..b8c824ac 100644 --- a/apps/api/src/environment/dto/create.environment/create.environment.spec.ts +++ b/apps/api/src/environment/dto/create.environment/create.environment.spec.ts @@ -1,7 +1,7 @@ -import { CreateEnvironment } from './create.environment'; +import { CreateEnvironment } from './create.environment' describe('CreateEnvironment', () => { it('should be defined', () => { - expect(new CreateEnvironment()).toBeDefined(); - }); -}); + expect(new CreateEnvironment()).toBeDefined() + }) +}) diff --git a/apps/api/src/environment/dto/update.environment/update.environment.spec.ts b/apps/api/src/environment/dto/update.environment/update.environment.spec.ts index fa14f081..4be0994c 100644 --- a/apps/api/src/environment/dto/update.environment/update.environment.spec.ts +++ b/apps/api/src/environment/dto/update.environment/update.environment.spec.ts @@ -1,7 +1,7 @@ -import { UpdateEnvironment } from './update.environment'; +import { UpdateEnvironment } from './update.environment' describe('UpdateEnvironment', () => { it('should be defined', () => { - expect(new UpdateEnvironment()).toBeDefined(); - }); -}); + expect(new UpdateEnvironment()).toBeDefined() + }) +}) diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 21c09c02..fe324062 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -7,8 +7,8 @@ import { Logger, LoggerService, ValidationPipe } from '@nestjs/common' import { NestFactory } from '@nestjs/core' import { AppModule } from './app/app.module' -import chalk from 'chalk' -import moment from 'moment' +import * as chalk from 'chalk' +import * as moment from 'moment' import { QueryTransformPipe } from './common/query.transform.pipe' import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger' import * as Sentry from '@sentry/node' diff --git a/apps/api/src/project/dto/create.project/create.project.spec.ts b/apps/api/src/project/dto/create.project/create.project.spec.ts index 458a7d51..bd189bc7 100644 --- a/apps/api/src/project/dto/create.project/create.project.spec.ts +++ b/apps/api/src/project/dto/create.project/create.project.spec.ts @@ -1,7 +1,7 @@ -import { CreateProject } from './create.project'; +import { CreateProject } from './create.project' describe('CreateProject', () => { it('should be defined', () => { - expect(new CreateProject()).toBeDefined(); - }); -}); + expect(new CreateProject()).toBeDefined() + }) +}) diff --git a/apps/api/src/project/dto/update.project/update.project.spec.ts b/apps/api/src/project/dto/update.project/update.project.spec.ts index b4d5cb57..295ed909 100644 --- a/apps/api/src/project/dto/update.project/update.project.spec.ts +++ b/apps/api/src/project/dto/update.project/update.project.spec.ts @@ -1,7 +1,7 @@ -import { UpdateProject } from './update.project'; +import { UpdateProject } from './update.project' describe('UpdateProject', () => { it('should be defined', () => { - expect(new UpdateProject()).toBeDefined(); - }); -}); + expect(new UpdateProject()).toBeDefined() + }) +}) diff --git a/apps/api/src/project/project.e2e.spec.ts b/apps/api/src/project/project.e2e.spec.ts index d33483bc..ed839975 100644 --- a/apps/api/src/project/project.e2e.spec.ts +++ b/apps/api/src/project/project.e2e.spec.ts @@ -48,6 +48,8 @@ describe('Project Controller Tests', () => { await app.init() await app.getHttpAdapter().getInstance().ready() + await cleanUp(prisma) + const workspace1Id = v4() const workspace2Id = v4() const workspace1AdminRoleId = v4() @@ -66,7 +68,7 @@ describe('Project Controller Tests', () => { const createUser2 = prisma.user.create({ data: { id: user2Id, - email: 'janedoe@keyshade.xyz', + email: 'jane@keyshade.xyz', name: 'Jane Doe', isOnboardingFinished: true } diff --git a/apps/api/src/secret/dto/create.secret/create.secret.spec.ts b/apps/api/src/secret/dto/create.secret/create.secret.spec.ts index e90e3cec..5e6e1245 100644 --- a/apps/api/src/secret/dto/create.secret/create.secret.spec.ts +++ b/apps/api/src/secret/dto/create.secret/create.secret.spec.ts @@ -1,7 +1,7 @@ -import { CreateSecret } from './create.secret'; +import { CreateSecret } from './create.secret' describe('CreateSecret', () => { it('should be defined', () => { - expect(new CreateSecret()).toBeDefined(); - }); -}); + expect(new CreateSecret()).toBeDefined() + }) +}) diff --git a/apps/api/src/secret/dto/update.secret/update.secret.spec.ts b/apps/api/src/secret/dto/update.secret/update.secret.spec.ts index 21548bd5..c26fcf32 100644 --- a/apps/api/src/secret/dto/update.secret/update.secret.spec.ts +++ b/apps/api/src/secret/dto/update.secret/update.secret.spec.ts @@ -1,7 +1,7 @@ -import { UpdateSecret } from './update.secret'; +import { UpdateSecret } from './update.secret' describe('UpdateSecret', () => { it('should be defined', () => { - expect(new UpdateSecret()).toBeDefined(); - }); -}); + expect(new UpdateSecret()).toBeDefined() + }) +}) diff --git a/apps/api/src/variable/dto/create.variable/create.variable.spec.ts b/apps/api/src/variable/dto/create.variable/create.variable.spec.ts index 784e711f..1b0433cc 100644 --- a/apps/api/src/variable/dto/create.variable/create.variable.spec.ts +++ b/apps/api/src/variable/dto/create.variable/create.variable.spec.ts @@ -1,7 +1,7 @@ -import { CreateVariable } from './create.variable'; +import { CreateVariable } from './create.variable' describe('CreateVariable', () => { it('should be defined', () => { - expect(new CreateVariable()).toBeDefined(); - }); -}); + expect(new CreateVariable()).toBeDefined() + }) +}) diff --git a/apps/api/src/variable/dto/update.variable/update.variable.spec.ts b/apps/api/src/variable/dto/update.variable/update.variable.spec.ts index 3a1daeed..3f71a503 100644 --- a/apps/api/src/variable/dto/update.variable/update.variable.spec.ts +++ b/apps/api/src/variable/dto/update.variable/update.variable.spec.ts @@ -1,7 +1,7 @@ -import { UpdateVariable } from './update.variable'; +import { UpdateVariable } from './update.variable' describe('UpdateVariable', () => { it('should be defined', () => { - expect(new UpdateVariable()).toBeDefined(); - }); -}); + expect(new UpdateVariable()).toBeDefined() + }) +}) diff --git a/apps/api/src/workspace-role/dto/create-workspace-role/create-workspace-role.spec.ts b/apps/api/src/workspace-role/dto/create-workspace-role/create-workspace-role.spec.ts index c51d7e08..d1230768 100644 --- a/apps/api/src/workspace-role/dto/create-workspace-role/create-workspace-role.spec.ts +++ b/apps/api/src/workspace-role/dto/create-workspace-role/create-workspace-role.spec.ts @@ -1,7 +1,7 @@ -import { CreateWorkspaceRole } from './create-workspace-role'; +import { CreateWorkspaceRole } from './create-workspace-role' describe('CreateWorkspaceRole', () => { it('should be defined', () => { - expect(new CreateWorkspaceRole()).toBeDefined(); - }); -}); + expect(new CreateWorkspaceRole()).toBeDefined() + }) +}) diff --git a/apps/api/src/workspace-role/dto/update-workspace-role/update-workspace-role.spec.ts b/apps/api/src/workspace-role/dto/update-workspace-role/update-workspace-role.spec.ts index 5f0a2eae..e66770fd 100644 --- a/apps/api/src/workspace-role/dto/update-workspace-role/update-workspace-role.spec.ts +++ b/apps/api/src/workspace-role/dto/update-workspace-role/update-workspace-role.spec.ts @@ -1,7 +1,7 @@ -import { UpdateWorkspaceRole } from './update-workspace-role'; +import { UpdateWorkspaceRole } from './update-workspace-role' describe('UpdateWorkspaceRole', () => { it('should be defined', () => { - expect(new UpdateWorkspaceRole()).toBeDefined(); - }); -}); + expect(new UpdateWorkspaceRole()).toBeDefined() + }) +}) diff --git a/apps/api/src/workspace/dto/create.workspace/create.workspace.spec.ts b/apps/api/src/workspace/dto/create.workspace/create.workspace.spec.ts index 406ee040..143a7b45 100644 --- a/apps/api/src/workspace/dto/create.workspace/create.workspace.spec.ts +++ b/apps/api/src/workspace/dto/create.workspace/create.workspace.spec.ts @@ -1,7 +1,7 @@ -import { CreateWorkspace } from './create.workspace'; +import { CreateWorkspace } from './create.workspace' describe('CreateWorkspace', () => { it('should be defined', () => { - expect(new CreateWorkspace()).toBeDefined(); - }); -}); + expect(new CreateWorkspace()).toBeDefined() + }) +}) diff --git a/apps/api/src/workspace/dto/update.workspace/update.workspace.spec.ts b/apps/api/src/workspace/dto/update.workspace/update.workspace.spec.ts index 2f35e047..c1b9a880 100644 --- a/apps/api/src/workspace/dto/update.workspace/update.workspace.spec.ts +++ b/apps/api/src/workspace/dto/update.workspace/update.workspace.spec.ts @@ -1,7 +1,7 @@ -import { UpdateWorkspace } from './update.workspace'; +import { UpdateWorkspace } from './update.workspace' describe('UpdateWorkspace', () => { it('should be defined', () => { - expect(new UpdateWorkspace()).toBeDefined(); - }); -}); + expect(new UpdateWorkspace()).toBeDefined() + }) +}) diff --git a/apps/api/src/workspace/workspace.e2e.spec.ts b/apps/api/src/workspace/workspace.e2e.spec.ts index ca0f83c4..382a0eec 100644 --- a/apps/api/src/workspace/workspace.e2e.spec.ts +++ b/apps/api/src/workspace/workspace.e2e.spec.ts @@ -68,6 +68,8 @@ describe('Workspace Controller Tests', () => { await app.init() await app.getHttpAdapter().getInstance().ready() + await cleanUp(prisma) + const createUser1 = prisma.user.create({ data: { email: 'johndoe@keyshade.xyz', @@ -78,7 +80,7 @@ describe('Workspace Controller Tests', () => { const createUser2 = prisma.user.create({ data: { - email: 'janedoe@keyshade.xyz', + email: 'jane@keyshade.xyz', name: 'Jane Doe', isOnboardingFinished: true } diff --git a/apps/api/tsconfig.app.json b/apps/api/tsconfig.app.json index 8e277f05..c959ca9d 100644 --- a/apps/api/tsconfig.app.json +++ b/apps/api/tsconfig.app.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "dist/out-tsc", "module": "commonjs", "types": ["node"], "emitDecoratorMetadata": true, diff --git a/apps/api/tsconfig.build.json b/apps/api/tsconfig.build.json new file mode 100644 index 00000000..6208d1a1 --- /dev/null +++ b/apps/api/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], +} diff --git a/apps/api/tsconfig.json b/apps/api/tsconfig.json index c1e2dd4e..000fbb17 100644 --- a/apps/api/tsconfig.json +++ b/apps/api/tsconfig.json @@ -1,16 +1,21 @@ { - "extends": "../../tsconfig.base.json", - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - } - ], "compilerOptions": { - "esModuleInterop": true + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "target": "ES2021", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true, + "skipLibCheck": true, + "strictNullChecks": false, + "noImplicitAny": false, + "strictBindCallApply": false, + "forceConsistentCasingInFileNames": false, + "noFallthroughCasesInSwitch": false } -} +} \ No newline at end of file diff --git a/apps/api/tsconfig.spec.json b/apps/api/tsconfig.spec.json index 02deb734..23919ca9 100644 --- a/apps/api/tsconfig.spec.json +++ b/apps/api/tsconfig.spec.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "dist/out-tsc", "module": "commonjs", "types": ["jest", "node"] }, diff --git a/apps/web/.eslintrc.js b/apps/web/.eslintrc.js new file mode 100644 index 00000000..0aa26fe8 --- /dev/null +++ b/apps/web/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['custom/next'], + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: __dirname, + sourceType: 'module' + } +} diff --git a/apps/web/.eslintrc.json b/apps/web/.eslintrc.json deleted file mode 100644 index a4278124..00000000 --- a/apps/web/.eslintrc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "extends": [ - "plugin:@nx/react-typescript", - "next", - "next/core-web-vitals", - "../../.eslintrc.json" - ], - "ignorePatterns": ["!**/*", ".next/**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": { - "@next/next/no-html-link-for-pages": ["error", "apps/web/pages"] - } - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], - "env": { - "jest": true - } - } - ] -} diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 0ad25673..36176c4d 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -4,12 +4,19 @@ WORKDIR /app RUN npm i -g pnpm -COPY package.json . -COPY tsconfig.base.json . +# COPY package.json . +COPY turbo.json . +COPY pnpm-workspace.yaml . +COPY pnpm-lock.yaml . +COPY package*.json . +COPY ./packages ./packages + +COPY apps/web/package.json apps/web/package.json +COPY apps/web/tsconfig.json apps/web/tsconfig.json RUN pnpm install -COPY apps/web apps/web +COPY . . RUN pnpm run build:web diff --git a/apps/web/app/api/hello/route.ts b/apps/web/app/api/hello/route.ts deleted file mode 100644 index de70bac6..00000000 --- a/apps/web/app/api/hello/route.ts +++ /dev/null @@ -1,3 +0,0 @@ -export async function GET(request: Request) { - return new Response('Hello, from API!'); -} diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index 3eeff0a8..058309d7 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,64 +1,65 @@ -import './global.css'; -import { Metadata } from "next"; +import './global.css' +import type { Metadata } from 'next' -const description = "Manage all your secrets securely with public key encryption and realtime based tools, that seamlessly fits into your codebase"; -const name = "keyshade"; +const description = + 'Manage all your secrets securely with public key encryption and realtime based tools, that seamlessly fits into your codebase' +const name = 'keyshade' export const metadata: Metadata = { - metadataBase: new URL("https://keyshade.xyz/"), + metadataBase: new URL('https://keyshade.xyz/'), title: { default: name, - template: `%s | ${name}`, + template: `%s | ${name}` }, - description: description, + description, keywords: [ - "Keyshade", - "secrets integration", - "codebase security", - "Public Key Encryption", - "secret rotation", - "auto revoke", - "collaboration", - "data security", - "secrets management", - "secure code secrets", - "realtime secrets integration", - "encryption for secrets", - "automated secret rotation", - "team collaboration secrets", - "secure runtime environment", - "secrets management tool", - "codebase security solution", - "cybersecurity for secrets", - "API security", - "key management", - "secure data transfer", - "secure secrets sharing", - "effortless secrets management", - "Keyshade features", - "cybersecurity solution", - "secure software development", - "automated access revocation", - "secure secrets storage", - "developer tools security", - "API key security", - "codebase encryption", - "team-based secrets management" + 'Keyshade', + 'secrets integration', + 'codebase security', + 'Public Key Encryption', + 'secret rotation', + 'auto revoke', + 'collaboration', + 'data security', + 'secrets management', + 'secure code secrets', + 'realtime secrets integration', + 'encryption for secrets', + 'automated secret rotation', + 'team collaboration secrets', + 'secure runtime environment', + 'secrets management tool', + 'codebase security solution', + 'cybersecurity for secrets', + 'API security', + 'key management', + 'secure data transfer', + 'secure secrets sharing', + 'effortless secrets management', + 'Keyshade features', + 'cybersecurity solution', + 'secure software development', + 'automated access revocation', + 'secure secrets storage', + 'developer tools security', + 'API key security', + 'codebase encryption', + 'team-based secrets management' ], applicationName: name, openGraph: { title: name, - description: description, - type: "website", - locale: "en_US", - images: "https://keyshade.xyz/thumbnail.png", + description, + type: 'website', + locale: 'en_US', + images: 'https://keyshade.xyz/thumbnail.png' }, twitter: { - card: "summary_large_image", + card: 'summary_large_image', title: name, - description: description, - creator: "@keyshade_xyz", - creatorId: "1738929014016966656", + description, + creator: '@keyshade_xyz', + creatorId: '1738929014016966656' }, robots: { index: true, @@ -67,18 +68,18 @@ export const metadata: Metadata = { nocache: true, googleBot: { index: true, - follow: true, - }, - }, -}; + follow: true + } + } +} export default function RootLayout({ - children, + children }: { - children: React.ReactNode; -}) { + children: React.ReactNode +}): React.JSX.Element { return ( {children} - ); + ) } diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index cc44de69..dab394e7 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -1,13 +1,14 @@ import { Poppins } from 'next/font/google' -import Links from '../components/Links' -import Killers from '../components/Killers' +import Links from '../components/links' +import Killers from '../components/killers' import { Logo, Grid, Stars } from '../public' + const poppins = Poppins({ subsets: ['latin'], weight: ['400', '500', '600', '700'] }) -function Index() { +function Index(): React.JSX.Element { return (
@@ -35,13 +36,13 @@ function Index() {
diff --git a/apps/web/components/Killers.tsx b/apps/web/components/Killers.tsx deleted file mode 100644 index 9bfcab82..00000000 --- a/apps/web/components/Killers.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import Image from "next/image" -import { Inter } from "next/font/google" -const inter = Inter({ subsets: ['latin'] }) - -type KillersProps = { - image: string - twitterUserName: string -} -const Killers = ({ image, twitterUserName }: KillersProps) => { - return ( -
-
- {`${image}`} -
- -
- ) -} - -export default Killers \ No newline at end of file diff --git a/apps/web/components/Links.tsx b/apps/web/components/Links.tsx deleted file mode 100644 index 0acdfd40..00000000 --- a/apps/web/components/Links.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import Image from "next/image" -import { Inter } from "next/font/google" -const inter = Inter({ subsets: ['latin'] }) -type LinksProps = { - icon: string - description: string - link: string -} - - -const Links = ({ icon, description, link }: LinksProps) => { - return ( - -
- {`${icon}`} -

{description}

-
-
- ) -} - -export default Links \ No newline at end of file diff --git a/apps/web/components/killers.tsx b/apps/web/components/killers.tsx new file mode 100644 index 00000000..a2b77c60 --- /dev/null +++ b/apps/web/components/killers.tsx @@ -0,0 +1,40 @@ +import Image from 'next/image' +import { Inter } from 'next/font/google' +import React from 'react' + +const inter = Inter({ subsets: ['latin'] }) + +interface KillersProps { + image: string + twitterUserName: string +} +function Killers({ image, twitterUserName }: KillersProps): React.JSX.Element { + return ( +
+
+ {image} +
+ +
+ ) +} + +export default Killers diff --git a/apps/web/components/links.tsx b/apps/web/components/links.tsx new file mode 100644 index 00000000..fe52b0ed --- /dev/null +++ b/apps/web/components/links.tsx @@ -0,0 +1,32 @@ +import Image from 'next/image' +import { Inter } from 'next/font/google' +import React from 'react' + +const inter = Inter({ subsets: ['latin'] }) +interface LinksProps { + icon: string + description: string + link: string +} + +function Links({ icon, description, link }: LinksProps): React.JSX.Element { + return ( + +
+ {icon} +

{description}

+
+
+ ) +} + +export default Links diff --git a/apps/web/index.d.ts b/apps/web/index.d.ts index 7ba08fa1..a9ab5348 100644 --- a/apps/web/index.d.ts +++ b/apps/web/index.d.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ declare module '*.svg' { - const content: any; - export const ReactComponent: any; - export default content; + const content: any + export const ReactComponent: any + export default content } diff --git a/apps/web/jest.config.ts b/apps/web/jest.config.ts deleted file mode 100644 index d84a5097..00000000 --- a/apps/web/jest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'web', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/apps/web', -}; diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 17994a2e..6631e2cc 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -1,33 +1,19 @@ -const { composePlugins, withNx } = require('@nx/next') - -/** - * @type {import('@nx/next/plugins/with-nx').WithNxOptions} - **/ +const path = require("node:path"); +/** @type {import('next').NextConfig} */ const nextConfig = { - distDir: 'dist/.next', webpack(config, { isServer }) { config.module.rules.push({ test: /\.svg$/, - use: ['@svgr/webpack'] - }) + use: ["@svgr/webpack"], + }); if (!isServer) { - // eslint-disable-next-line no-undef - // config.resolve.alias['@public'] = path.join(__dirname, 'public') + config.resolve.alias["@public"] = path.join(__dirname, "public"); } - return config + return config; }, - nx: { - // Set this to true if you would like to use SVGR - // See: https://github.com/gregberge/svgr - svgr: false - } -} - -const plugins = [ - // Add more Next.js plugins to this list if needed. - withNx -] + reactStrictMode: true, +}; -module.exports = composePlugins(...plugins)(nextConfig) +module.exports = nextConfig; \ No newline at end of file diff --git a/apps/web/package.json b/apps/web/package.json new file mode 100644 index 00000000..3f96fb40 --- /dev/null +++ b/apps/web/package.json @@ -0,0 +1,31 @@ +{ + "name": "web", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint --fix" + }, + "dependencies": { + "next": "^13.5.6", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@next/eslint-plugin-next": "^13.4.19", + "@svgr/webpack": "^8.1.0", + "@tailwindcss/forms": "^0.5.7", + "@types/jest": "^29.5.2", + "@types/node": "^17.0.12", + "@types/react": "^18.0.22", + "@types/react-dom": "^18.0.7", + "autoprefixer": "^10.4.16", + "eslint-config-custom": "workspace:*", + "postcss": "^8.4.31", + "tailwindcss": "^3.3.3", + "tsconfig": "workspace:*", + "typescript": "^4.5.3" + } +} diff --git a/apps/web/project.json b/apps/web/project.json deleted file mode 100644 index 87cef463..00000000 --- a/apps/web/project.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "web", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/web", - "projectType": "application", - "targets": { - "build": { - "executor": "@nx/next:build", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "production", - "options": { - "outputPath": "apps/web/dist" - } - }, - "serve": { - "executor": "@nx/next:server", - "defaultConfiguration": "development", - "options": { - "buildTarget": "web:build", - "dev": true, - "port": 3000 - }, - "configurations": { - "development": { - "buildTarget": "web:build:development", - "dev": true - }, - "production": { - "buildTarget": "web:build:production", - "dev": false - } - } - }, - "export": { - "executor": "@nx/next:export", - "options": { - "buildTarget": "web:build:production" - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "apps/web/jest.config.ts" - } - }, - "lint": { - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": [ - "apps/web/**/*.ts", - "apps/web/package.json", - "apps/web/project.json" - ] - } - } - }, - "tags": [] -} diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index e3131c80..5ef893ea 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -1,43 +1,12 @@ { - "extends": "../../tsconfig.base.json", + "extends": "tsconfig/nextjs.json", "compilerOptions": { - "jsx": "preserve", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "resolveJsonModule": true, - "isolatedModules": true, - "incremental": true, - "plugins": [ - { - "name": "next" - } - ], - "types": [ - "jest", - "node" - ] + "plugins": [{ "name": "next" }], + "paths": { + "@/*": ["./src/*"], + "@public/*": ["./public/*"] + } }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.jsx", - "../../apps/web/.next/types/**/*.ts", - "../../dist/apps/web/.next/types/**/*.ts", - "next-env.d.ts", - ".next/types/**/*.ts", - "../../apps/web/dist/.next/types/**/*.ts", - "dist/.next/types/**/*.ts", - "../../apps/web/dist/dist/.next/types/**/*.ts" - ], - "exclude": [ - "node_modules", - "jest.config.ts", - "src/**/*.spec.ts", - "src/**/*.test.ts" - ] -} + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/apps/web/tsconfig.spec.json b/apps/web/tsconfig.spec.json deleted file mode 100644 index 214b2cc2..00000000 --- a/apps/web/tsconfig.spec.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"], - "jsx": "react" - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/apps/workspace/.eslintrc.js b/apps/workspace/.eslintrc.js new file mode 100644 index 00000000..0aa26fe8 --- /dev/null +++ b/apps/workspace/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['custom/next'], + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: __dirname, + sourceType: 'module' + } +} diff --git a/apps/workspace/.eslintrc.json b/apps/workspace/.eslintrc.json deleted file mode 100644 index a2b33e0e..00000000 --- a/apps/workspace/.eslintrc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "extends": [ - "plugin:@nx/react-typescript", - "next", - "next/core-web-vitals", - "../../.eslintrc.json" - ], - "ignorePatterns": ["!**/*", ".next/**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": { - "@next/next/no-html-link-for-pages": ["error", "apps/workspace/pages"] - } - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], - "env": { - "jest": true - } - } - ] -} diff --git a/apps/workspace/app/api/hello/route.ts b/apps/workspace/app/api/hello/route.ts deleted file mode 100644 index de70bac6..00000000 --- a/apps/workspace/app/api/hello/route.ts +++ /dev/null @@ -1,3 +0,0 @@ -export async function GET(request: Request) { - return new Response('Hello, from API!'); -} diff --git a/apps/workspace/app/global.css b/apps/workspace/app/global.css index 501b0b12..6eda0976 100644 --- a/apps/workspace/app/global.css +++ b/apps/workspace/app/global.css @@ -3,6 +3,6 @@ @tailwind utilities; * { - margin: 0; - padding: 0; + background-color: #0B0D0F; + color: white; } diff --git a/apps/workspace/app/layout.tsx b/apps/workspace/app/layout.tsx index 26b3efaf..11ab6843 100644 --- a/apps/workspace/app/layout.tsx +++ b/apps/workspace/app/layout.tsx @@ -1,18 +1,18 @@ -import './global.css'; +import './global.css' export const metadata = { title: 'Welcome to apps/workspace', - description: 'Generated by create-nx-workspace', -}; + description: 'Generated by create-nx-workspace' +} export default function RootLayout({ - children, + children }: { - children: React.ReactNode; -}) { + children: React.ReactNode +}): React.JSX.Element { return ( {children} - ); + ) } diff --git a/apps/workspace/app/page.tsx b/apps/workspace/app/page.tsx index aaca5797..e6b5cf02 100644 --- a/apps/workspace/app/page.tsx +++ b/apps/workspace/app/page.tsx @@ -1,3 +1,3 @@ -export default async function Index() { +export default function Index(): React.JSX.Element { return
Workspace
} diff --git a/apps/workspace/index.d.ts b/apps/workspace/index.d.ts index 7ba08fa1..a9ab5348 100644 --- a/apps/workspace/index.d.ts +++ b/apps/workspace/index.d.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ declare module '*.svg' { - const content: any; - export const ReactComponent: any; - export default content; + const content: any + export const ReactComponent: any + export default content } diff --git a/apps/workspace/jest.config.ts b/apps/workspace/jest.config.ts index 3ab0f4eb..b3b66183 100644 --- a/apps/workspace/jest.config.ts +++ b/apps/workspace/jest.config.ts @@ -4,8 +4,8 @@ export default { preset: '../../jest.preset.js', transform: { '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }], + '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }] }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/apps/workspace', -}; + coverageDirectory: '../../coverage/apps/workspace' +} diff --git a/apps/workspace/next.config.js b/apps/workspace/next.config.js index 007b2aa5..ac068f26 100644 --- a/apps/workspace/next.config.js +++ b/apps/workspace/next.config.js @@ -1,22 +1,19 @@ -//@ts-check +const path = require("node:path"); +/** @type {import('next').NextConfig} */ +const nextConfig = { + webpack(config, { isServer }) { + config.module.rules.push({ + test: /\.svg$/, + use: ["@svgr/webpack"], + }); -// eslint-disable-next-line @typescript-eslint/no-var-requires -const { composePlugins, withNx } = require('@nx/next'); + if (!isServer) { + config.resolve.alias["@public"] = path.join(__dirname, "public"); + } -/** - * @type {import('@nx/next/plugins/with-nx').WithNxOptions} - **/ -const nextConfig = { - nx: { - // Set this to true if you would like to use SVGR - // See: https://github.com/gregberge/svgr - svgr: false, + return config; }, + reactStrictMode: true, }; -const plugins = [ - // Add more Next.js plugins to this list if needed. - withNx, -]; - -module.exports = composePlugins(...plugins)(nextConfig); +module.exports = nextConfig; diff --git a/apps/workspace/package.json b/apps/workspace/package.json new file mode 100644 index 00000000..ab92e71d --- /dev/null +++ b/apps/workspace/package.json @@ -0,0 +1,30 @@ +{ + "name": "workspace", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint --fix" + }, + "dependencies": { + "next": "^13.4.19", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@next/eslint-plugin-next": "^13.4.19", + "@svgr/webpack": "^8.1.0", + "@tailwindcss/forms": "^0.5.7", + "@types/node": "^17.0.12", + "@types/react": "^18.0.22", + "@types/react-dom": "^18.0.7", + "autoprefixer": "^10.4.16", + "postcss": "^8.4.31", + "tailwindcss": "^3.3.3", + "typescript": "^4.5.3", + "eslint-config-custom": "workspace:*", + "tsconfig": "workspace:*" + } +} \ No newline at end of file diff --git a/apps/workspace/tsconfig.json b/apps/workspace/tsconfig.json index a156ce60..5ef893ea 100644 --- a/apps/workspace/tsconfig.json +++ b/apps/workspace/tsconfig.json @@ -1,40 +1,12 @@ { - "extends": "../../tsconfig.base.json", + "extends": "tsconfig/nextjs.json", "compilerOptions": { - "jsx": "preserve", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "resolveJsonModule": true, - "isolatedModules": true, - "incremental": true, - "plugins": [ - { - "name": "next" - } - ], - "types": [ - "jest", - "node" - ] + "plugins": [{ "name": "next" }], + "paths": { + "@/*": ["./src/*"], + "@public/*": ["./public/*"] + } }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.jsx", - "../../apps/workspace/.next/types/**/*.ts", - "../../dist/apps/workspace/.next/types/**/*.ts", - "next-env.d.ts", - ".next/types/**/*.ts" - ], - "exclude": [ - "node_modules", - "jest.config.ts", - "src/**/*.spec.ts", - "src/**/*.test.ts" - ] -} + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/apps/workspace/tsconfig.spec.json b/apps/workspace/tsconfig.spec.json deleted file mode 100644 index 214b2cc2..00000000 --- a/apps/workspace/tsconfig.spec.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"], - "jsx": "react" - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/jest.config.ts b/jest.config.ts deleted file mode 100644 index 15f85d1d..00000000 --- a/jest.config.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { getJestProjects } from '@nx/jest' - -export default { - projects: getJestProjects() -} diff --git a/jest.preset.js b/jest.preset.js index f078ddce..8b137891 100644 --- a/jest.preset.js +++ b/jest.preset.js @@ -1,3 +1 @@ -const nxPreset = require('@nx/jest/preset').default; -module.exports = { ...nxPreset }; diff --git a/nx.json b/nx.json deleted file mode 100644 index 6aff6849..00000000 --- a/nx.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "nxCloudAccessToken": "NWUxMDk4YTEtY2IwZi00NDg4LWJlZWEtMTg1Zjg4ODdlMzQ1fHJlYWQtd3JpdGU=", - "nxCloudUrl": "https://cloud.nx.app", - "extends": "nx/presets/npm.json", - "$schema": "./node_modules/nx/schemas/nx-schema.json", - "targetDefaults": { - "build": { - "cache": true, - "dependsOn": ["^build"] - }, - "lint": { - "cache": true, - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore", - "{workspaceRoot}/eslint.config.js" - ] - }, - "@nx/jest:jest": { - "cache": true, - "inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"], - "options": { - "passWithNoTests": true - }, - "configurations": { - "ci": { - "ci": true, - "codeCoverage": true - } - } - } - }, - "generators": { - "@nx/react": { - "application": { - "babel": true - } - }, - "@nx/next": { - "application": { - "style": "css", - "linter": "eslint" - } - } - }, - "pluginsConfig": { - "@nx/js": { - "analyzeSourceFiles": true - } - } -} diff --git a/package.json b/package.json index 5510c72b..4789f1f4 100644 --- a/package.json +++ b/package.json @@ -83,140 +83,55 @@ ] }, "scripts": { - "dev": "nx run-many -t serve -p api web workspace --parallel --maxParallel 3", - "dev:api": "nx run api:serve", - "dev:web": "nx run web:serve", - "dev:workspace": "nx run workspace:serve", - "lint": "nx run-many -t lint --parallel", - "lint:api": "nx run api:lint", - "lint:web": "nx run web:lint", - "lint:workspace": "nx run workspace:lint", - "lint:fix": "nx run-many -p api web workspace -t lint --fix --parallel", - "prettier:fix": "nx run-many -t prettier:lint --parallel", - "prettier:fix:api": "nx run api:prettier:fix", - "build": "nx run-many -t build -p api web workspace --parallel --maxParallel 3", - "build:api": "nx run api:build --configuration=production && pnpm sentry:sourcemaps", - "build:web": "nx run web:build --configuration=production", - "build:workspace": "nx run workspace:build", - "test": "nx run-many -t test --parallel", - "test:api": "nx run api:test", - "e2e:api:prepare": "docker compose down && docker compose -f docker-compose-test.yml up -d && NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' pnpm run db:deploy-migrations", - "e2e:api": "pnpm run e2e:api:prepare && NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' nx run api:test:e2e --skip-nx-cache -- --coverage --coverageDirectory=coverage-e2e/api --coverageReporters=json && pnpm run e2e:api:teardown", + "dev": "turbo run dev", + "dev:api": "turbo run dev --filter=api", + "dev:web": "turbo run dev --filter=web", + "dev:workspace": "turbo run dev --filter=workspace", + "add:global": "pnpm add -w", + "add:api": "pnpm add --filter=api", + "add:web": "pnpm add --filter=web", + "add:workspace": "pnpm add --filter=workspace", + "lint": "turbo run lint", + "lint:api": "turbo run lint --filter=api", + "lint:web": "turbo run lint --filter=web", + "lint:workspace": "turbo run lint --filter=workspace", + "build": "turbo run build", + "build:api": "pnpm db:generate-types && turbo run build --filter=api", + "build:web": "turbo run build --filter=web", + "build:workspace": "turbo run build --filter=workspace", + "start": "turbo run start", + "start:api": "turbo run start --filter=api", + "start:web": "turbo run start --filter=web", + "start:workspace": "turbo run start --filter=workspace", + "test": "turbo run test", + "test:api": "pnpm db:generate-types && turbo run test --filter=api -- --config=jest.config.ts", + "e2e:api:prepare": "docker compose down && docker compose -f docker-compose-test.yml up -d && pnpm db:generate-types && NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' pnpm run db:deploy-migrations", + "e2e:api": "pnpm run e2e:api:prepare && NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' turbo run test --no-cache --filter=api -- --runInBand --config=jest.e2e-config.ts --coverage --coverageDirectory=../../coverage-e2e/api --coverageReporters=json && pnpm run e2e:api:teardown", "e2e:api:teardown": "docker compose -f docker-compose-test.yml down", - "test:web": "nx run web:test", - "test:workspace": "nx run workspace:test", - "start:web": "nx run web:serve --configuration=production", - "start:api": "nx run api:serve --configuration=production", - "db:seed": "cd apps/api/src/prisma && pnpx ts-node seed.ts", - "db:generate-types": "nx run api:prisma:generate", - "db:generate-migrations": "cd apps/api/src/prisma && pnpx prisma migrate dev --create-only --skip-seed", - "db:deploy-migrations": "cd apps/api/src/prisma && pnpx prisma migrate deploy", - "db:validate": "nx run api:prisma:validate", - "db:format": "nx run api:prisma:format", - "db:reset": "nx run api:prisma:reset", + "test:web": "turbo run test --filter=web", + "test:workspace": "turbo run test --filter=workspace", + "db:generate-types": "pnpm dlx prisma generate --schema=apps/api/src/prisma/schema.prisma", + "db:generate-migrations": "pnpx prisma migrate dev --create-only --skip-seed --schema=apps/api/src/prisma/schema.prisma", + "db:deploy-migrations": " pnpx prisma migrate deploy --schema=apps/api/src/prisma/schema.prisma", + "db:validate": "pnpm dlx prisma validate --schema=apps/api/src/prisma/schema.prisma", + "db:format": "pnpm dlx prisma format --schema=apps/api/src/prisma/schema.prisma", + "db:reset": "pnpm dlx prisma migrate reset --force --schema=apps/api/src/prisma/schema.prisma", + "format": "prettier apps/**/*.{ts,tsx} --write", "prepare": "husky install", - "sentry:sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist || pnpm run sentry:sourcemaps:exit", - "sentry:sourcemaps:exit": "echo 'Failed to upload source maps to Sentry'" + "sourcemaps:api": "turbo run sourcemaps --filter=api" }, + "packageManager": "pnpm@8.6.10", "devDependencies": { - "@nestjs/schematics": "^10.0.3", - "@nestjs/testing": "^10.3.0", - "@nx/eslint": "^17.2.8", - "@nx/eslint-plugin": "17.2.7", - "@nx/jest": "17.2.7", - "@nx/js": "17.2.7", - "@nx/nest": "^17.2.8", - "@nx/next": "^17.2.8", - "@nx/node": "17.2.7", - "@nx/react": "17.2.7", - "@nx/webpack": "17.2.7", - "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11", - "@sentry/webpack-plugin": "^2.14.1", - "@svgr/webpack": "^8.1.0", - "@swc-node/register": "~1.6.8", - "@swc/core": "~1.3.102", - "@testing-library/react": "14.0.0", - "@types/jest": "^29.5.11", - "@types/node": "18.16.9", - "@types/nodemailer": "^6.4.14", - "@types/passport-jwt": "^3.0.13", - "@types/react": "18.2.33", - "@types/react-dom": "18.2.14", - "@types/uuid": "^9.0.8", - "@typescript-eslint/eslint-plugin": "^6.18.0", - "@typescript-eslint/parser": "^6.18.0", - "autoprefixer": "^10.4.16", - "babel-jest": "^29.7.0", - "conventional-changelog-eslint": "^5.0.0", - "eslint": "~8.48.0", - "eslint-config-next": "14.0.4", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "2.27.5", - "eslint-plugin-jsx-a11y": "6.7.1", - "eslint-plugin-react": "7.32.2", - "eslint-plugin-react-hooks": "4.6.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "jest-environment-node": "^29.7.0", - "nx": "17.2.7", - "postcss": "^8.4.33", - "prettier": "^2.8.8", - "prisma": "^5.7.1", - "react-refresh": "^0.10.0", - "tailwindcss": "^3.4.1", - "ts-jest": "^29.1.1", - "ts-node": "10.9.1", - "typescript": "~5.2.2", - "url-loader": "^4.1.1", - "@semantic-release/changelog": "^6.0.3", - "@semantic-release/commit-analyzer": "^11.1.0", - "@semantic-release/git": "^10.0.1", - "@semantic-release/release-notes-generator": "^12.1.0", - "@types/jsonwebtoken": "^9.0.5", - "@types/eccrypto": "^1.1.6" + "@sentry/cli": "^2.28.6", + "@sentry/webpack-plugin": "^2.14.2", + "husky": "^9.0.11", + "prettier": "^3.0.0", + "prettier-plugin-tailwindcss": "^0.5.11", + "tsconfig": "workspace:*", + "turbo": "^1.12.4" }, "dependencies": { - "@nestjs/common": "^10.3.0", - "@nestjs/config": "^3.1.1", - "@nestjs/core": "^10.3.0", - "@nestjs/jwt": "^10.2.0", - "@nestjs/passport": "^10.0.3", - "@nestjs/platform-express": "^10.3.0", - "@nestjs/platform-fastify": "^10.3.1", - "@nestjs/schedule": "^4.0.0", - "@nestjs/swagger": "^7.1.17", - "@prisma/client": "^5.7.1", - "@semantic-release/changelog": "^6.0.3", - "@semantic-release/commit-analyzer": "^11.1.0", - "@semantic-release/git": "^10.0.1", - "@semantic-release/release-notes-generator": "^12.1.0", - "@sentry/cli": "^2.28.0", - "@sentry/node": "^7.100.1", - "@sentry/profiling-node": "^7.100.1", - "@supabase/supabase-js": "^2.39.2", - "@types/jsonwebtoken": "^9.0.5", - "axios": "^1.6.5", - "chalk": "4.1.2", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.0", - "conventional-changelog-conventionalcommits": "^7.0.2", - "dotenv": "^16.3.1", - "eccrypto": "^1.1.6", - "express": "^4.18.2", - "husky": "^8.0.3", - "jest-mock-extended": "^3.0.5", - "moment": "^2.30.1", - "next": "^14.1.0", - "nodemailer": "^6.9.8", - "passport": "^0.7.0", - "passport-github2": "^0.1.12", - "passport-jwt": "^4.0.1", - "react": "18.2.0", - "react-dom": "18.2.0", - "reflect-metadata": "^0.2.1", - "rxjs": "^7.8.1", - "semantic-release": "^23.0.0", - "tslib": "^2.6.2", - "uuid": "^9.0.1" + "@sentry/node": "^7.102.0", + "@sentry/profiling-node": "^7.102.0" } } diff --git a/packages/.gitkeep b/packages/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/eslint-config-custom/next.js b/packages/eslint-config-custom/next.js new file mode 100644 index 00000000..8fadcc99 --- /dev/null +++ b/packages/eslint-config-custom/next.js @@ -0,0 +1,42 @@ +const { resolve } = require("node:path"); + +const project = resolve(process.cwd(), "tsconfig.json"); + +/* + * This is a custom ESLint configuration for use with + * Next.js apps. + * + * This config extends the Vercel Engineering Style Guide. + * For more information, see https://github.com/vercel/style-guide + * + */ + +module.exports = { + extends: [ + "@vercel/style-guide/eslint/node", + "@vercel/style-guide/eslint/browser", + "@vercel/style-guide/eslint/typescript", + "@vercel/style-guide/eslint/react", + "@vercel/style-guide/eslint/next", + "eslint-config-turbo", + ].map(require.resolve), + parserOptions: { + project, + }, + globals: { + React: true, + JSX: true, + }, + settings: { + "import/resolver": { + typescript: { + project, + }, + }, + }, + ignorePatterns: ["node_modules/", "dist/"], + // add rules configurations here + rules: { + "import/no-default-export": "off", + }, +}; \ No newline at end of file diff --git a/packages/eslint-config-custom/package.json b/packages/eslint-config-custom/package.json new file mode 100644 index 00000000..bc40923d --- /dev/null +++ b/packages/eslint-config-custom/package.json @@ -0,0 +1,11 @@ +{ + "name": "eslint-config-custom", + "license": "MIT", + "version": "0.0.0", + "private": true, + "devDependencies": { + "@vercel/style-guide": "^5.0.0", + "eslint-config-turbo": "^1.10.12", + "typescript": "^4.5.3" + } + } \ No newline at end of file diff --git a/packages/eslint-config-custom/react-internal.js b/packages/eslint-config-custom/react-internal.js new file mode 100644 index 00000000..a7087a74 --- /dev/null +++ b/packages/eslint-config-custom/react-internal.js @@ -0,0 +1,39 @@ +const { resolve } = require("node:path"); + +const project = resolve(process.cwd(), "tsconfig.json"); + +/* + * This is a custom ESLint configuration for use with + * internal (bundled by their consumer) libraries + * that utilize React. + * + * This config extends the Vercel Engineering Style Guide. + * For more information, see https://github.com/vercel/style-guide + * + */ + +module.exports = { + extends: [ + "@vercel/style-guide/eslint/browser", + "@vercel/style-guide/eslint/typescript", + "@vercel/style-guide/eslint/react", + ].map(require.resolve), + parserOptions: { + project, + }, + globals: { + JSX: true, + }, + settings: { + "import/resolver": { + typescript: { + project, + }, + }, + }, + ignorePatterns: ["node_modules/", "dist/", ".eslintrc.js"], + + rules: { + "import/no-default-export": "off", + }, +}; \ No newline at end of file diff --git a/packages/tsconfig/base.json b/packages/tsconfig/base.json new file mode 100644 index 00000000..a59a7db6 --- /dev/null +++ b/packages/tsconfig/base.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Default", + "compilerOptions": { + "composite": false, + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "inlineSources": false, + "isolatedModules": true, + "moduleResolution": "node", + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true + }, + "exclude": ["node_modules"] + } \ No newline at end of file diff --git a/packages/tsconfig/nextjs.json b/packages/tsconfig/nextjs.json new file mode 100644 index 00000000..0c98f629 --- /dev/null +++ b/packages/tsconfig/nextjs.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Next.js", + "extends": "./base.json", + "compilerOptions": { + "plugins": [{ "name": "next" }], + "allowJs": true, + "declaration": false, + "declarationMap": false, + "incremental": true, + "jsx": "preserve", + "lib": ["dom", "dom.iterable", "esnext"], + "module": "esnext", + "noEmit": true, + "resolveJsonModule": true, + "strict": false, + "target": "es5" + }, + "include": ["src", "next-env.d.ts"], + "exclude": ["node_modules"] + } \ No newline at end of file diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json new file mode 100644 index 00000000..f7b272e9 --- /dev/null +++ b/packages/tsconfig/package.json @@ -0,0 +1,9 @@ +{ + "name": "tsconfig", + "version": "0.0.0", + "private": true, + "license": "MIT", + "publishConfig": { + "access": "public" + } + } \ No newline at end of file diff --git a/packages/tsconfig/react-library.json b/packages/tsconfig/react-library.json new file mode 100644 index 00000000..e0fcf4e8 --- /dev/null +++ b/packages/tsconfig/react-library.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "React Library", + "extends": "./base.json", + "compilerOptions": { + "jsx": "react-jsx", + "lib": ["ES2015", "DOM"], + "module": "ESNext", + "target": "es6" + } + } \ No newline at end of file diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 00000000..3b900cf8 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["prettier-plugin-tailwindcss"], +}; \ No newline at end of file diff --git a/tsconfig.base.json b/tsconfig.base.json deleted file mode 100644 index 2083a484..00000000 --- a/tsconfig.base.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "rootDir": ".", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "target": "es2015", - "module": "esnext", - "lib": ["es2020", "dom"], - "skipLibCheck": true, - "skipDefaultLibCheck": true, - "baseUrl": ".", - - "paths": { - "cli": ["apps/cli/src/index.ts"] - }, - - "inlineSources": true, - "sourceRoot": "/" - }, - "exclude": ["node_modules", "tmp"] -} diff --git a/turbo.json b/turbo.json new file mode 100644 index 00000000..eb2f9754 --- /dev/null +++ b/turbo.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://turbo.build/schema.json", + "pipeline": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + }, + "deploy": { + "dependsOn": ["build", "test", "lint"] + }, + "test": { + "dependsOn": ["build"], + "inputs": ["src/**/*.tsx", "src/**/*.ts", "test/**/*.ts", "test/**/*.tsx"] + }, + "sourcemaps": { + "dependsOn": ["build"], + "inputs": ["dist/**"] + }, + "lint": {}, + "dev": { + "cache": false, + "persistent": true + }, + "start": { + "dependsOn": ["build"], + "inputs": ["dist/**"] + } + } +}