Skip to content

Commit c0008e4

Browse files
committed
Move shared-web to GitHub packages
1 parent 2067112 commit c0008e4

27 files changed

+2470
-191
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,28 @@ on:
66
branches:
77
- main
88
- dev
9+
workflow_dispatch:
910

1011
jobs:
1112
build:
1213
runs-on: ubuntu-latest
1314

1415
steps:
1516
- name: Checkout code
16-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1718

1819
- name: Setup Node.js
19-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@v4
2021
with:
2122
node-version: '23'
2223

2324
- name: Install root dependencies
24-
run: npm install
25+
run: npm ci
2526

2627
- name: Install client dependencies
2728
run: |
2829
cd client
29-
npm install
30+
npm ci
3031
3132
- name: Run build
3233
run: npm run build

.github/workflows/deploy-staging.yml

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,57 @@ on:
88
jobs:
99
deploy:
1010
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
13+
environment: staging
1114

1215
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v3
15-
16-
- name: Setup SSH
17-
run: |
18-
mkdir -p ~/.ssh
19-
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
20-
chmod 600 ~/.ssh/id_rsa
21-
ssh-keyscan -H ${{ secrets.STAGING_IP }} >> ~/.ssh/known_hosts
22-
23-
- name: Deploy via SSH
24-
run: |
25-
ssh ${{ secrets.SERVER_USER }}@${{ secrets.STAGING_IP }} << 'EOF'
26-
cd /home/modl/modl-admin
27-
git pull origin dev
28-
npm install
29-
cd client
30-
npm install
31-
cd ..
32-
npm run build
33-
pm2 reload modl-admin
34-
EOF
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup SSH
20+
uses: webfactory/[email protected]
21+
with:
22+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
23+
24+
- name: Add server to known hosts
25+
run: |
26+
ssh-keyscan -H ${{ secrets.STAGING_IP }} >> ~/.ssh/known_hosts
27+
28+
- name: Deploy via SSH
29+
run: |
30+
ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.STAGING_IP }} << 'EOF'
31+
set -e
32+
33+
cd /home/modl/modl-admin
34+
35+
git stash
36+
37+
git pull origin dev
38+
39+
if git diff --name-only HEAD@{1} HEAD | grep -q "^package.*\.json$"; then
40+
npm ci
41+
fi
42+
43+
if git diff --name-only HEAD@{1} HEAD | grep -q "^client/package.*\.json$"; then
44+
cd client
45+
npm ci
46+
cd ..
47+
fi
48+
49+
npm run build
50+
51+
pm2 reload modl-admin --wait-ready
52+
53+
if pm2 describe modl-admin | grep -q "online"; then
54+
echo "PM2 process is running successfully"
55+
else
56+
echo "Error: PM2 process failed to start"
57+
exit 1
58+
fi
59+
EOF
60+
61+
- name: Notify on failure
62+
if: failure()
63+
run: |
64+
echo "Deployment failed! Check the logs."

.github/workflows/deploy.yml

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,57 @@ on:
88
jobs:
99
deploy:
1010
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
13+
environment: production
1114

1215
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v3
15-
16-
- name: Setup SSH
17-
run: |
18-
mkdir -p ~/.ssh
19-
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
20-
chmod 600 ~/.ssh/id_rsa
21-
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
22-
23-
- name: Deploy via SSH
24-
run: |
25-
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
26-
cd /home/modl/modl-admin
27-
git pull origin main
28-
npm install
29-
cd client
30-
npm install
31-
cd ..
32-
npm run build
33-
pm2 reload modl-admin
34-
EOF
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup SSH
20+
uses: webfactory/[email protected]
21+
with:
22+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
23+
24+
- name: Add server to known hosts
25+
run: |
26+
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
27+
28+
- name: Deploy via SSH
29+
run: |
30+
ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
31+
set -e
32+
33+
cd /home/modl/modl-admin
34+
35+
git stash
36+
37+
git pull origin main
38+
39+
if git diff --name-only HEAD@{1} HEAD | grep -q "^package.*\.json$"; then
40+
npm ci
41+
fi
42+
43+
if git diff --name-only HEAD@{1} HEAD | grep -q "^client/package.*\.json$"; then
44+
cd client
45+
npm ci
46+
cd ..
47+
fi
48+
49+
npm run build
50+
51+
pm2 reload modl-admin --wait-ready
52+
53+
if pm2 describe modl-admin | grep -q "online"; then
54+
echo "PM2 process is running successfully"
55+
else
56+
echo "Error: PM2 process failed to start"
57+
exit 1
58+
fi
59+
EOF
60+
61+
- name: Notify on failure
62+
if: failure()
63+
run: |
64+
echo "Production deployment failed! Check the logs."

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@modl-gg:registry=https://npm.pkg.github.com
2+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}

client/package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/components/EditServerModal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import {
66
DialogTitle,
77
DialogFooter,
88
DialogClose,
9-
} from 'modl-shared-web/components/ui/dialog';
10-
import { Button } from 'modl-shared-web/components/ui/button';
11-
import { Input } from 'modl-shared-web/components/ui/input';
12-
import { Label } from 'modl-shared-web/components/ui/label';
9+
} from '@modl-gg/shared-web/components/ui/dialog';
10+
import { Button } from '@modl-gg/shared-web/components/ui/button';
11+
import { Input } from '@modl-gg/shared-web/components/ui/input';
12+
import { Label } from '@modl-gg/shared-web/components/ui/label';
1313
import { useForm } from 'react-hook-form';
1414
import { zodResolver } from '@hookform/resolvers/zod';
1515
import { z } from 'zod';

client/src/components/SystemLogs.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, { useState, useEffect } from 'react';
22
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
3-
import { Button } from 'modl-shared-web/components/ui/button';
4-
import { Input } from 'modl-shared-web/components/ui/input';
5-
import { Badge } from 'modl-shared-web/components/ui/badge';
6-
import { Card, CardContent } from 'modl-shared-web/components/ui/card';
7-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from 'modl-shared-web/components/ui/select';
8-
import { Checkbox } from 'modl-shared-web/components/ui/checkbox';
9-
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from 'modl-shared-web/components/ui/alert-dialog';
3+
import { Button } from '@modl-gg/shared-web/components/ui/button';
4+
import { Input } from '@modl-gg/shared-web/components/ui/input';
5+
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
6+
import { Card, CardContent } from '@modl-gg/shared-web/components/ui/card';
7+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@modl-gg/shared-web/components/ui/select';
8+
import { Checkbox } from '@modl-gg/shared-web/components/ui/checkbox';
9+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@modl-gg/shared-web/components/ui/alert-dialog';
1010
import { apiClient } from '@/lib/api';
1111
import { formatDate, formatDateRelative } from '@/lib/utils';
1212
import { useSocket } from '@/hooks/use-socket';

client/src/pages/AnalyticsPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useState, useEffect } from 'react';
22
import { Link } from 'wouter';
33
import { useQuery } from '@tanstack/react-query';
4-
import { Button } from 'modl-shared-web/components/ui/button';
5-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
6-
import { Badge } from 'modl-shared-web/components/ui/badge';
7-
import { Tabs, TabsContent, TabsList, TabsTrigger } from 'modl-shared-web/components/ui/tabs';
4+
import { Button } from '@modl-gg/shared-web/components/ui/button';
5+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
6+
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
7+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@modl-gg/shared-web/components/ui/tabs';
88
import { useAuth } from '@/hooks/useAuth';
99
import { apiClient } from '@/lib/api';
1010
import { formatDate, formatDateRelative } from '@/lib/utils';

client/src/pages/DashboardPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Link } from 'wouter';
2-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
3-
import { Button } from 'modl-shared-web/components/ui/button';
4-
import { Badge } from 'modl-shared-web/components/ui/badge';
2+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
3+
import { Button } from '@modl-gg/shared-web/components/ui/button';
4+
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
55
import { useAuth } from '@/hooks/useAuth';
66
import { useRealTimeMetrics } from '@/hooks/useMonitoring';
77
import { formatDateRelative } from '@/lib/utils';

client/src/pages/LoginPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { useForm } from 'react-hook-form';
33
import { zodResolver } from '@hookform/resolvers/zod';
44
import { z } from 'zod';
55
import { useAuth } from '@/hooks/useAuth';
6-
import { Button } from 'modl-shared-web/components/ui/button';
7-
import { Input } from 'modl-shared-web/components/ui/input';
8-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
9-
import { Alert, AlertDescription } from 'modl-shared-web/components/ui/alert';
6+
import { Button } from '@modl-gg/shared-web/components/ui/button';
7+
import { Input } from '@modl-gg/shared-web/components/ui/input';
8+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
9+
import { Alert, AlertDescription } from '@modl-gg/shared-web/components/ui/alert';
1010
import { Mail, Lock, AlertCircle } from 'lucide-react';
1111

1212
const emailSchema = z.object({

0 commit comments

Comments
 (0)