merge branch feature/migrate-yarn-to-pnpm
This commit is contained in:
parent
79e707a232
commit
9e40e5141c
2
.gitignore
vendored
2
.gitignore
vendored
@ -68,3 +68,5 @@ yarn-error.log*
|
|||||||
.turbo
|
.turbo
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/turbo
|
# End of https://www.toptal.com/developers/gitignore/api/turbo
|
||||||
|
|
||||||
|
.pnpm
|
||||||
104
README.md
104
README.md
@ -1,59 +1,28 @@
|
|||||||
# Turborepo Docker starter
|
# Turborepo starter
|
||||||
|
|
||||||
This is an official Docker starter Turborepo.
|
This is an official starter Turborepo.
|
||||||
|
|
||||||
## What's inside?
|
|
||||||
|
|
||||||
This turborepo uses [Yarn](https://classic.yarnpkg.com/lang/en/) as a package manager. It includes the following packages/apps:
|
|
||||||
|
|
||||||
### Apps and Packages
|
|
||||||
|
|
||||||
- `web`: a [Next.js](https://nextjs.org/) app
|
|
||||||
- `api`: an [Express](https://expressjs.com/) server
|
|
||||||
- `ui`: ui: a React component library
|
|
||||||
- `eslint-config-custom`: `eslint` configurations for client side applications (includes `eslint-config-next` and `eslint-config-prettier`)
|
|
||||||
- `eslint-config-custom-server`: `eslint` configurations for server side applications (includes `eslint-config-next` and `eslint-config-prettier`)
|
|
||||||
- `scripts`: Jest configurations
|
|
||||||
- `logger`: Isomorphic logger (a small wrapper around console.log)
|
|
||||||
- `tsconfig`: tsconfig.json;s used throughout the monorepo
|
|
||||||
|
|
||||||
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
|
|
||||||
|
|
||||||
## Using this example
|
## Using this example
|
||||||
|
|
||||||
Run the following command:
|
Run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npx degit vercel/turbo/examples/with-docker with-docker
|
npx create-turbo@latest
|
||||||
cd with-docker
|
|
||||||
yarn install
|
|
||||||
git init . && git add . && git commit -m "Init"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker
|
## What's inside?
|
||||||
|
|
||||||
This repo is configured to be built with Docker, and Docker compose. To build all apps in this repo:
|
This Turborepo includes the following packages/apps:
|
||||||
|
|
||||||
```
|
### Apps and Packages
|
||||||
# Create a network, which allows containers to communicate
|
|
||||||
# with each other, by using their container name as a hostname
|
|
||||||
docker network create app_network
|
|
||||||
|
|
||||||
# Build prod using new BuildKit engine
|
- `docs`: a [Next.js](https://nextjs.org/) app
|
||||||
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml build --parallel
|
- `web`: another [Next.js](https://nextjs.org/) app
|
||||||
|
- `@repo/ui`: a stub React component library shared by both `web` and `docs` applications
|
||||||
|
- `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
|
||||||
|
- `@repo/tsconfig`: `tsconfig.json`s used throughout the monorepo
|
||||||
|
|
||||||
# Start prod in detached mode
|
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
|
||||||
docker-compose -f docker-compose.yml up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
Open http://localhost:3000.
|
|
||||||
|
|
||||||
To shutdown all running containers:
|
|
||||||
|
|
||||||
```
|
|
||||||
# Stop all running containers
|
|
||||||
docker kill $(docker ps -q) && docker rm $(docker ps -a -q)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Utilities
|
### Utilities
|
||||||
|
|
||||||
@ -61,5 +30,52 @@ This Turborepo has some additional tools already setup for you:
|
|||||||
|
|
||||||
- [TypeScript](https://www.typescriptlang.org/) for static type checking
|
- [TypeScript](https://www.typescriptlang.org/) for static type checking
|
||||||
- [ESLint](https://eslint.org/) for code linting
|
- [ESLint](https://eslint.org/) for code linting
|
||||||
- [Jest](https://jestjs.io) test runner for all things JavaScript
|
|
||||||
- [Prettier](https://prettier.io) for code formatting
|
- [Prettier](https://prettier.io) for code formatting
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
To build all apps and packages, run the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd my-turborepo
|
||||||
|
pnpm build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Develop
|
||||||
|
|
||||||
|
To develop all apps and packages, run the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd my-turborepo
|
||||||
|
pnpm dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Remote Caching
|
||||||
|
|
||||||
|
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
|
||||||
|
|
||||||
|
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd my-turborepo
|
||||||
|
npx turbo login
|
||||||
|
```
|
||||||
|
|
||||||
|
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
|
||||||
|
|
||||||
|
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
|
||||||
|
|
||||||
|
```
|
||||||
|
npx turbo link
|
||||||
|
```
|
||||||
|
|
||||||
|
## Useful Links
|
||||||
|
|
||||||
|
Learn more about the power of Turborepo:
|
||||||
|
|
||||||
|
- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
|
||||||
|
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
|
||||||
|
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
|
||||||
|
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
|
||||||
|
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
|
||||||
|
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
|
||||||
|
|||||||
@ -2,17 +2,21 @@
|
|||||||
# Make sure you update both files!
|
# Make sure you update both files!
|
||||||
|
|
||||||
FROM node:alpine AS builder
|
FROM node:alpine AS builder
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
ENV PNPM_HOME=/usr/local/bin
|
||||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
RUN apk update
|
RUN apk update
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN yarn global add turbo
|
RUN pnpm add -g turbo dotenv-cli
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN turbo prune --scope=api --docker
|
RUN turbo prune --scope=api --docker
|
||||||
|
|
||||||
# Add lockfile and package.json's of isolated subworkspace
|
# Add lockfile and package.json's of isolated subworkspace
|
||||||
FROM node:alpine AS installer
|
FROM node:alpine AS installer
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
ENV PNPM_HOME=/usr/local/bin
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
RUN apk update
|
RUN apk update
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -20,14 +24,15 @@ WORKDIR /app
|
|||||||
# First install dependencies (as they change less often)
|
# First install dependencies (as they change less often)
|
||||||
COPY .gitignore .gitignore
|
COPY .gitignore .gitignore
|
||||||
COPY --from=builder /app/out/json/ .
|
COPY --from=builder /app/out/json/ .
|
||||||
COPY --from=builder /app/out/yarn.lock ./yarn.lock
|
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
|
||||||
RUN yarn install
|
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
|
||||||
|
RUN pnpm install
|
||||||
|
|
||||||
# Build the project and its dependencies
|
# Build the project and its dependencies
|
||||||
COPY --from=builder /app/out/full/ .
|
COPY --from=builder /app/out/full/ .
|
||||||
COPY turbo.json turbo.json
|
COPY turbo.json turbo.json
|
||||||
# COPY .env .env
|
COPY .env .env
|
||||||
RUN yarn turbo run build --filter=api...
|
RUN pnpm dotenv -e .env turbo run build --filter=api...
|
||||||
|
|
||||||
FROM node:alpine AS runner
|
FROM node:alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@ -29,33 +29,33 @@
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn install
|
$ pnpm install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running the app
|
## Running the app
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# development
|
# development
|
||||||
$ yarn run start
|
$ pnpm run start
|
||||||
|
|
||||||
# watch mode
|
# watch mode
|
||||||
$ yarn run start:dev
|
$ pnpm run start:dev
|
||||||
|
|
||||||
# production mode
|
# production mode
|
||||||
$ yarn run start:prod
|
$ pnpm run start:prod
|
||||||
```
|
```
|
||||||
|
|
||||||
## Test
|
## Test
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# unit tests
|
# unit tests
|
||||||
$ yarn run test
|
$ pnpm run test
|
||||||
|
|
||||||
# e2e tests
|
# e2e tests
|
||||||
$ yarn run test:e2e
|
$ pnpm run test:e2e
|
||||||
|
|
||||||
# test coverage
|
# test coverage
|
||||||
$ yarn run test:cov
|
$ pnpm run test:cov
|
||||||
```
|
```
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|||||||
@ -40,8 +40,8 @@
|
|||||||
"@types/jest": "^29.5.2",
|
"@types/jest": "^29.5.2",
|
||||||
"@types/node": "^20.3.1",
|
"@types/node": "^20.3.1",
|
||||||
"@types/supertest": "^6.0.0",
|
"@types/supertest": "^6.0.0",
|
||||||
"@vchikalkin/eslint-config-awesome": "^1.1.5",
|
"@vchikalkin/eslint-config-awesome": "^1.1.6",
|
||||||
"eslint": "^8.51.0",
|
"eslint": "^8.52.0",
|
||||||
"fastify": "^4.26.1",
|
"fastify": "^4.26.1",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"prettier": "^3.0.0",
|
"prettier": "^3.0.0",
|
||||||
@ -51,7 +51,7 @@
|
|||||||
"ts-loader": "^9.4.3",
|
"ts-loader": "^9.4.3",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tsconfig-paths": "^4.2.0",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^5.1.3"
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"moduleFileExtensions": [
|
"moduleFileExtensions": [
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
module.exports = {
|
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
|
||||||
extends: [
|
|
||||||
'@vchikalkin/eslint-config-awesome/next-typescript/config',
|
module.exports = createConfig('next-typescript', {
|
||||||
'@vchikalkin/eslint-config-awesome/next-typescript/rules',
|
|
||||||
],
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: './tsconfig.json',
|
project: './tsconfig.json',
|
||||||
tsconfigRootDir: __dirname,
|
tsconfigRootDir: __dirname,
|
||||||
},
|
},
|
||||||
root: true,
|
rules: {
|
||||||
};
|
'import/no-duplicates': 'off',
|
||||||
|
'react/forbid-component-props': 'off',
|
||||||
|
'import/consistent-type-specifier-style': 'off',
|
||||||
|
},
|
||||||
|
ignorePatterns: ['*.config.js', '.eslintrc.js'],
|
||||||
|
});
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
overwrite: true
|
overwrite: true
|
||||||
schema: './graphql/crm.schema.graphql'
|
schema: './graphql/crm.schema.graphql'
|
||||||
documents: ['./**/!(*.{d,types}).{ts,tsx}', './**/.{js,jsx}', ./**/!(*.schema).graphql]
|
documents: [./**/!(*.schema).graphql]
|
||||||
generates:
|
generates:
|
||||||
./graphql/crm.types.ts:
|
./graphql/crm.types.ts:
|
||||||
plugins:
|
plugins:
|
||||||
|
|||||||
@ -19,6 +19,6 @@ export const Grid = styled(Box)`
|
|||||||
}
|
}
|
||||||
|
|
||||||
${min('desktop-xl')} {
|
${min('desktop-xl')} {
|
||||||
margin: 8px 10%;
|
margin: 8px 10% !important;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { observer } from 'mobx-react-lite';
|
|||||||
import { Table } from 'ui/elements';
|
import { Table } from 'ui/elements';
|
||||||
|
|
||||||
const PaymentsTable = observer(() => {
|
const PaymentsTable = observer(() => {
|
||||||
const { $results, $process } = useStore();
|
const { $process, $results } = useStore();
|
||||||
|
|
||||||
const unlimited = $process.has('Unlimited');
|
const unlimited = $process.has('Unlimited');
|
||||||
const dataSource = toJS($results.payments);
|
const dataSource = toJS($results.payments);
|
||||||
@ -27,8 +27,8 @@ const PaymentsTable = observer(() => {
|
|||||||
showSizeChanger: false,
|
showSizeChanger: false,
|
||||||
}}
|
}}
|
||||||
scroll={{
|
scroll={{
|
||||||
x: dataColumns.length > 4 && 1000,
|
x: dataColumns.length > 5 ? 1000 : undefined,
|
||||||
y: 630,
|
y: dataSource.length > 16 ? 630 : undefined,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,17 +2,21 @@
|
|||||||
# Make sure you update both files!
|
# Make sure you update both files!
|
||||||
|
|
||||||
FROM node:alpine AS builder
|
FROM node:alpine AS builder
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
ENV PNPM_HOME=/usr/local/bin
|
||||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
RUN apk update
|
RUN apk update
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN yarn global add turbo
|
RUN pnpm add -g turbo dotenv-cli
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN turbo prune --scope=web --docker
|
RUN turbo prune --scope=web --docker
|
||||||
|
|
||||||
# Add lockfile and package.json's of isolated subworkspace
|
# Add lockfile and package.json's of isolated subworkspace
|
||||||
FROM node:alpine AS installer
|
FROM node:alpine AS installer
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
ENV PNPM_HOME=/usr/local/bin
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
RUN apk update
|
RUN apk update
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -20,8 +24,9 @@ WORKDIR /app
|
|||||||
# First install the dependencies (as they change less often)
|
# First install the dependencies (as they change less often)
|
||||||
COPY .gitignore .gitignore
|
COPY .gitignore .gitignore
|
||||||
COPY --from=builder /app/out/json/ .
|
COPY --from=builder /app/out/json/ .
|
||||||
COPY --from=builder /app/out/yarn.lock ./yarn.lock
|
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
|
||||||
RUN yarn install
|
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
|
||||||
|
RUN pnpm install
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
COPY --from=builder /app/out/full/ .
|
COPY --from=builder /app/out/full/ .
|
||||||
@ -42,7 +47,7 @@ ARG URL_CORE_CALCULATE_DIRECT
|
|||||||
ARG URL_1C_TRANSTAX_DIRECT
|
ARG URL_1C_TRANSTAX_DIRECT
|
||||||
ARG URL_ELT_OSAGO_DIRECT
|
ARG URL_ELT_OSAGO_DIRECT
|
||||||
ARG URL_ELT_KASKO_DIRECT
|
ARG URL_ELT_KASKO_DIRECT
|
||||||
RUN yarn turbo run build --filter=web...
|
RUN pnpm dotenv -e .env turbo run build --filter=web...
|
||||||
|
|
||||||
FROM node:alpine AS runner
|
FROM node:alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@ -1,30 +1,36 @@
|
|||||||
|
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
First, run the development server:
|
First, run the development server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
npm run dev
|
||||||
|
# or
|
||||||
yarn dev
|
yarn dev
|
||||||
|
# or
|
||||||
|
pnpm dev
|
||||||
|
# or
|
||||||
|
bun dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||||
|
|
||||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||||
|
|
||||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
||||||
|
|
||||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
|
||||||
|
|
||||||
## Learn More
|
## Learn More
|
||||||
|
|
||||||
To learn more about Next.js, take a look at the following resources:
|
To learn more about Next.js, take a look at the following resources:
|
||||||
|
|
||||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||||
- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial.
|
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||||
|
|
||||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||||
|
|
||||||
## Deploy on Vercel
|
## Deploy on Vercel
|
||||||
|
|
||||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
|
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||||
|
|
||||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||||
|
|||||||
@ -48,6 +48,7 @@ query GetLead($leadid: Uuid!) {
|
|||||||
}
|
}
|
||||||
evo_okved
|
evo_okved
|
||||||
}
|
}
|
||||||
|
link
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ query GetOpportunity($opportunityid: Uuid!) {
|
|||||||
}
|
}
|
||||||
evo_okved
|
evo_okved
|
||||||
}
|
}
|
||||||
|
link
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +109,7 @@ query GetQuote($quoteId: Uuid!) {
|
|||||||
evo_kasko_payer
|
evo_kasko_payer
|
||||||
evo_promotion
|
evo_promotion
|
||||||
evo_sale_without_nds
|
evo_sale_without_nds
|
||||||
|
link
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -33,8 +33,8 @@
|
|||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"styled-components": "^5.3.11",
|
"styled-components": "^5.3.11",
|
||||||
"superjson": "^2.2.1",
|
"superjson": "^2.2.1",
|
||||||
"tools": "*",
|
"tools": "workspace:*",
|
||||||
"ui": "*",
|
"ui": "workspace:*",
|
||||||
"use-debounce": "^9.0.4",
|
"use-debounce": "^9.0.4",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
@ -43,6 +43,7 @@
|
|||||||
"@graphql-codegen/typed-document-node": "^5.0.1",
|
"@graphql-codegen/typed-document-node": "^5.0.1",
|
||||||
"@graphql-codegen/typescript": "^4.0.1",
|
"@graphql-codegen/typescript": "^4.0.1",
|
||||||
"@graphql-codegen/typescript-operations": "^4.0.1",
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
||||||
|
"@graphql-typed-document-node/core": "^3.2.0",
|
||||||
"@graphql-typed-document-node/patch-cli": "^3.0.9",
|
"@graphql-typed-document-node/patch-cli": "^3.0.9",
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^14.0.0",
|
"@testing-library/react": "^14.0.0",
|
||||||
@ -50,15 +51,15 @@
|
|||||||
"@types/react": "^18.2.14",
|
"@types/react": "^18.2.14",
|
||||||
"@types/react-dom": "^18.2.6",
|
"@types/react-dom": "^18.2.6",
|
||||||
"@types/styled-components": "^5.1.26",
|
"@types/styled-components": "^5.1.26",
|
||||||
"@vchikalkin/eslint-config-awesome": "^1.1.1",
|
"@vchikalkin/eslint-config-awesome": "^1.1.6",
|
||||||
"eslint": "^8.46.0",
|
"antd": "^5.14.2",
|
||||||
|
"eslint": "^8.52.0",
|
||||||
"gql-sdl": "^1.0.0",
|
"gql-sdl": "^1.0.0",
|
||||||
"jest": "^29.4.3",
|
"jest": "^29.4.3",
|
||||||
"jest-environment-jsdom": "^29.3.1",
|
"jest-environment-jsdom": "^29.3.1",
|
||||||
"msw": "^1.1.0",
|
"msw": "^1.1.0",
|
||||||
"ts-jest": "^29.0.5",
|
"ts-jest": "^29.0.5",
|
||||||
"tsconfig": "*",
|
"typescript": "^5.3.3"
|
||||||
"typescript": "^4.9.5"
|
|
||||||
},
|
},
|
||||||
"msw": {
|
"msw": {
|
||||||
"workerDirectory": "public"
|
"workerDirectory": "public"
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'normalize.css';
|
import 'normalize.css';
|
||||||
import '../styles/fonts.css';
|
import '../styles/fonts.css';
|
||||||
import '../styles/globals.css';
|
import '../styles/globals.css';
|
||||||
|
import '../styles/antd-fix.css';
|
||||||
import initializeQueryClient from '@/api/client';
|
import initializeQueryClient from '@/api/client';
|
||||||
import initializeApollo from '@/apollo/client';
|
import initializeApollo from '@/apollo/client';
|
||||||
import { Notification } from '@/Components/Common/Notification';
|
import { Notification } from '@/Components/Common/Notification';
|
||||||
|
|||||||
@ -1,17 +1,31 @@
|
|||||||
/* eslint-disable no-negated-condition */
|
/* eslint-disable no-negated-condition */
|
||||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||||
|
import * as CRMTypes from '@/graphql/crm.types';
|
||||||
import type { ProcessContext } from '@/process/types';
|
import type { ProcessContext } from '@/process/types';
|
||||||
import type { DocumentNode } from '@apollo/client';
|
import type { DocumentNode } from '@apollo/client';
|
||||||
import { gql } from '@apollo/client';
|
|
||||||
import { reaction } from 'mobx';
|
import { reaction } from 'mobx';
|
||||||
|
|
||||||
|
type LinkReactionParams = {
|
||||||
|
elementName: Elements;
|
||||||
|
entityName: string;
|
||||||
|
linkElementName: Elements;
|
||||||
|
query: DocumentNode;
|
||||||
|
variableName: string;
|
||||||
|
};
|
||||||
|
|
||||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||||
const { $calculation } = store;
|
const { $calculation } = store;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* При выборе Интереса, ЛС и Предложения скачиваем ссылку CRM
|
* При выборе Интереса, ЛС и Предложения скачиваем ссылку CRM
|
||||||
*/
|
*/
|
||||||
function makeLinkReaction(elementName: Elements, linkElementName: Elements, query: DocumentNode) {
|
function makeLinkReaction({
|
||||||
|
elementName,
|
||||||
|
linkElementName,
|
||||||
|
query,
|
||||||
|
variableName,
|
||||||
|
entityName,
|
||||||
|
}: LinkReactionParams) {
|
||||||
reaction(
|
reaction(
|
||||||
() => $calculation.element(elementName).getValue(),
|
() => $calculation.element(elementName).getValue(),
|
||||||
(id) => {
|
(id) => {
|
||||||
@ -29,13 +43,13 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
|||||||
.query({
|
.query({
|
||||||
query,
|
query,
|
||||||
variables: {
|
variables: {
|
||||||
id,
|
[variableName]: id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
if (data.entity?.link) {
|
if (data[entityName]?.link) {
|
||||||
$calculation.element(linkElementName).setValue(data.entity?.link);
|
$calculation.element(linkElementName).setValue(data[entityName]?.link);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@ -56,30 +70,27 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QUERY_GET_LEAD_URL = gql`
|
makeLinkReaction({
|
||||||
query GetLeadUrl($id: Uuid!) {
|
elementName: 'selectLead',
|
||||||
entity: lead(leadid: $id) {
|
entityName: 'lead',
|
||||||
link
|
linkElementName: 'linkLeadUrl',
|
||||||
}
|
query: CRMTypes.GetLeadDocument,
|
||||||
}
|
variableName: 'leadid',
|
||||||
`;
|
});
|
||||||
makeLinkReaction('selectLead', 'linkLeadUrl', QUERY_GET_LEAD_URL);
|
|
||||||
|
|
||||||
const QUERY_GET_OPPORTUNITY_URL = gql`
|
makeLinkReaction({
|
||||||
query GetOpportunityUrl($id: Uuid!) {
|
elementName: 'selectOpportunity',
|
||||||
entity: opportunity(opportunityid: $id) {
|
entityName: 'opportunity',
|
||||||
link
|
linkElementName: 'linkOpportunityUrl',
|
||||||
}
|
query: CRMTypes.GetOpportunityDocument,
|
||||||
}
|
variableName: 'opportunityid',
|
||||||
`;
|
});
|
||||||
makeLinkReaction('selectOpportunity', 'linkOpportunityUrl', QUERY_GET_OPPORTUNITY_URL);
|
|
||||||
|
|
||||||
const QUERY_GET_QUOTE_URL = gql`
|
makeLinkReaction({
|
||||||
query GetQuoteUrl($id: Uuid!) {
|
elementName: 'selectQuote',
|
||||||
entity: quote(quoteId: $id) {
|
entityName: 'quote',
|
||||||
link
|
linkElementName: 'linkQuoteUrl',
|
||||||
}
|
query: CRMTypes.GetQuoteDocument,
|
||||||
}
|
variableName: 'quoteId',
|
||||||
`;
|
});
|
||||||
makeLinkReaction('selectQuote', 'linkQuoteUrl', QUERY_GET_QUOTE_URL);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
const { downloadSchema, generateTypescript } = require('./lib/graphql');
|
const { downloadSchema } = require('./lib/graphql');
|
||||||
|
|
||||||
downloadSchema();
|
downloadSchema();
|
||||||
generateTypescript();
|
|
||||||
|
|||||||
4
apps/web/styles/antd-fix.css
Normal file
4
apps/web/styles/antd-fix.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/* fix antd tables override scroll style */
|
||||||
|
.ant-table {
|
||||||
|
scrollbar-color: unset !important;
|
||||||
|
}
|
||||||
@ -1,9 +1,23 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/nextjs.json",
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"files": ["@types/graphql.d.ts"],
|
"files": ["@types/graphql.d.ts"],
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
||||||
"exclude": ["node_modules"],
|
"exclude": ["node_modules"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"incremental": true,
|
||||||
|
"downlevelIteration": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["*"]
|
"@/*": ["*"]
|
||||||
|
|||||||
16
package.json
16
package.json
@ -2,10 +2,6 @@
|
|||||||
"name": "evocalculator.client",
|
"name": "evocalculator.client",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"workspaces": [
|
|
||||||
"apps/*",
|
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "dotenv -e .env turbo run build",
|
"build": "dotenv -e .env turbo run build",
|
||||||
"clean": "turbo run clean",
|
"clean": "turbo run clean",
|
||||||
@ -15,23 +11,19 @@
|
|||||||
"lint:fix": "dotenv -e .env.local turbo run lint:fix",
|
"lint:fix": "dotenv -e .env.local turbo run lint:fix",
|
||||||
"test": "dotenv -e .env.local turbo run test",
|
"test": "dotenv -e .env.local turbo run test",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"precommit": "yarn format && yarn lint:fix && yarn test",
|
"precommit": "pnpm format && pnpm lint:fix && pnpm test",
|
||||||
"graphql:update": "dotenv -e .env.local node ./scripts/graphql-update.js",
|
"graphql:update": "dotenv -e .env.local turbo run graphql:update",
|
||||||
"graphql:codegen": "dotenv -e .env.local node ./scripts/graphql-codegen.js"
|
"graphql:codegen": "dotenv -e .env.local turbo run graphql:codegen"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dotenv-cli": "^7.0.0",
|
"dotenv-cli": "^7.0.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"lint-staged": "^13.2.0",
|
"lint-staged": "^13.2.0",
|
||||||
"prettier": "^2.8.4",
|
"prettier": "^2.8.4",
|
||||||
"tools": "*",
|
|
||||||
"turbo": "^1.12.4"
|
"turbo": "^1.12.4"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.17",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0",
|
"node": ">=18.0.0"
|
||||||
"npm": ">=7.0.0"
|
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,jsx,ts,tsx}": [
|
"*.{js,jsx,ts,tsx}": [
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
module.exports = {
|
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
|
||||||
root: true,
|
|
||||||
extends: [
|
module.exports = createConfig('typescript', {
|
||||||
'@vchikalkin/eslint-config-awesome/typescript/config',
|
|
||||||
'@vchikalkin/eslint-config-awesome/typescript/rules',
|
|
||||||
],
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: './tsconfig.json',
|
project: './tsconfig.json',
|
||||||
tsconfigRootDir: __dirname,
|
tsconfigRootDir: __dirname,
|
||||||
},
|
},
|
||||||
};
|
ignorePatterns: ['*.config.js', '.eslintrc.js'],
|
||||||
|
root: true,
|
||||||
|
});
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
"lint": "TIMING=1 eslint \"**/*.ts*\""
|
"lint": "TIMING=1 eslint \"**/*.ts*\""
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vchikalkin/eslint-config-awesome": "^1.1.1",
|
"@vchikalkin/eslint-config-awesome": "^1.1.6",
|
||||||
"eslint": "^8.46.0"
|
"eslint": "^8.52.0",
|
||||||
},
|
"tsconfig": "workspace:*"
|
||||||
"dependencies": {}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
"extends": "tsconfig/common.json",
|
"extends": "tsconfig/common.json",
|
||||||
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
||||||
"exclude": ["dist", "build", "node_modules"],
|
"exclude": ["dist", "build", "node_modules"],
|
||||||
"compilerOptions": { "outDir": "./build" }
|
"compilerOptions": { "outDir": "./build", "lib": ["DOM", "ES2020"] }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"display": "Next.js",
|
|
||||||
"extends": "./base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES6",
|
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
|
||||||
"allowJs": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strict": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"noEmit": true,
|
|
||||||
"incremental": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"module": "esnext",
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"jsx": "preserve"
|
|
||||||
},
|
|
||||||
"include": ["src", "next-env.d.ts"],
|
|
||||||
"exclude": ["node_modules"]
|
|
||||||
}
|
|
||||||
@ -1,15 +1,17 @@
|
|||||||
module.exports = {
|
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
|
||||||
root: true,
|
|
||||||
extends: [
|
module.exports = createConfig('react-typescript', {
|
||||||
'@vchikalkin/eslint-config-awesome/react-typescript/config',
|
|
||||||
'@vchikalkin/eslint-config-awesome/react-typescript/rules',
|
|
||||||
],
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: './tsconfig.json',
|
project: './tsconfig.json',
|
||||||
tsconfigRootDir: __dirname,
|
tsconfigRootDir: __dirname,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
'import/no-duplicates': 'off',
|
||||||
|
'react/forbid-component-props': 'off',
|
||||||
|
'import/consistent-type-specifier-style': 'off',
|
||||||
'unicorn/filename-case': 'off',
|
'unicorn/filename-case': 'off',
|
||||||
'react/jsx-no-bind': 'off',
|
'react/jsx-no-bind': 'off',
|
||||||
},
|
},
|
||||||
};
|
ignorePatterns: ['*.config.js', '.eslintrc.js'],
|
||||||
|
root: true,
|
||||||
|
});
|
||||||
|
|||||||
@ -12,18 +12,18 @@
|
|||||||
"@types/react-dom": "^18.2.6",
|
"@types/react-dom": "^18.2.6",
|
||||||
"@types/rebass": "^4.0.10",
|
"@types/rebass": "^4.0.10",
|
||||||
"@types/styled-components": "^5.1.26",
|
"@types/styled-components": "^5.1.26",
|
||||||
"@vchikalkin/eslint-config-awesome": "^1.1.1",
|
"@vchikalkin/eslint-config-awesome": "^1.1.6",
|
||||||
"eslint": "^8.46.0",
|
"eslint": "^8.52.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"tsconfig": "*",
|
"tsconfig": "workspace:*",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/cssinjs": "^1.10.1",
|
"@ant-design/cssinjs": "^1.18.4",
|
||||||
"@ant-design/icons": "^5.1.4",
|
"@ant-design/icons": "^5.3.0",
|
||||||
"antd": "^5.6.3",
|
"antd": "^5.14.2",
|
||||||
"rebass": "^4.0.7",
|
"rebass": "^4.0.7",
|
||||||
"styled-components": "^5.3.6",
|
"styled-components": "^5.3.11",
|
||||||
"use-debounce": "^9.0.3"
|
"use-debounce": "^9.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14073
pnpm-lock.yaml
generated
Normal file
14073
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
packages:
|
||||||
|
- "apps/**"
|
||||||
|
- 'packages/**'
|
||||||
@ -1,5 +0,0 @@
|
|||||||
const run = require('tools/scripts');
|
|
||||||
|
|
||||||
const command = ['yarn', 'workspace', 'web', 'graphql:codegen'].join(' ');
|
|
||||||
|
|
||||||
run(command, '*** Update GraphQL files ***');
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
const run = require('tools/scripts');
|
|
||||||
|
|
||||||
const command = ['yarn', 'workspace', 'web', 'graphql:update'].join(' ');
|
|
||||||
|
|
||||||
run(command, '*** Update GraphQL files ***');
|
|
||||||
@ -24,6 +24,12 @@
|
|||||||
},
|
},
|
||||||
"clean": {
|
"clean": {
|
||||||
"cache": false
|
"cache": false
|
||||||
|
},
|
||||||
|
"graphql:codegen": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"graphql:update": {
|
||||||
|
"cache": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user