@@ -9,6 +9,7 @@ import spawn from 'nano-spawn';
|
||||
import { getPkgTag, grabPackageDetails, listCommitsInDir } from './git';
|
||||
import { consola } from 'consola';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'node:path';
|
||||
|
||||
const pkg = process.argv[2];
|
||||
if (pkg == null) {
|
||||
@@ -81,8 +82,36 @@ const newChangelog =
|
||||
await fs.writeFile(changelogPath, newChangelog, 'utf8');
|
||||
consola.success('Updated changelog');
|
||||
|
||||
// Update WXT version in templates when releasing wxt package
|
||||
const templatePkgJsonPaths: string[] = [];
|
||||
if (pkg === 'wxt') {
|
||||
const templatesDir = 'templates';
|
||||
const templateDirs = await fs.readdir(templatesDir);
|
||||
for (const templateDir of templateDirs) {
|
||||
const templatePkgJsonPath = path.join(
|
||||
templatesDir,
|
||||
templateDir,
|
||||
'package.json',
|
||||
);
|
||||
if (await fs.pathExists(templatePkgJsonPath)) {
|
||||
const templatePkgJson = await fs.readJson(templatePkgJsonPath);
|
||||
if (templatePkgJson.devDependencies?.wxt) {
|
||||
templatePkgJson.devDependencies.wxt = `^${newVersion}`;
|
||||
await fs.writeJson(templatePkgJsonPath, templatePkgJson, { spaces: 2 });
|
||||
templatePkgJsonPaths.push(templatePkgJsonPath);
|
||||
consola.success(`Updated wxt version in ${templatePkgJsonPath}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Commit changes
|
||||
await spawn('git', ['add', pkgJsonPath, changelogPath]);
|
||||
await spawn('git', [
|
||||
'add',
|
||||
pkgJsonPath,
|
||||
changelogPath,
|
||||
...templatePkgJsonPaths,
|
||||
]);
|
||||
await spawn('git', [
|
||||
'commit',
|
||||
'-m',
|
||||
|
||||
Reference in New Issue
Block a user