merge experimental/migrate-to-pnpm

This commit is contained in:
vchikalkin 2023-11-28 23:47:19 +03:00
parent 1a7cf3f3c5
commit b28c5a4f3f
20 changed files with 9432 additions and 14517 deletions

6
.eslintignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
dist
*.config.*
next-env.d.ts
.next
.eslintrc.js

1
.npmrc Normal file
View File

@ -0,0 +1 @@
auto-install-peers = true

View File

@ -29,5 +29,6 @@
"typescriptreact",
"yaml"
],
"eslint.lintTask.enable": true
"eslint.lintTask.enable": true,
"editor.inlineSuggest.showToolbar": "onHover"
}

View File

@ -1,24 +1,32 @@
# Turborepo starter
This is an official Yarn v1 starter turborepo.
This is an official starter Turborepo.
## Using this example
Run the following command:
```sh
npx create-turbo@latest
```
## What's inside?
This turborepo uses [Yarn](https://classic.yarnpkg.com/) as a package manager. It includes the following packages/apps:
This Turborepo includes the following packages/apps:
### Apps and Packages
- `docs`: a [Next.js](https://nextjs.org/) app
- `web`: another [Next.js](https://nextjs.org/) app
- `ui`: a stub React component library shared by both `web` and `docs` applications
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- `tsconfig`: `tsconfig.json`s used throughout the monorepo
- `@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/typescript-config`: `tsconfig.json`s used throughout the monorepo
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
### Utilities
This turborepo has some additional tools already setup for you:
This Turborepo has some additional tools already setup for you:
- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
@ -30,7 +38,7 @@ To build all apps and packages, run the following command:
```
cd my-turborepo
yarn run build
pnpm build
```
### Develop
@ -39,7 +47,7 @@ To develop all apps and packages, run the following command:
```
cd my-turborepo
yarn run dev
pnpm dev
```
### Remote Caching
@ -55,7 +63,7 @@ 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:
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
```
npx turbo link
@ -65,7 +73,7 @@ npx turbo link
Learn more about the power of Turborepo:
- [Pipelines](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
- [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)

View File

@ -1,2 +0,0 @@
node_modules
dist

View File

@ -1,12 +1,13 @@
module.exports = {
root: true,
extends: [
'@vchikalkin/eslint-config-awesome/typescript/config',
'@vchikalkin/eslint-config-awesome/typescript/rules',
],
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
module.exports = createConfig('typescript', {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
};
ignorePatterns: ['*.config.js', '.eslintrc.js'],
rules: {
'import/no-duplicates': 'off',
'import/consistent-type-specifier-style': 'off',
},
});

View File

@ -1,19 +1,22 @@
# The web Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker.
# Make sure you update this Dockerfile, the Dockerfile in the web workspace and copy that over to Dockerfile in the docs.
# This Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker.
# Make sure you update both files!
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.
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
RUN yarn global add dotenv-cli
RUN pnpm add -g turbo dotenv-cli
COPY . .
RUN turbo prune --scope=api --docker
# Add lockfile and package.json's of isolated subworkspace
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 update
WORKDIR /app
@ -21,13 +24,15 @@ WORKDIR /app
# First install dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
RUN pnpm install
# Build the project and its dependencies
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
RUN yarn dotenv -e .env turbo run build --filter=api...
COPY .env .env
RUN pnpm dotenv -e .env turbo run build --filter=web...
FROM node:alpine AS runner
WORKDIR /app

View File

@ -58,8 +58,9 @@
"@types/ldap-authentication": "^2.2.1",
"@types/node": "^20.8.6",
"@types/supertest": "^2.0.14",
"@vchikalkin/eslint-config-awesome": "^1.1.2",
"@vchikalkin/eslint-config-awesome": "^1.1.5",
"eslint": "^8.51.0",
"fastify": "^4.24.3",
"jest": "29.7.0",
"prettier": "^3.0.3",
"source-map-support": "^0.5.21",
@ -68,7 +69,7 @@
"ts-loader": "^9.5.0",
"ts-node": "^10.9.1",
"tsconfig-paths": "4.2.0",
"typescript": "4.9.5"
"typescript": "5.3.2"
},
"jest": {
"moduleFileExtensions": [

View File

@ -17,5 +17,6 @@
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
}
},
"exclude": ["node_modules"]
}

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,14 @@
module.exports = {
extends: [
'@vchikalkin/eslint-config-awesome/next-typescript/config',
'@vchikalkin/eslint-config-awesome/next-typescript/rules',
],
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
module.exports = createConfig('next-typescript', {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
root: true,
};
rules: {
'import/no-duplicates': 'off',
'import/consistent-type-specifier-style': 'off',
'react/forbid-component-props': 'off',
},
ignorePatterns: ['*.config.js', '.eslintrc.js'],
});

View File

@ -2,47 +2,47 @@
# Make sure you update both files!
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.
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
RUN yarn global add dotenv-cli
RUN pnpm add -g turbo dotenv-cli
COPY . .
RUN turbo prune --scope=web --docker
# Add lockfile and package.json's of isolated subworkspace
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 update
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED 1
# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
RUN pnpm install
# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
COPY .env .env
RUN yarn dotenv -e .env turbo run build --filter=web...
RUN pnpm dotenv -e .env turbo run build --filter=web...
FROM node:alpine AS runner
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED 1
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
COPY --from=installer /app/apps/web/next.config.mjs .
COPY --from=installer /app/apps/web/next.config.js .
COPY --from=installer /app/apps/web/package.json .
# Automatically leverage output traces to reduce image size

View File

@ -1,8 +1,8 @@
import { z } from 'zod';
const { z } = require('zod');
const envSchema = z.object({
APP_DESCRIPTION: z.string(),
APP_BASE_PATH: z.string().optional().default(''),
});
export default envSchema;
module.exports = envSchema;

View File

@ -1,14 +1,10 @@
import envSchema from './config/schema/env.js';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const envSchema = require('./config/schema/env.js');
const { join } = require('path');
const runtimeConfig = envSchema.parse(process.env);
/** @type {import('next').NextConfig} */
const nextConfig = {
module.exports = {
basePath: process.env.APP_BASE_PATH,
eslint: {
ignoreDuringBuilds: true,
@ -22,5 +18,3 @@ const nextConfig = {
serverRuntimeConfig: runtimeConfig,
swcMinify: true,
};
export default nextConfig;

View File

@ -2,7 +2,6 @@
"name": "web",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
@ -12,20 +11,20 @@
},
"dependencies": {
"@fontsource/montserrat": "^5.0.13",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/node": "^20.10.0",
"@types/react": "^18.2.39",
"@types/react-dom": "^18.2.17",
"axios": "^1.5.1",
"next": "^14.0.0",
"next": "^14.0.3",
"normalize.css": "^8.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.69.3",
"typescript": "4.9.5",
"typescript": "5.3.2",
"zod": "^3.22.4"
},
"devDependencies": {
"@vchikalkin/eslint-config-awesome": "^1.1.2",
"@vchikalkin/eslint-config-awesome": "^1.1.5",
"eslint": "^8.51.0"
}
}

View File

@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"compilerOptions": {
"target": "ES2022",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,

View File

@ -2,9 +2,6 @@
"name": "evo-auth",
"version": "0.0.0",
"private": true,
"workspaces": [
"apps/*"
],
"scripts": {
"build": "dotenv -e .env turbo run build",
"dev": "dotenv -e .env.local turbo run dev",
@ -19,9 +16,8 @@
"prettier": "latest",
"turbo": "latest"
},
"packageManager": "pnpm@8.9.0",
"engines": {
"node": ">=14.0.0"
},
"dependencies": {},
"packageManager": "yarn@1.22.19"
"node": ">=18"
}
}

9341
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

3
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,3 @@
packages:
- "apps/*"
- "packages/*"

8677
yarn.lock

File diff suppressed because it is too large Load Diff