Public
Like
os
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
This directory contains scripts to update existing projects in Gigya DS with proper author names where they are missing or set to "Unknown".
A straightforward script that updates projects with missing or "Unknown" authors.
Features:
- Fetches all projects from Gigya DS
- Identifies projects needing author updates
- Updates them with author data from
data.json
- Provides summary statistics
A comprehensive script with additional features and configuration options.
Features:
- Dry run mode to preview changes
- Batch processing with rate limiting
- Detailed analysis and reporting
- Configurable update criteria
- Better error handling and logging
- Author name cleanup and formatting
-
Environment Variables:
export GIGYA_API_KEY="your_api_key" export GIGYA_APP_KEY="your_app_key" export GIGYA_APP_SECRET="your_app_secret" export GIGYA_DOMAIN="accounts.eu1.gigya.com" # Optional, defaults to EU1 -
Data Source:
- Ensure
data.json
exists in the same directory - The file should contain project data with author information
- Ensure
# Run the basic update script npx tsx update-project-authors.ts
# Preview what would be updated without making changes DRY_RUN=true npx tsx update-authors-advanced.ts
# Update both missing and "Unknown" authors npx tsx update-authors-advanced.ts
# Only update projects where author is specifically "Unknown" UPDATE_UNKNOWN_ONLY=true npx tsx update-authors-advanced.ts
Environment Variable | Default | Description |
---|---|---|
DRY_RUN | false | Preview changes without applying them |
UPDATE_UNKNOWN_ONLY | false | Only update "Unknown" authors, not missing ones |
GIGYA_DOMAIN | accounts.eu1.gigya.com | Gigya domain to use |
The scripts will update projects where the author field is:
undefined
ornull
- Empty string (
""
) - Set to
"Unknown"
- Set to
"undefined"
or"null"
(string values)
Note: If UPDATE_UNKNOWN_ONLY=true
, only projects with author exactly equal to "Unknown"
will be updated.
The advanced script includes author name cleanup:
- User IDs like
I123456
becomeUser I123456
- Bot names like
osvote[bot]
becomeosvote (Bot)
- Other names are used as-is
Both scripts provide detailed logging including:
- Projects being processed
- Update success/failure status
- Summary statistics
- Verification of changes
🔍 Starting author update process...
📥 Found 25 existing projects
📝 Created lookup for 20 projects with author data
🔄 Updating "bolt.diy" with author: "I347305"
✅ Successfully updated "bolt.diy"
📊 Update Summary:
✅ Successfully updated: 15 projects
⏭️ Skipped: 8 projects
❌ Errors: 0 projects
📁 Total processed: 23 projects
- Network errors are caught and reported
- Individual project failures don't stop the entire process
- Rate limiting prevents API overload
- Detailed error messages help with troubleshooting
- Dry run mode allows previewing changes
- Batch processing with delays prevents rate limiting
- Verification step confirms updates were applied
- Backup consideration: The scripts update existing records, so consider backing up your data first
-
Missing Environment Variables:
- Ensure all required Gigya credentials are set
- Check that the domain is correct for your region
-
No Projects Updated:
- Verify
data.json
contains author information - Check that project titles match between DS and data.json
- Use dry run mode to see what would be updated
- Verify
-
API Errors:
- Check your Gigya credentials and permissions
- Verify the DS schema exists and is accessible
- Ensure rate limits aren't being exceeded
-
Author Data Not Found:
- Verify the project exists in
data.json
- Check that the title normalization (cabbabCase) matches
- Some projects may not have author data in the source
- Verify the project exists in
After running the update scripts:
- Verify Results: Check the application to ensure author names display correctly
- Manual Review: Review any projects that still need author assignment
- Data Quality: Consider implementing validation to prevent future author data issues
- Monitoring: Set up processes to ensure new projects include proper author information