Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,31 @@ The deployment process:

## 🔧 Development

### Rolldown Version Testing

The repository includes a tool for testing different rolldown-vite versions:

```bash
# List available versions
pnpm rolldown:list

# Switch to a specific version (by index)
pnpm rolldown:use 2

# Switch to a specific version (by version string)
pnpm rolldown:use 7.1.2

# Use experimental versions from pkg.pr.new
pnpm rolldown:use pkg.pr.new/rolldown-rs/vite@1234
```

The tool automatically:
- Updates the package.json with the new version
- Installs dependencies
- Rebuilds the application

See [`tool/README.md`](tool/README.md) for detailed usage instructions.

### Adding New Metrics

1. Add your data to the respective data arrays in `apps/dashboard/src/App.tsx`
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"globals": "^16.3.0",
"typescript": "~5.8.3",
"typescript-eslint": "^8.39.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove this typescript-eslint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed typescript-eslint dependency from apps/dashboard/package.json. The project now uses oxlint for faster linting performance. Commit: edbea17

"rolldown-vite": "^7.1.3"
"rolldown-vite": "7.1.4"
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"lint": "pnpm -r lint",
"test": "pnpm -r test",
"clean": "pnpm -r clean",
"build-deploy": "pnpm lint && pnpm build"
"build-deploy": "pnpm lint && pnpm build",
"rolldown:list": "node tool/override-rolldown.js --list",
"rolldown:use": "node tool/override-rolldown.js"
},
"keywords": ["dashboard", "charts", "metrics", "frontend"],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 94 additions & 0 deletions tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Rolldown Version Override Tool

This tool allows you to easily test the vibe-dashboard with different rolldown-vite versions.

## Features

- 🟢 **Stable Versions**: Test with the last 5 stable versions from npm
- 🚀 **Future Versions**: Test with experimental versions from pkg.pr.new (when available)
- 🔄 **Automatic Rebuild**: Automatically installs dependencies and rebuilds the app
- 📋 **Easy Selection**: Use version numbers or indices for quick switching

## Usage

### List Available Versions

```bash
# From root directory
pnpm rolldown:list

# Or directly with node
node tool/override-rolldown.js --list
```

### Switch to a Version by Index

```bash
# Use the 2nd version in the list (7.1.3)
pnpm rolldown:use 2

# Or directly with node
node tool/override-rolldown.js 2
```

### Switch to a Specific Version

```bash
# Use a specific version
pnpm rolldown:use 7.1.2

# Or directly with node
node tool/override-rolldown.js 7.1.2
```

### Get Help

```bash
node tool/override-rolldown.js --help
```

## Available Versions

The tool currently supports:

### Stable Versions (from npm)
- 7.1.4 (latest)
- 7.1.3
- 7.1.2
- 7.1.1
- 7.1.0

### Future Versions (from pkg.pr.new)
Future versions will be added as they become available through pkg.pr.new for testing experimental features.

## What It Does

1. **Updates package.json**: Modifies `apps/dashboard/package.json` to use the specified rolldown-vite version
2. **Installs dependencies**: Runs `pnpm install` to update the lockfile
3. **Rebuilds the app**: Runs `pnpm build` to ensure everything works with the new version

## Example Workflow

```bash
# Check current setup
pnpm build

# List available versions
pnpm rolldown:list

# Test with an older version
pnpm rolldown:use 7.1.1

# Verify the build still works
pnpm dev

# Switch back to latest
pnpm rolldown:use 7.1.4
```

## Notes

- The tool modifies `apps/dashboard/package.json` directly
- Always commit your changes before using this tool if you want to preserve the current version
- The tool automatically runs `pnpm install` and `pnpm build` after version changes
- Build failures will be reported if the new version has compatibility issues
193 changes: 193 additions & 0 deletions tool/override-rolldown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
#!/usr/bin/env node

/**
* Rolldown Version Override Tool
*
* This tool allows testing the vibe-dashboard with different rolldown-vite versions:
* - Last 5 stable versions from npm
* - Future/experimental versions from pkg.pr.new
*/

const { execSync } = require('child_process');
const { readFileSync, writeFileSync } = require('fs');
const { join } = require('path');

const DASHBOARD_PACKAGE_PATH = join(process.cwd(), 'apps/dashboard/package.json');

// Last 5 stable versions from npm (as of current check)
const STABLE_VERSIONS = [
'7.1.4',
'7.1.3',
'7.1.2',
'7.1.1',
'7.1.0'
];

// Future versions from pkg.pr.new (examples - these would be actual PR URLs)
const FUTURE_VERSIONS = [
// These would be actual pkg.pr.new URLs for future versions
// Example: 'https://pkg.pr.new/rolldown-rs/rolldown@pr-123'
// Example: 'pkg.pr.new/rolldown-rs/vite@1234'
// Note: Users can manually add pkg.pr.new URLs here when testing specific PRs
];

function getCurrentVersion() {
try {
const packageJson = JSON.parse(readFileSync(DASHBOARD_PACKAGE_PATH, 'utf8'));
return packageJson.devDependencies['rolldown-vite'];
} catch (error) {
console.error('Error reading package.json:', error.message);
process.exit(1);
}
}

function isPkgPrNewUrl(version) {
return version.includes('pkg.pr.new') || version.startsWith('https://pkg.pr.new');
}

function updateRolldownVersion(version) {
try {
console.log(`📦 Updating rolldown-vite to version: ${version}`);

// Read current package.json
const packageJson = JSON.parse(readFileSync(DASHBOARD_PACKAGE_PATH, 'utf8'));

// Update rolldown-vite version
packageJson.devDependencies['rolldown-vite'] = version;

// Write back to package.json
writeFileSync(DASHBOARD_PACKAGE_PATH, JSON.stringify(packageJson, null, 2) + '\n');

if (isPkgPrNewUrl(version)) {
console.log('🚀 Using experimental version from pkg.pr.new');
}
console.log('✅ Package.json updated successfully');
return true;
} catch (error) {
console.error('❌ Error updating package.json:', error.message);
return false;
}
}

function installDependencies() {
try {
console.log('📥 Installing dependencies...');
execSync('pnpm install --no-frozen-lockfile', {
stdio: 'inherit',
cwd: process.cwd()
});
console.log('✅ Dependencies installed successfully');
return true;
} catch (error) {
console.error('❌ Error installing dependencies:', error.message);
return false;
}
}

function buildApp() {
try {
console.log('🔨 Building application...');
execSync('pnpm build', {
stdio: 'inherit',
cwd: process.cwd()
});
console.log('✅ Build completed successfully');
return true;
} catch (error) {
console.error('❌ Build failed:', error.message);
return false;
}
}

function listVersions() {
console.log('📋 Available rolldown-vite versions:\n');

console.log('🟢 Stable versions (last 5 from npm):');
STABLE_VERSIONS.forEach((version, index) => {
const current = getCurrentVersion() === `^${version}` || getCurrentVersion() === version;
console.log(` ${index + 1}. ${version} ${current ? '(current)' : ''}`);
});

if (FUTURE_VERSIONS.length > 0) {
console.log('\n🚀 Future versions (from pkg.pr.new):');
FUTURE_VERSIONS.forEach((version, index) => {
console.log(` ${STABLE_VERSIONS.length + index + 1}. ${version}`);
});
} else {
console.log('\n🚀 Future versions (from pkg.pr.new):');
console.log(' None configured. Add pkg.pr.new URLs to FUTURE_VERSIONS array in the script.');
}

console.log('\n💡 Usage: node override-rolldown.js <version-number-or-version-string>');
console.log('Example: node override-rolldown.js 2 # Use version 7.1.3');
console.log('Example: node override-rolldown.js 7.1.2 # Use specific version');
console.log('Example: node override-rolldown.js pkg.pr.new/rolldown-rs/vite@1234 # Use pkg.pr.new URL');
}

function main() {
const args = process.argv.slice(2);

if (args.length === 0 || args[0] === '--list' || args[0] === '-l') {
listVersions();
return;
}

const input = args[0];
let targetVersion;

// Check if input is a number (index)
if (/^\d+$/.test(input)) {
const index = parseInt(input, 10) - 1;
const allVersions = [...STABLE_VERSIONS, ...FUTURE_VERSIONS];

if (index >= 0 && index < allVersions.length) {
targetVersion = allVersions[index];
} else {
console.error(`❌ Invalid version index. Use 1-${allVersions.length}`);
listVersions();
process.exit(1);
}
} else {
// Assume it's a version string
targetVersion = input;
}

console.log(`🎯 Target version: ${targetVersion}`);
console.log(`📍 Current version: ${getCurrentVersion()}\n`);

// Update version
if (!updateRolldownVersion(targetVersion)) {
process.exit(1);
}

// Install dependencies
if (!installDependencies()) {
process.exit(1);
}

// Build app
if (!buildApp()) {
process.exit(1);
}

console.log('\n🎉 Successfully updated rolldown-vite and rebuilt the application!');
console.log(`📊 Dashboard is ready with rolldown-vite ${targetVersion}`);
}

// Handle command line arguments
if (process.argv.includes('--help') || process.argv.includes('-h')) {
console.log('Rolldown Version Override Tool\n');
console.log('Usage:');
console.log(' node override-rolldown.js --list List available versions');
console.log(' node override-rolldown.js <index> Use version by index (1-5)');
console.log(' node override-rolldown.js <version> Use specific version');
console.log(' node override-rolldown.js <pkg.pr.new> Use pkg.pr.new URL');
console.log('\nExamples:');
console.log(' node override-rolldown.js --list');
console.log(' node override-rolldown.js 2');
console.log(' node override-rolldown.js 7.1.2');
console.log(' node override-rolldown.js pkg.pr.new/rolldown-rs/vite@1234');
process.exit(0);
}

main();