39 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
#!/usr/bin/env node
 | 
						|
// Syncs manifest.json version with package.json version
 | 
						|
const fs = require('fs');
 | 
						|
const path = require('path');
 | 
						|
 | 
						|
const pkgPath = path.join(__dirname, '..', 'package.json');
 | 
						|
const manifestPath = path.join(__dirname, '..', 'manifest.json');
 | 
						|
 | 
						|
function readJson(p) {
 | 
						|
  return JSON.parse(fs.readFileSync(p, 'utf8'));
 | 
						|
}
 | 
						|
 | 
						|
function writeJson(p, obj) {
 | 
						|
  fs.writeFileSync(p, JSON.stringify(obj, null, 2) + '\n', 'utf8');
 | 
						|
}
 | 
						|
 | 
						|
try {
 | 
						|
  const pkg = readJson(pkgPath);
 | 
						|
  const manifest = readJson(manifestPath);
 | 
						|
  const nextVersion = pkg.version;
 | 
						|
 | 
						|
  if (!nextVersion) {
 | 
						|
    console.error('package.json is missing version');
 | 
						|
    process.exit(1);
 | 
						|
  }
 | 
						|
 | 
						|
  if (manifest.version === nextVersion) {
 | 
						|
    console.log(`manifest.json already at version ${nextVersion}`);
 | 
						|
    process.exit(0);
 | 
						|
  }
 | 
						|
 | 
						|
  manifest.version = nextVersion;
 | 
						|
  writeJson(manifestPath, manifest);
 | 
						|
  console.log(`Updated manifest.json version to ${nextVersion}`);
 | 
						|
} catch (err) {
 | 
						|
  console.error('Failed to sync versions:', err.message);
 | 
						|
  process.exit(1);
 | 
						|
}
 | 
						|
 |