Skip to content

Commit

Permalink
chore: unify ts across monorepo on v5
Browse files Browse the repository at this point in the history
As a part of this:
- ensure ts related deps are unified across monorepo too
- add docker compose file to be able to verify builds and their validity
- add code style deps to every app/package to ensure their independence

closes #153
  • Loading branch information
ygrishajev committed Jun 10, 2024
1 parent e51169d commit f23e3b8
Show file tree
Hide file tree
Showing 43 changed files with 3,740 additions and 8,145 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/validate-n-build-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ jobs:
if: steps.filter.outputs.api == 'true'
uses: actions/setup-node@v4
with:
node-version: 18.20.2
node-version: 20.14.0

- name: Restore root node_modules cache
if: steps.filter.outputs.api == 'true'
uses: martijnhols/actions-cache@v3
id: cache-root
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.filter.outputs.api == 'true' && (steps.cache-root.outputs.cache-hit != 'true' || steps.cache-api.outputs.cache-hit != 'true')
if: steps.filter.outputs.api == 'true' && steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Run static code analysis
Expand Down
4 changes: 0 additions & 4 deletions .postgres.local.env

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ For convenience, a Docker Compose configuration is provided to automate the data

#### Running Docker Compose
```sh
docker-compose up
docker-compose up db
```
This command spins up the database service and automatically handles the downloading and importing of the specified data.

Expand Down
34 changes: 20 additions & 14 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
"name": "cloudmos-api",
"version": "2.18.4",
"description": "Api providing data to the deploy tool",
"author": "Cloudmos",
"repository": {
"type": "git",
"url": "git+https://github.com/akash-network/cloudmos"
},
"license": "Apache-2.0",
"author": "Cloudmos",
"main": "server.js",
"scripts": {
"start": "webpack --config webpack.dev.js --watch",
"build": "webpack --config webpack.prod.js",
"lint": "eslint .",
"format": "prettier --write ./*.{js,json} **/*.{ts,js,json}",
"lint": "eslint .",
"start": "webpack --config webpack.dev.js --watch",
"test": "jest --selectProjects unit functional",
"test:watch": "jest --selectProjects unit functional --watch",
"test:cov": "jest --selectProjects unit functional --coverage",
"test:functional": "jest --selectProjects functional",
"test:functional:cov": "jest --selectProjects functional --coverage",
"test:functional:watch": "jest --selectProjects functional --watch",
"test:unit": "jest --selectProjects unit",
"test:unit:cov": "jest --selectProjects unit --coverage",
"test:unit:watch": "jest --selectProjects unit --watch",
"test:functional": "jest --selectProjects functional",
"test:functional:cov": "jest --selectProjects functional --coverage",
"test:functional:watch": "jest --selectProjects functional --watch"
},
"repository": {
"type": "git",
"url": "git+https://github.com/akash-network/cloudmos"
"test:watch": "jest --selectProjects unit functional --watch"
},
"dependencies": {
"@akashnetwork/akash-api": "^1.3.0",
Expand Down Expand Up @@ -69,20 +69,26 @@
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.0",
"@types/memory-cache": "^0.2.2",
"@types/node": "^16.6.0",
"@types/node": "20.14.0",
"@types/node-fetch": "^2.6.2",
"@types/pg": "^8.6.5",
"@types/semver": "^7.5.2",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"alias-hq": "^5.1.6",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
"eslint-plugin-simple-import-sort": "^12.1.0",
"jest": "^29.7.0",
"nock": "^13.5.4",
"nodemon": "^2.0.7",
"nodemon-webpack-plugin": "^4.8.2",
"prettier": "^3.3.0",
"prettier-plugin-tailwindcss": "^0.6.1",
"supertest": "^6.1.5",
"ts-jest": "^29.1.2",
"ts-jest": "^29.1.4",
"ts-loader": "^9.2.5",
"typescript": "^5.3.3",
"typescript": "5.1.3",
"webpack": "^5.91.0",
"webpack-cli": "4.10.0",
"webpack-node-externals": "^3.0.0"
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/routes/internal/gpu.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { sub } from "date-fns";
import { QueryTypes } from "sequelize";
import { URL } from "url";

import { chainDb } from "@src/db/dbConnection";
import { toUTC } from "@src/utils";
Expand Down
27 changes: 9 additions & 18 deletions apps/api/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
{
"compilerOptions": {
"module": "Node16",
"baseUrl": ".",
"noImplicitAny": true,
"noEmitOnError": false,
"removeComments": false,
"sourceMap": true,
"downlevelIteration": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"moduleResolution": "Node16",
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ES6",
"baseUrl": "./src",
"paths": {
"@src/*": ["*"],
"@test/*": ["../test/*"]
"@src/*": [
"./src/*"
],
"@test/*": [
"./test/*"
]
}
}
},
"extends": "@akashnetwork/dev-config/tsconfig.base-node.json"
}
11 changes: 8 additions & 3 deletions apps/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"exclude": [
"node_modules",
"dist",
"**/*spec.ts"
],
"extends": "./tsconfig.build.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*spec.ts"],
"compileOnSave": false
"include": [
"src/**/*"
]
}
14 changes: 10 additions & 4 deletions apps/deploy-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"license": "Apache-2.0",
"author": "Akash Network",
"scripts": {
"lint": "eslint .",
"format": "prettier --write ./*.{ts,js,json} **/*.{ts,tsx,js,json}",
"build": "next build",
"build-analyze": "set ANALYZE=true&& next build",
"dev": "next -p 3000",
"format": "prettier --write ./*.{ts,js,json} **/*.{ts,tsx,js,json}",
"lint": "eslint .",
"start": "next start",
"type-check": "tsc"
},
"dependencies": {
"@akashnetwork/akash-api": "^1.3.0",
"@akashnetwork/akashjs": "^0.10.0",
"@auth0/nextjs-auth0": "^3.5.0",
"@chain-registry/types": "^0.41.3",
"@cosmjs/encoding": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@cosmos-kit/cosmostation-extension": "^2.6.4",
"@cosmos-kit/keplr": "^2.5.4",
"@chain-registry/types": "^0.41.3",
"@cosmos-kit/leap-extension": "^2.6.4",
"@cosmos-kit/react": "^2.9.20",
"@emotion/cache": "^11.7.1",
Expand Down Expand Up @@ -136,15 +136,21 @@
"@types/js-yaml": "^4.0.5",
"@types/json2csv": "^5.0.3",
"@types/lodash": "^4.14.197",
"@types/node": "^12.12.21",
"@types/node": "20.14.0",
"@types/nprogress": "^0.2.0",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.0",
"@types/react-simple-maps": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
"eslint-plugin-simple-import-sort": "^12.1.0",
"patch-package": "^8.0.0",
"postcss": "^8.4.31",
"postcss-nesting": "^12.0.2",
"prettier": "^3.3.0",
"prettier-plugin-tailwindcss": "^0.6.1",
"tailwindcss": "^3.4.3",
"typescript": "5.1.3"
},
Expand Down
1 change: 1 addition & 0 deletions apps/deploy-web/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function getStatsAppUrl() {
}

function getProviderProxyHttpUrl() {
if (process.env.PROVIDER_PROXY_URL) return process.env.PROVIDER_PROXY_URL;
if (typeof window === "undefined") return "http://localhost:3040";
if (window.location?.hostname === "deploybeta.cloudmos.io") return "https://deployproxybeta.cloudmos.io";
if (productionHostnames.includes(window.location?.hostname)) return "https://providerproxy.cloudmos.io";
Expand Down
19 changes: 19 additions & 0 deletions apps/deploy-web/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"moduleResolution": "Bundler",
"paths": {
"@src/*": [
"./src/*"
]
},
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true
},
"extends": "@akashnetwork/dev-config/tsconfig.base-next.json"
}
41 changes: 10 additions & 31 deletions apps/deploy-web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es6", "dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": "./src",
"paths": {
"@src/*": ["*"]
},
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"],
"compileOnSave": false
"exclude": [
"node_modules"
],
"extends": "./tsconfig.build.json",
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
]
}
16 changes: 11 additions & 5 deletions apps/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"author": "Cloudmos",
"main": "server.js",
"scripts": {
"lint": "eslint .",
"format": "prettier --write ./*.{js,json} **/*.{ts,js,json}",
"build": "webpack --config webpack.prod.js",
"format": "prettier --write ./*.{js,json} **/*.{ts,js,json}",
"lint": "eslint .",
"start": "webpack --mode development --config webpack.dev.js --watch",
"test": "jest"
},
Expand Down Expand Up @@ -56,20 +56,26 @@
"@types/async": "^3.2.15",
"@types/express": "^4.17.13",
"@types/lodash": "^4.17.1",
"@types/node": "^16.11.68",
"@types/node": "20.14.0",
"@types/node-fetch": "^2.6.2",
"@types/node-gzip": "^1.1.0",
"@types/pg": "^8.6.5",
"@types/semver": "^7.5.6",
"@types/uuid": "^8.3.1",
"@types/validator": "^13.7.8",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"alias-hq": "^5.1.6",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
"eslint-plugin-simple-import-sort": "^12.1.0",
"nodemon": "^2.0.7",
"nodemon-webpack-plugin": "^4.8.2",
"prettier": "^3.3.0",
"prettier-plugin-tailwindcss": "^0.6.1",
"supertest": "^6.1.5",
"ts-jest": "^27.0.4",
"ts-jest": "^29.1.4",
"ts-loader": "^9.5.1",
"typescript": "^4.9.5",
"typescript": "5.1.3",
"webpack": "^5.91.0",
"webpack-cli": "4.10.0",
"webpack-node-externals": "^3.0.0"
Expand Down
19 changes: 19 additions & 0 deletions apps/indexer/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"baseUrl": ".",
"noImplicitAny": false,
"paths": {
"@src/*": [
"./src/*"
]
}
},
"exclude": [
"node_modules",
"dist"
],
"extends": "@akashnetwork/dev-config/tsconfig.base-node.json",
"include": [
"src/**/*"
]
}
33 changes: 9 additions & 24 deletions apps/indexer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
{
"compilerOptions": {
"module": "Node16",
"noImplicitAny": false,
"noEmitOnError": false,
"removeComments": false,
"sourceMap": true,
"downlevelIteration": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"moduleResolution": "Node16",
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ES6",
"baseUrl": "./src",
"paths": {
"@src/*": ["*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"],
"compileOnSave": false
"compileOnSave": false,
"exclude": [
"node_modules",
"dist"
],
"extends": "./tsconfig.build.json",
"include": [
"src/**/*"
]
}
Loading

0 comments on commit f23e3b8

Please sign in to comment.