Initial commit: KHY Admin project

This commit is contained in:
George Birikorang 2025-09-10 16:56:52 -07:00
commit d3403cb5e2
65 changed files with 12739 additions and 0 deletions

150
DEPLOY_SETUP.md Normal file
View file

@ -0,0 +1,150 @@
# Deploy Setup Guide
This guide explains how to configure the admin dashboard to deploy to your main KHY website when they are in separate repositories.
## Repository Structure Examples
### Example 1: Sibling Directories
```
Documents/
├── khy_website/ # Main website repository
│ ├── index.html
│ ├── data/
│ └── assets/
└── khy_admin/ # Admin repository
├── admin.html
├── data/
└── assets/
```
**Setup**: Run `npm run setup` and enter `../khy_website`
### Example 2: Different Parent Directories
```
Documents/
├── projects/
│ └── khy_website/ # Main website repository
└── admin_tools/
└── khy_admin/ # Admin repository
```
**Setup**: Run `npm run setup` and enter `../../projects/khy_website`
### Example 3: Absolute Paths
```
/Users/george/Documents/khy_website/ # Main website
/Users/george/Documents/admin_tools/ # Admin repository
```
**Setup**: Run `npm run setup` and enter `/Users/george/Documents/khy_website`
## Setup Process
1. **Run the setup script**:
```bash
npm run setup
```
2. **Enter the path to your main KHY website**:
- Use relative paths like `../khy_website` or `../../projects/khy_website`
- Use absolute paths like `/full/path/to/khy_website`
3. **Verify the configuration**:
- The script will check if the path exists
- It will verify required files are present
- It will update `deploy-config.js` with your settings
## Manual Configuration
If you prefer to configure manually, edit `deploy-config.js`:
```javascript
module.exports = {
targets: {
main: "../khy_website", // Change this to your path
},
defaultTarget: "main",
// ... rest of config
};
```
## Testing the Setup
After setup, test the configuration:
```bash
# Test with the configured path
npm run deploy
# Test with a specific path
node deploy.js /path/to/your/khy_website
```
## Troubleshooting
### "Target directory does not exist"
- Check the path you entered during setup
- Use absolute paths if relative paths don't work
- Make sure the main website directory exists
### "Missing required files"
- Ensure your main website has `index.html` and `data/products.json`
- The admin will create these files if they don't exist
### "Permission denied"
- Make sure you have write permissions to the main website directory
- On macOS/Linux, you might need to adjust file permissions
## Advanced Usage
### Multiple Targets
You can configure multiple deployment targets:
```javascript
targets: {
staging: "../khy_website_staging",
production: "../khy_website",
backup: "/backup/khy_website"
}
```
Then deploy to specific targets:
```bash
node deploy.js staging
node deploy.js production
```
### Custom File Mappings
Modify `filesToCopy` in `deploy-config.js` to copy different files:
```javascript
filesToCopy: [
{
source: "data/products.json",
target: "data/products.json",
description: "Product catalog data",
},
{
source: "assets/images",
target: "assets/images",
description: "Product images",
isDirectory: true,
},
{
source: "config/settings.json",
target: "config/admin-settings.json",
description: "Admin settings",
},
];
```