Skip to content

Commit

Permalink
fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed Jan 22, 2024
1 parent 4092225 commit 5c86585
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/libs/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,22 @@ async function modifyDependency(packagePath: string, newVersion: string) {
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
const { dependencies } = packageJson;

const relativePackagePath = path.relative(process.cwd(), packagePath);

// Replaces all @nammatham/* dependencies
for (const [name, version] of Object.entries(dependencies ?? {})) {
if (name.startsWith('@nammatham/' || name === 'nammatham')) {
if (name.startsWith('@nammatham/')) {
dependencies[name] = newVersion;
console.log(`Replace ${relativePackagePath}, dependency ${name} to ${newVersion}`);
} else if (name === 'nammatham') {
// TODO: Hotfix, remove the duplicated code later
dependencies[name] = newVersion;
console.log(`Replace '${relativePackagePath}', dependency '${name}' to '${newVersion}'`);
}
}
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
}


export async function readPackageJson(packagePath: string) {
const packageJsonPath = path.resolve(packagePath, 'package.json');
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
Expand Down

0 comments on commit 5c86585

Please sign in to comment.