Skip to content

Commit

Permalink
chores(ci): release
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Nov 18, 2023
1 parent 705058e commit 8b88ca2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .config/scripts/update-monorepo-packages-version.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fs from 'fs/promises';

const DEFAULT_RELEASE_VERSION = '0.0.1';

export default class UpdateMonorepoPackagesVersion {
#packageContent;
#hadUpdate = false;
Expand All @@ -8,8 +10,9 @@ export default class UpdateMonorepoPackagesVersion {
* Update versions of organization packages in `dependencies` and `devDependencies` objects
* @param packagePath {string}
*/
constructor(packagePath) {
constructor(packagePath, changeToVersion = DEFAULT_RELEASE_VERSION) {
this.packagePath = packagePath;
this.changeToVersion = changeToVersion;
}

/**
Expand Down Expand Up @@ -46,6 +49,12 @@ export default class UpdateMonorepoPackagesVersion {
await this.#readPackageJson();
await this.#updateVersions(this.#packageContent.dependencies);
await this.#updateVersions(this.#packageContent.devDependencies);

if (this.changeToVersion) {
this.#packageContent.version = this.changeToVersion;
this.#hadUpdate = true;
}

if (this.#hadUpdate) {
await this.#savePackageJson();
}
Expand Down

0 comments on commit 8b88ca2

Please sign in to comment.