Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions apps/core/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM node:18-alpine AS base

# This Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker.
# Make sure you update both files!

FROM base AS builder
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk update
RUN apk add --no-cache libc6-compat
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN npm run prepare:ci
RUN turbo prune core --docker

# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app

# First install the dependencies (as they change less often)
COPY --from=builder /app/out/json/ .
RUN yarn install

# Build the project
COPY --from=builder /app/out/full/ .

# Uncomment and use build args to enable remote caching
# ARG TURBO_TEAM
# ENV TURBO_TEAM=$TURBO_TEAM

# ARG TURBO_TOKEN
# ENV TURBO_TOKEN=$TURBO_TOKEN

RUN yarn turbo build

FROM base AS runner
WORKDIR /app

# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/core/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/core/.next/static ./apps/core/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/core/public ./apps/core/public

CMD node apps/core/server.js
1 change: 1 addition & 0 deletions apps/core/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const nextConfig = {
images: {
domains: ["images.unsplash.com"],
},
output: "standalone",
};

export default nextConfig;
Binary file modified bun.lockb
Binary file not shown.
14 changes: 10 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
version: '3.8'
services:
core-app:
core:
container_name: web
build:
context: .
dockerfile: Dockerfile
dockerfile: ./apps/core/Dockerfile
restart: always
ports:
- "3000:3000"
- 3000:3000
# Define a network, which allows containers to communicate
# with each other, by using their container name as a hostname
# networks:
# app_network:
# external: true
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"ui:add": "bun --filter @repo/ui ui:add",
"gen:api": "turbo gen api",
"prepare": "husky",
"deploy": "git pull origin main && git push vercel main",
"prepare:ci": "node ./scripts/prepare.js",
"deploy": "git pull origin main && git push vercel main",
"rebase:main": "git fetch origin main && git rebase main"
},
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions packages/apis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"react": "^18"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20",
"@types/react": "^18",
Expand All @@ -27,6 +27,7 @@
},
"dependencies": {
"@anatine/zod-mock": "^3.13.4",
"@faker-js/faker": "^9.5.1",
"@repo/ui": "*",
"@tanstack/react-query": "^5.62.2",
"@tanstack/react-query-devtools": "^5.62.2",
Expand Down
7 changes: 4 additions & 3 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "@repo/design-system",
"version": "1.0.0",
"scripts": {
"build": "bun run src/scripts/build.ts"
"build": "ts-node src/scripts/build.ts"
},
"exports": {
"./styles": "./src/styles/main.scss",
"./styles": "./src/styles/main.scss",
"./tailwind": "./src/tailwind/config.ts"
},
"devDependencies": {
"@repo/typescript-config": "*",
"style-dictionary": "^4.3.2"
"style-dictionary": "^4.3.2",
"ts-node": "^10.9.2"
}
}
23 changes: 13 additions & 10 deletions packages/design-system/src/scripts/build-palette-style.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import * as fs from 'fs';
import * as path from 'path';
import { hexToHsl } from './utills.js';
import * as fs from "fs";
import * as path from "path";
import { hexToHsl } from "./utills";

// Paths for input and output files
const inputFilePath = path.join(__dirname, '../tokens/token_palette_primitive.json');
const outputFilePath = path.join(__dirname, '../styles/base/_palette.scss');
const inputFilePath = path.join(
__dirname,
"../tokens/token_palette_primitive.json",
);
const outputFilePath = path.join(__dirname, "../styles/base/_palette.scss");

// Generate SCSS content with groups separated by an empty line
const generateScssContent = (tokens: Record<string, any>): string => {
Expand All @@ -14,17 +17,17 @@ const generateScssContent = (tokens: Record<string, any>): string => {
const groupTokens = tokens[group];
for (const key in groupTokens) {
const value = groupTokens[key];
if (value.$type === 'color') {
if (value.$type === "color") {
lines.push(` --${group}-${key}: ${hexToHsl(value.$value)};`);
}
}
lines.push(''); // Add an empty line after each group
lines.push(""); // Add an empty line after each group
}

return `
@layer base {
:root {
${lines.join('\n')}
${lines.join("\n")}
}
}
`.trim();
Expand All @@ -33,7 +36,7 @@ ${lines.join('\n')}
// Function to build and write SCSS content
export const buildPaletteScss = (): void => {
// Read and parse the JSON file
const rawData = fs.readFileSync(inputFilePath, 'utf-8');
const rawData = fs.readFileSync(inputFilePath, "utf-8");
const tokens = JSON.parse(rawData);

// Generate SCSS content
Expand All @@ -46,7 +49,7 @@ export const buildPaletteScss = (): void => {
}

// Write the SCSS content to the file
fs.writeFileSync(outputFilePath, scssContent, 'utf-8');
fs.writeFileSync(outputFilePath, scssContent, "utf-8");
console.log(`SCSS file created at: ${outputFilePath}`);
};

Expand Down
12 changes: 6 additions & 6 deletions packages/design-system/src/scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { buildColorsTailwind } from "./build-colors-tailwind.js";
import { buildColorsScss } from "./build-colors-style.js";
import { buildPaletteTailwind } from "./build-palette-tailwind.js";
import { buildPaletteScss } from "./build-palette-style.js";
import { buildTailwindConfig } from "./build-config-tailwind.js";
import { buildMainScss } from "./build-main-style.js";
import { buildColorsTailwind } from "./build-colors-tailwind";
import { buildColorsScss } from "./build-colors-style";
import { buildPaletteTailwind } from "./build-palette-tailwind";
import { buildPaletteScss } from "./build-palette-style";
import { buildTailwindConfig } from "./build-config-tailwind";
import { buildMainScss } from "./build-main-style";

const main = () => {
try {
Expand Down
28 changes: 28 additions & 0 deletions scripts/prepare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require("fs");
const path = require("path");

console.log("🚀 Preparing project...");

const packageJsonPath = "./package.json";
const newPackageManager = "[email protected]";

try {
// Read package.json
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));

// Ensure packageManager is only set to Yarn
packageJson.packageManager = newPackageManager;

// Write back to package.json
fs.writeFileSync(
packageJsonPath,
JSON.stringify(packageJson, null, 2) + "\n",
);

console.log(
`✅ Successfully updated packageManager to "${newPackageManager}" in package.json`,
);
} catch (error) {
console.error("❌ Error updating package.json:", error);
process.exit(1);
}
Loading
Loading