-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve configs, dockerfile, ci and pnpm workspace
- Loading branch information
JH
committed
Mar 7, 2024
1 parent
2b2315a
commit d7ab19e
Showing
15 changed files
with
4,952 additions
and
2,749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
node_modules | ||
Dockerfile | ||
compose.yaml | ||
.git | ||
.gitignore | ||
*.md | ||
dist | ||
.github | ||
.vscode | ||
.next | ||
lib/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
/coverage | ||
.pnp | ||
.pnp.js | ||
.pnpm-store | ||
|
||
# testing | ||
coverage | ||
|
||
# next.js | ||
.next/ | ||
out/ | ||
|
||
# production | ||
build | ||
dist | ||
lib/lib | ||
.pnpm-store | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
link-workspace-packages=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
**/node_modules | ||
**/.next | ||
**/dist | ||
**/lib/lib | ||
/lib/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
{ | ||
"printWidth": 80, | ||
"endOfLine": "auto", | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "none" | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"orta.vscode-jest" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"jest.outputConfig": { | ||
"clearOnRun": "none", | ||
"revealOn": "demand", | ||
"revealWithFocus": "none" | ||
}, | ||
"testing.openTesting": "neverOpen", | ||
"eslint.workingDirectories": ["lib/", "examples/express/", "examples/next/"], | ||
"editor.codeActionsOnSave": { | ||
"source.eslint.fixAll": "explicit", | ||
"source.fixAll": "explicit" | ||
}, | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,74 @@ | ||
FROM node:20 AS base | ||
FROM node:20-slim AS base | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
COPY . /app | ||
WORKDIR /app | ||
RUN corepack enable pnpm | ||
|
||
FROM base AS prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
|
||
FROM base AS build | ||
# Express | ||
FROM base AS deps-express | ||
WORKDIR /home/node/repo | ||
|
||
COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ./ | ||
COPY ./examples/express/package.json ./examples/express/ | ||
COPY ./lib/package.json ./lib/ | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
|
||
FROM base AS build-express | ||
WORKDIR /home/node/repo | ||
COPY --from=deps-express /home/node/repo ./ | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
COPY . /home/node/repo | ||
|
||
RUN pnpm --filter !esi-next run build | ||
RUN pnpm deploy --filter esi-express --prod /home/node/esi-express | ||
|
||
FROM base AS esi-express | ||
COPY --from=build-express /home/node/esi-express /home/node/esi-express | ||
WORKDIR /home/node/esi-express | ||
USER node | ||
EXPOSE 3000 | ||
CMD [ "node", "dist/server.js" ] | ||
|
||
|
||
|
||
# Nextjs | ||
FROM base AS deps-next | ||
WORKDIR /home/node/repo | ||
|
||
COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ./ | ||
COPY ./examples/next/package.json ./examples/next/ | ||
COPY ./lib/package.json ./lib/ | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
RUN pnpm run -r build | ||
|
||
FROM base AS lib | ||
COPY --from=prod-deps /app/lib/node_modules/ /app/lib/node_modules | ||
COPY --from=build /app/lib/dist /app/lib/dist | ||
|
||
FROM lib AS express | ||
COPY --from=prod-deps /app/examples/express/node_modules/ /app/examples/express/node_modules | ||
COPY --from=build /app/examples/express/dist /app/examples/express/dist | ||
WORKDIR /app/examples/express | ||
FROM base AS build-next | ||
WORKDIR /home/node/repo | ||
COPY --from=deps-next /home/node/repo ./ | ||
COPY . /home/node/repo | ||
|
||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
RUN pnpm --filter !esi-express run build | ||
RUN pnpm deploy --filter esi-next --prod /home/node/esi-next | ||
|
||
|
||
FROM base AS esi-next | ||
WORKDIR /home/node/esi-next | ||
|
||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
# Set the correct permission for prerender cache | ||
RUN mkdir .next | ||
RUN chown node:node .next | ||
COPY --from=build-next --chown=node:node /home/node/esi-next/public ./public | ||
COPY --from=build-next --chown=node:node /home/node/esi-next/node_modules ./node_modules | ||
COPY --from=build-next --chown=node:node /home/node/esi-next/.next/standalone ./ | ||
COPY --from=build-next --chown=node:node /home/node/esi-next/dist ./dist | ||
COPY --from=build-next --chown=node:node /home/node/esi-next/.next/static ./.next/static | ||
|
||
USER node | ||
EXPOSE 3000 | ||
CMD [ "pnpm", "start" ] | ||
|
||
FROM lib AS next | ||
COPY --from=prod-deps /app/packages/app2/node_modules/ /app/packages/app2/node_modules | ||
COPY --from=build /app/packages/app2/dist /app/packages/app2/dist | ||
WORKDIR /app/packages/app2 | ||
EXPOSE 30001 | ||
CMD [ "pnpm", "start" ] | ||
CMD [ "node", "dist/server.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,29 @@ | |
"repository": "https://github.com/dunglas/react-esi", | ||
"license": "MIT", | ||
"author": "Kévin Dunglas", | ||
"scripts": {}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"format": "prettier --write ." | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
"node": ">=18.12.0" | ||
"node": ">=20.11.0" | ||
}, | ||
"pnpm": { | ||
"overrides": { | ||
"@types/react": "18.2.64", | ||
"@types/react-dom": "18.2.21", | ||
"typescript": "5.3.3" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.11.25", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-react": "^7.34.0", | ||
"prettier": "^3.2.5", | ||
"typescript": "~5.3.3", | ||
"typescript-eslint": "^7.1.1" | ||
} | ||
} | ||
} |
Oops, something went wrong.