diff --git a/.config/scripts/update-monorepo-packages-version.mjs b/.config/scripts/update-monorepo-packages-version.mjs index afcac80..5da3e1b 100644 --- a/.config/scripts/update-monorepo-packages-version.mjs +++ b/.config/scripts/update-monorepo-packages-version.mjs @@ -1,5 +1,7 @@ import fs from 'fs/promises'; +const DEFAULT_RELEASE_VERSION = '0.0.1'; + export default class UpdateMonorepoPackagesVersion { #packageContent; #hadUpdate = false; @@ -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; } /** @@ -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(); }