Skip to content

Commit

Permalink
fix: Wrong lib exports, Dockerfile not in root dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Loxeris committed Jun 17, 2024
1 parent 7edefef commit 48631be
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 23 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimize the size and complexity of the final Docker image by separating the
# build stage and the runtime stage into two different steps

# Stage 1: Build the Next.js application
FROM node:alpine AS build
WORKDIR /app
# Install the project dependencies
COPY package*.json ./
RUN npm ci
# Copy the rest of the application to the working directory
COPY . .
# Build the static export with telemetry disabled (https://nextjs.org/telemetry)
RUN NEXT_TELEMETRY_DISABLED=1 npm run build

# Stage 2: Copy the website from the previous container to a Nginx container
FROM nginxinc/nginx-unprivileged:alpine
EXPOSE 8080
COPY --from=build /app/out /usr/share/nginx/html
COPY ./config/nginx/default.conf /etc/nginx/conf.d/default.conf
16 changes: 16 additions & 0 deletions config/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
listen 8080;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri.html $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build": "lerna run build",
"build-lib": "lerna run build --scope diracx-web-components",
"lint": "lerna run lint",
"ts-lint": "lerna run ts-lint"
"ts-lint": "lerna run ts-lint",
"pack": "npm pack -w diracx-web-components"
}
}
4 changes: 2 additions & 2 deletions packages/diracx-web-components/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"main": "../dist/components/index.js",
"module": "../dist/components/index.mjs",
"main": "../dist/components/index.cjs",
"module": "../dist/components/index.js",
"types": "../dist/components/index.d.ts"
}
4 changes: 2 additions & 2 deletions packages/diracx-web-components/contexts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"main": "../dist/contexts/index.js",
"module": "../dist/contexts/index.mjs",
"main": "../dist/contexts/index.cjs",
"module": "../dist/contexts/index.js",
"types": "../dist/contexts/index.d.ts"
}
4 changes: 2 additions & 2 deletions packages/diracx-web-components/hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"main": "../dist/hooks/index.js",
"module": "../dist/hooks/index.mjs",
"main": "../dist/hooks/index.cjs",
"module": "../dist/hooks/index.js",
"types": "../dist/hooks/index.d.ts"
}
12 changes: 6 additions & 6 deletions packages/diracx-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "Useful components for diracx-web",
"scripts": {
"build": "tsup --minify",
"dev": "tsup --watch --sourcemap",
"dev": "tsup --watch",
"test": "jest --ci",
"lint": "eslint src",
"ts-lint": "tsc -noEmit -incremental",
"prepack": "npm run build"
"prepack": "rm -rf dist && npm run build"
},
"author": "",
"license": "GPL-3.0",
Expand Down Expand Up @@ -55,25 +55,25 @@
"./package.json": "./package.json",
"./components": {
"module": "./dist/components/index.js",
"require": "./dist/components/index.js",
"require": "./dist/components/index.cjs",
"types": "./dist/components/index.d.ts",
"default": "./dist/components/index.js"
},
"./contexts": {
"module": "./dist/contexts/index.js",
"require": "./dist/contexts/index.js",
"require": "./dist/contexts/index.cjs",
"types": "./dist/contexts/index.d.ts",
"default": "./dist/contexts/index.js"
},
"./hooks": {
"module": "./dist/hooks/index.js",
"require": "./dist/hooks/index.js",
"require": "./dist/hooks/index.cjs",
"types": "./dist/hooks/index.d.ts",
"default": "./dist/hooks/index.js"
},
"./types": {
"module": "./dist/types/index.js",
"require": "./dist/types/index.js",
"require": "./dist/types/index.cjs",
"types": "./dist/types/index.d.ts",
"default": "./dist/types/index.js"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import * as React from "react";
import React from "react";
import { JobDataTable } from "../ui/JobDataTable";
import ApplicationHeader from "@/components/ui/ApplicationHeader";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Autocomplete from "@mui/material/Autocomplete";
import TextField from "@mui/material/TextField";
import { CssBaseline, Stack } from "@mui/material";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import * as React from "react";
import React from "react";
import { useOidc } from "@axa-fr/react-oidc";
import { useOIDCContext } from "@/hooks/oidcConfiguration";
import { useMUITheme } from "@/hooks/theme";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import * as React from "react";
import React from "react";
import { useOidcAccessToken } from "@axa-fr/react-oidc";
import { useOIDCContext } from "@/hooks/oidcConfiguration";
import ApplicationHeader from "@/components/ui/ApplicationHeader";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import * as React from "react";
import React from "react";
import AppBar from "@mui/material/AppBar";
import Box from "@mui/material/Box";
import CssBaseline from "@mui/material/CssBaseline";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import * as React from "react";
import React from "react";
import { alpha } from "@mui/material/styles";
import Box from "@mui/material/Box";
import Table from "@mui/material/Table";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react";
import React from "react";
import Box from "@mui/material/Box";
import {
blue,
Expand Down
3 changes: 2 additions & 1 deletion packages/diracx-web-components/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default defineConfig([
experimentalDts: true, // Seems to work fine, lower memory usage and faster than dts
target: "es5",
bundle: true,
sourcemap: true,
async onSuccess() {
// recursively go through each js file in dist and add "use client" to the top
const distDir = path.join(__dirname, "dist");
Expand Down Expand Up @@ -52,8 +53,8 @@ export default defineConfig([
],
format: ["esm", "cjs"],
experimentalDts: true, // Seems to work fine, lower memory usage and faster than dts
clean: true,
target: "es5",
bundle: false,
sourcemap: true
},
]);
4 changes: 2 additions & 2 deletions packages/diracx-web-components/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"main": "../dist/types/index.js",
"module": "../dist/types/index.mjs",
"main": "../dist/types/index.cjs",
"module": "../dist/types/index.js",
"types": "../dist/types/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/diracx-web/src/app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import * as React from "react";
import React from "react";
import CssBaseline from "@mui/material/CssBaseline";
import { Box } from "@mui/material";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
Expand Down

0 comments on commit 48631be

Please sign in to comment.