diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 03c6a87..8761c80 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -13,7 +13,6 @@ on: env: NODE_VERSION: '20' - PNPM_VERSION: '8' jobs: changes: @@ -53,25 +52,13 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} + cache: 'npm' - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - version: ${{ env.PNPM_VERSION }} - - - name: Cache pnpm store - uses: actions/cache@v3 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - name: Install dependencies - run: pnpm install --frozen-lockfile --store ~/.pnpm-store --prefer-offline + run: npm ci - name: Lint - run: pnpm --filter @worksight/${{ matrix.app }} lint + run: npm run lint --workspace=${{ matrix.app }} - name: Build Docker image run: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3a4a658..df9029c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,10 +1,10 @@ -name: "CodeQL" +name: 'CodeQL' on: push: - branches: ["main"] + branches: ['main'] pull_request: - branches: ["main"] + branches: ['main'] schedule: - cron: '0 2 * * 0' # Weekly scan workflow_dispatch: # Allow manual runs @@ -24,39 +24,25 @@ jobs: language: [javascript-typescript] steps: - - name: Checkout repository + - name: Checkout code uses: actions/checkout@v4 - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - queries: +security-extended,security-and-quality - - # Install deps so CodeQL has a build context - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' + cache: 'npm' - - name: Cache pnpm store - uses: actions/cache@v3 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - name: Install dependencies - run: | - corepack enable - pnpm install --frozen-lockfile --store ~/.pnpm-store --prefer-offline + run: npm ci - - name: Build Next.js - run: pnpm --filter web build + - name: Type check + run: npm run type-check - - name: Build VitePress - run: pnpm --filter docs build + - name: Lint check + run: npm run lint - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + - name: Build application + run: npm run build + env: + NEXT_TELEMETRY_DISABLED: 1 diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 79ebd09..4b06f11 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -10,7 +10,6 @@ on: env: NODE_VERSION: '20' - PNPM_VERSION: '8' NEXT_PUBLIC_SUPABASE_URL: ${{ vars.NEXT_PUBLIC_SUPABASE_URL }} NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ vars.NEXT_PUBLIC_SUPABASE_ANON_KEY }} NEXT_PUBLIC_IS_OFFLINE: ${{ vars.NEXT_PUBLIC_IS_OFFLINE || 'false' }} @@ -28,31 +27,20 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} + cache: 'npm' - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - version: ${{ env.PNPM_VERSION }} - - - name: Cache pnpm store - uses: actions/cache@v3 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - name: Install dependencies - run: pnpm install --frozen-lockfile --store ~/.pnpm-store --prefer-offline + run: npm ci - name: Build web app - run: pnpm build --filter=@worksight/web + run: npm run build --workspace=web - name: Start application run: | cd apps/web - pnpm start & + npm start & echo $! > server.pid + shell: bash - name: Wait for server ready run: sleep 15 @@ -61,13 +49,15 @@ jobs: run: | npx lhci autorun --upload.target=temporary-public-storage env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # reuse built-in token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Stop application run: | - if [ -f apps/web/server.pid ]; then - kill $(cat apps/web/server.pid) || true + cd apps/web + if [ -f server.pid ]; then + kill $(cat server.pid) || true fi + shell: bash bundle-analysis: name: Bundle Size Analysis @@ -80,25 +70,13 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} + cache: 'npm' - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - version: ${{ env.PNPM_VERSION }} - - - name: Cache pnpm store - uses: actions/cache@v3 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - name: Install dependencies - run: pnpm install --frozen-lockfile --store ~/.pnpm-store --prefer-offline + run: npm ci - name: Analyze bundle - run: pnpm build:analyze --filter=@worksight/web + run: npm run build:analyze --workspace=web - name: Upload bundle analysis uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa7fb43..6bb8426 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,6 @@ on: env: NODE_VERSION: '20' - PNPM_VERSION: '8' jobs: build-apps: @@ -27,28 +26,16 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} + cache: 'npm' - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - version: ${{ env.PNPM_VERSION }} - - - name: Cache pnpm store - uses: actions/cache@v3 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - name: Install dependencies - run: pnpm install --frozen-lockfile --store ~/.pnpm-store --prefer-offline + run: npm ci - name: Lint ${{ matrix.app }} - run: pnpm --filter @worksight/${{ matrix.app }} lint + run: npm run lint --workspace=${{ matrix.app }} - name: Build ${{ matrix.app }} - run: pnpm build --filter=@worksight/${{ matrix.app }} + run: npm run build --workspace=${{ matrix.app }} - name: Package ${{ matrix.app }} into ZIP run: | diff --git a/apps/docs/Dockerfile b/apps/docs/Dockerfile index c8900c0..28bafc6 100644 --- a/apps/docs/Dockerfile +++ b/apps/docs/Dockerfile @@ -2,19 +2,19 @@ FROM node:20-alpine AS builder WORKDIR /app -RUN npm install -g pnpm +RUN npm install # Copy root manifests (required for monorepo install) -COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./ +COPY package.json turbo.json ./ COPY apps/docs/package.json apps/docs/ -RUN pnpm install --frozen-lockfile --filter=@worksight/docs +RUN npm install --filter=apps/docs # Copy the rest of the project COPY . . # Build VitePress site -RUN pnpm --filter=@worksight/docs build +RUN pnpm --filter=apps/docs build # ---- Runtime stage ---- FROM nginx:alpine diff --git a/apps/docs/package.json b/apps/docs/package.json index 4cd13e7..eea9e59 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -1,5 +1,5 @@ { - "name": "@worksight/docs", + "name": "docs", "version": "0.1.0", "private": true, "type": "module", @@ -8,7 +8,7 @@ "build": "vitepress build", "preview": "vitepress preview", "type-check": "echo 'Type checking skipped for docs - VitePress handles this during build'", - "quality": "echo 'pnpm quality doesnt exist, give up.' ", + "quality": "echo 'npm quality doesnt exist, give up.' ", "clean": "rm -r .next dist .turbo" }, "devDependencies": { diff --git a/apps/docs/vercel.json b/apps/docs/vercel.json index 88b2a86..3cd1e7f 100644 --- a/apps/docs/vercel.json +++ b/apps/docs/vercel.json @@ -1,10 +1,10 @@ { "version": 2, - "installCommand": "pnpm install --filter=docs", - "buildCommand": "pnpm build --filter=docs", + "installCommand": "npm install", + "buildCommand": "npm run build --workspace=docs", "outputDirectory": ".vitepress/dist", "framework": "vitepress", "build": { "env": {} } -} +} \ No newline at end of file diff --git a/apps/docs/website/dev/api/authentication.md b/apps/docs/website/dev/api/authentication.md index 48d6a93..83bb3d1 100644 --- a/apps/docs/website/dev/api/authentication.md +++ b/apps/docs/website/dev/api/authentication.md @@ -492,10 +492,3 @@ When migrating to newer API versions: - **v1**: Supported until December 2024 - **v2**: Current stable version - **v3**: Beta, general availability Q2 2024 - -## Next Steps - -- [Survey Endpoints](./survey-endpoints.md) - Manage surveys and assessments -- [User Management](./user-management.md) - User administration API -- [Webhooks](./webhooks.md) - Real-time event notifications -- [Rate Limiting Guide](./rate-limiting.md) - Optimize your API usage diff --git a/apps/docs/website/dev/api/overview.md b/apps/docs/website/dev/api/overview.md index 6226ea4..f38fdd6 100644 --- a/apps/docs/website/dev/api/overview.md +++ b/apps/docs/website/dev/api/overview.md @@ -404,11 +404,11 @@ curl -X POST https://api.worksight.com/v1/webhooks \ #### JavaScript/TypeScript ```bash -npm install @worksight/api-client +npm install apps/api-client ``` ```javascript -import { WorkSightAPI } from '@worksight/api-client'; +import { WorkSightAPI } from 'apps/api-client'; const api = new WorkSightAPI({ apiKey: 'your-api-key', @@ -554,10 +554,3 @@ The staging environment includes sample data for testing: - **Uptime**: 99.9% guaranteed - **Response Time**: < 200ms average - **Support Response**: < 24 hours for standard plans, < 4 hours for enterprise - -## Next Steps - -- [Authentication Guide](./authentication.md) - Detailed authentication setup -- [Survey Endpoints](./survey-endpoints.md) - Survey management API -- [User Management](./user-management.md) - User administration API -- [Webhooks Guide](./webhooks.md) - Real-time event notifications diff --git a/apps/docs/website/dev/api/user-management.md b/apps/docs/website/dev/api/user-management.md index a84837d..5b61af0 100644 --- a/apps/docs/website/dev/api/user-management.md +++ b/apps/docs/website/dev/api/user-management.md @@ -778,7 +778,7 @@ const users = await worksight.users.getBulk(['user_1', 'user_2', 'user_3']); ### JavaScript/TypeScript ```typescript -import { WorkSight } from '@worksight/sdk'; +import { WorkSight } from 'apps/sdk'; const worksight = new WorkSight({ apiKey: process.env.WORKSIGHT_API_KEY, @@ -836,10 +836,3 @@ worksight.users.update_status( reason='Employee left the company' ) ``` - -## Next Steps - -- [Survey Endpoints](./survey-endpoints.md) - Manage surveys and assessments -- [Reports API](./reports.md) - Generate and access reports -- [Webhooks](./webhooks.md) - Real-time event notifications -- [Organizations](./organizations.md) - Manage organizational settings diff --git a/apps/docs/website/dev/vitepress.md b/apps/docs/website/dev/vitepress.md index 5e3b7e4..43cfdf1 100644 --- a/apps/docs/website/dev/vitepress.md +++ b/apps/docs/website/dev/vitepress.md @@ -112,7 +112,7 @@ npm install --save-dev vitepress npm run docs:dev ``` - Visit [http://localhost:5173](http://localhost:5173) (or as shown in terminal). + Visit localhost:5173 (or as shown in terminal). - Rebuild static site: diff --git a/apps/docs/website/features/burnout-assessment.md b/apps/docs/website/features/burnout-assessment.md index b8d11e9..6876ceb 100644 --- a/apps/docs/website/features/burnout-assessment.md +++ b/apps/docs/website/features/burnout-assessment.md @@ -386,9 +386,3 @@ GET /api/assessments/scores/{employeeId} - **Trend Improvement**: Reducing average burnout scores - **Early Detection**: Identifying risks before they become critical - **Intervention Effectiveness**: Positive outcomes from support measures - -## Next Steps - -- Learn about [Admin Dashboard](./admin-dashboard.md) for managing assessments -- Explore [Reporting Features](./reporting.md) for analyzing results -- Check [API Documentation](../api/overview.md) for integration options diff --git a/apps/docs/website/features/reporting.md b/apps/docs/website/features/reporting.md index aea1074..f840852 100644 --- a/apps/docs/website/features/reporting.md +++ b/apps/docs/website/features/reporting.md @@ -672,9 +672,3 @@ interface CacheConfig { - Check permissions and access rights - Verify storage capacity - Review security settings - -## Next Steps - -- Explore [API Documentation](../api/overview.md) for custom integrations -- Learn about [Admin Dashboard](./admin-dashboard.md) for report management -- Check [Privacy Policy](../legal/privacy-policy.md) for compliance guidelines diff --git a/apps/docs/website/guide/configuration.md b/apps/docs/website/guide/configuration.md index d2e33f0..6e56080 100644 --- a/apps/docs/website/guide/configuration.md +++ b/apps/docs/website/guide/configuration.md @@ -353,9 +353,3 @@ pnpm email:test # Run health checks pnpm health:check ``` - -## Next Steps - -- Set up [Survey System](./survey-system.md) -- Configure [Admin Dashboard](./admin-dashboard.md) -- Explore [API Documentation](../api/overview.md) diff --git a/apps/docs/website/guide/getting-started.md b/apps/docs/website/guide/getting-started.md index 92ef01d..63a60b8 100644 --- a/apps/docs/website/guide/getting-started.md +++ b/apps/docs/website/guide/getting-started.md @@ -101,10 +101,3 @@ Role-based dashboards showing: - Notification settings - Theme customization - Admin controls - -## Next Steps - -- [Learn about the Survey System](./survey-system) -- [Explore Task Management](./task-management) -- [Set up Admin Dashboard](./admin-dashboard) -- [Configure Reporting](./reporting) diff --git a/apps/docs/website/guide/installation.md b/apps/docs/website/guide/installation.md index 8aed834..4f34976 100644 --- a/apps/docs/website/guide/installation.md +++ b/apps/docs/website/guide/installation.md @@ -192,15 +192,7 @@ pnpm install If you encounter issues: -1. Check the [troubleshooting section](../api/overview.md) +1. Check the [troubleshooting section] 2. Search existing [GitHub issues](https://github.com/4sightorg/worksight/issues) 3. Create a new issue with detailed information - -## Next Steps - -After installation: - -1. [Configure your application](./configuration.md) -2. Explore the [Survey System](./survey-system.md) -3. Set up [Admin Dashboard](./admin-dashboard.md) diff --git a/apps/docs/website/guide/overview.md b/apps/docs/website/guide/overview.md index 32eb4bf..5b815f2 100644 --- a/apps/docs/website/guide/overview.md +++ b/apps/docs/website/guide/overview.md @@ -98,11 +98,11 @@ All API responses follow this structure: ### JavaScript/TypeScript ```bash -npm install @worksight/api-client +npm install apps/api-client ``` ```typescript -import { WorkSightAPI } from '@worksight/api-client'; +import { WorkSightAPI } from 'apps/api-client'; const api = new WorkSightAPI({ baseURL: 'https://api.worksight.com', diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 724041e..8b1eae6 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -7,7 +7,7 @@ RUN corepack enable FROM base AS deps COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./ COPY apps/web/package.json apps/web/ -RUN pnpm install --frozen-lockfile --filter=@worksight/web +RUN pnpm install --frozen-lockfile --filter=apps/web # ---- Build ---- FROM deps AS build @@ -16,7 +16,7 @@ ENV NEXT_PUBLIC_SUPABASE_URL="http://localhost:54321" ENV NEXT_PUBLIC_SUPABASE_ANON_KEY="dummy_anon_key" ENV NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY="dummy_key" ENV NEXT_PUBLIC_IS_OFFLINE=false -RUN pnpm --filter=@worksight/web build +RUN pnpm --filter=apps/web build # ---- Runtime ---- FROM base AS runtime @@ -29,4 +29,4 @@ COPY --from=build /app/node_modules /app/node_modules COPY apps/web/package.json apps/web/ EXPOSE 3000 -CMD ["pnpm", "--filter=@worksight/web", "start"] +CMD ["pnpm", "--filter=apps/web", "start"] diff --git a/apps/web/netlify.toml b/apps/web/netlify.toml index 322b895..5f65c9e 100644 --- a/apps/web/netlify.toml +++ b/apps/web/netlify.toml @@ -1,6 +1,6 @@ [build] base = "apps/web" - command = "cd ../.. && pnpm build --filter=@worksight/web" + command = "cd ../.. && pnpm build --filter=apps/web" publish = "apps/web/.next" [build.environment] diff --git a/apps/web/package.json b/apps/web/package.json index a936643..00822f6 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,8 +1,7 @@ { - "name": "@worksight/web", + "name": "web", "version": "0.1.0", "private": true, - "packageManager": "pnpm@10.13.1", "scripts": { "dev": "next dev --turbopack", "build": "next build", @@ -92,4 +91,4 @@ "tw-animate-css": "^1.3.8", "typescript": "^5.9.2" } -} +} \ No newline at end of file diff --git a/apps/web/src/app/dashboard/layout.tsx b/apps/web/src/app/dashboard/layout.tsx index 4c8db61..09f4658 100644 --- a/apps/web/src/app/dashboard/layout.tsx +++ b/apps/web/src/app/dashboard/layout.tsx @@ -22,7 +22,13 @@ import { useEffect, useState } from 'react'; interface DashboardLayoutProps { children: React.ReactNode; } +type SurveyDataSchema = { + overallScore: number; + totalScore: number; + score: number; + burnoutScore: number; +}; const sidebarItems = [ { name: 'Overview', @@ -91,7 +97,7 @@ export default function DashboardLayout({ children }: DashboardLayoutProps) { // Get the burnout score with fallback handling const getBurnoutScore = () => { if (!surveyData) return null; - const data = surveyData as typeof T; + const data = surveyData as SurveyDataSchema; return data?.overallScore ?? data?.totalScore ?? data?.score ?? data?.burnoutScore ?? null; }; diff --git a/apps/web/vercel.json b/apps/web/vercel.json index e0d3b7a..c79c8e3 100644 --- a/apps/web/vercel.json +++ b/apps/web/vercel.json @@ -1,7 +1,7 @@ { "version": 2, - "installCommand": "pnpm install --filter=web", - "buildCommand": "pnpm build", + "installCommand": "npm install --workspace=web", + "buildCommand": "npm run build", "outputDirectory": ".next", "framework": "nextjs", "env": { diff --git a/package-lock.json b/package-lock.json index 7b3e7bb..d8fe7ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,14 +20,9 @@ "prettier": "^3.6.2", "turbo": "^2.5.6", "typescript": "^5.9.2" - }, - "engines": { - "node": ">=18.0.0", - "pnpm": ">=8.0.0" } }, "apps/docs": { - "name": "@worksight/docs", "version": "0.1.0", "dependencies": { "@catppuccin/vitepress": "^0.1.2", @@ -68,7 +63,6 @@ } }, "apps/web": { - "name": "@worksight/web", "version": "0.1.0", "dependencies": { "@dnd-kit/core": "^6.3.1", @@ -7165,14 +7159,6 @@ "url": "https://github.com/sponsors/antfu" } }, - "node_modules/@worksight/docs": { - "resolved": "apps/docs", - "link": true - }, - "node_modules/@worksight/web": { - "resolved": "apps/web", - "link": true - }, "node_modules/acorn": { "version": "8.15.0", "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.15.0.tgz", @@ -7335,6 +7321,14 @@ "node": ">= 8" } }, + "node_modules/apps/docs": { + "resolved": "apps/docs", + "link": true + }, + "node_modules/apps/web": { + "resolved": "apps/web", + "link": true + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmmirror.com/argparse/-/argparse-1.0.10.tgz", @@ -8855,6 +8849,10 @@ "node": ">=8" } }, + "node_modules/docs": { + "resolved": "apps/docs", + "link": true + }, "node_modules/doctrine": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/doctrine/-/doctrine-2.1.0.tgz", @@ -17502,6 +17500,10 @@ "makeerror": "1.0.12" } }, + "node_modules/web": { + "resolved": "apps/web", + "link": true + }, "node_modules/web-vitals": { "version": "5.1.0", "resolved": "https://registry.npmmirror.com/web-vitals/-/web-vitals-5.1.0.tgz", diff --git a/package.json b/package.json index a26e0f5..beb474c 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,14 @@ "apps/*" ], "scripts": { - "analyze:web": "ANALYZE=true turbo build --filter=@worksight/web", + "analyze:web": "ANALYZE=true turbo build --filter=apps/web", "build": "turbo build", "build:analyze": "npm run analyze:web", - "build:web": "turbo build --filter=@worksight/web", - "build:docs": "turbo build --filter=@worksight/docs", + "build:web": "turbo build --filter=apps/web", + "build:docs": "turbo build --filter=apps/docs", "dev": "turbo dev", - "dev:web": "turbo dev --filter=@worksight/web", - "dev:docs": "turbo dev --filter=@worksight/docs", + "dev:web": "turbo dev --filter=apps/web", + "dev:docs": "turbo dev --filter=apps/docs", "lint": "turbo lint", "lint:fix": "turbo lint:fix", "test": "turbo test",