Compare commits

...

3 Commits

Author SHA1 Message Date
f41ccda54d feat(docker): dodaj opcjonalne uruchomienie testów podczas buildu
Dodano build arg RUN_TESTS (domyślnie false), który pozwala na
warunkowe uruchomienie quality checks (typecheck + lint) podczas
budowania obrazu Docker.

Użycie:
- Bez testów: docker build -t rentgen .
- Z testami: docker build --build-arg RUN_TESTS=true -t rentgen .

Testy dodają ~10 sekund do czasu buildu.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 14:16:16 +02:00
46cd00253c fix(typecheck): naprawa błędów TypeScript
- Zmiana typu zwracanego w use-survey.ts z Survey.ReactSurveyModel na Survey.Model
- Dodanie brakującej prop refreshToken w StolenDataCluster

Typecheck teraz przechodzi bez błędów.
2025-10-25 14:16:16 +02:00
5edebd4433 Dodaj wsparcie Docker i dokumentację Claude Code
- Dodano Dockerfile z multi-stage build (artifacts + dev environment)
- Dodano .dockerignore dla optymalizacji budowania
- Dodano CLAUDE.md z dokumentacją architektury i workflow dla Claude Code
2025-10-25 14:16:16 +02:00
4 changed files with 78 additions and 1 deletions

16
.dockerignore Normal file
View File

@ -0,0 +1,16 @@
.log
node_modules
sidebar.js
web-ext-artifacts/
lib/*
yarn-error.log
rentgen.zip
# Generated PNG icons (build artifacts)
assets/icons/*.png
assets/icon-addon-*.png
# Exception: do not ignore the `browser-api` directory inside `lib`
!/lib/browser-api/
Dockerfile

59
Dockerfile Normal file
View File

@ -0,0 +1,59 @@
# Rentgen Browser Extension - Docker Build
#
# Usage:
# Build and extract artifacts directly:
# docker buildx build . --output artifacts
#
# Build with tests (typecheck + lint):
# docker build --build-arg RUN_TESTS=true -t rentgen .
#
# Or traditional build (creates full development environment):
# docker build -t rentgen .
# docker run --rm rentgen ls -lh /app/web-ext-artifacts/
#
# Run commands in the container:
# docker run --rm rentgen npm run build:chrome
# docker run --rm rentgen npm run typecheck
# Build stage
FROM node:lts AS builder
# Optional: run tests during build (typecheck + lint)
ARG RUN_TESTS=false
WORKDIR /app
# Copy package files for dependency installation (better layer caching)
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy source code (respecting .dockerignore)
COPY . .
# Build the extension for Firefox (default)
RUN npm run build
# Create the package
RUN npm run create-package
# Optional: run quality checks
RUN if [ "$RUN_TESTS" = "true" ]; then \
echo "Running TypeScript type checking..."; \
npm run typecheck; \
echo "Running web-ext lint..."; \
npm run lint; \
fi
# Artifacts stage - only contains the built artifacts (for --output)
FROM scratch AS artifacts
# Copy only the built extension zip file to root
COPY --from=builder /app/web-ext-artifacts/*.zip /
# Default stage - full development environment
FROM builder
# Default command shows the built artifact
CMD ["ls", "-lh", "/app/web-ext-artifacts/"]

View File

@ -8,7 +8,7 @@ import verbs, { v } from './verbs';
export default function useSurvey( export default function useSurvey(
clusters: RequestCluster[], clusters: RequestCluster[],
{ onComplete }: { onComplete: (sender: { data: RawAnswers }) => void } { onComplete }: { onComplete: (sender: { data: RawAnswers }) => void }
): Survey.ReactSurveyModel | null { ): Survey.Model | null {
const [survey, setSurvey] = React.useState<Survey.Model | null>(null); const [survey, setSurvey] = React.useState<Survey.Model | null>(null);
React.useEffect(() => { React.useEffect(() => {
const model = generateSurveyQuestions(clusters); const model = generateSurveyQuestions(clusters);

View File

@ -106,6 +106,7 @@ export default function StolenDataCluster({
cookiesOnly, cookiesOnly,
cookiesOrOriginOnly, cookiesOrOriginOnly,
detailsVisibility, detailsVisibility,
refreshToken,
}: { }: {
origin: string; origin: string;
shorthost: string; shorthost: string;
@ -113,6 +114,7 @@ export default function StolenDataCluster({
cookiesOnly: boolean; cookiesOnly: boolean;
cookiesOrOriginOnly: boolean; cookiesOrOriginOnly: boolean;
detailsVisibility: boolean; detailsVisibility: boolean;
refreshToken?: number;
}) { }) {
const cluster = getMemory().getClustersForOrigin(origin)[shorthost]; const cluster = getMemory().getClustersForOrigin(origin)[shorthost];
const fullHosts = cluster.getFullHosts(); const fullHosts = cluster.getFullHosts();