diff options
| author | Brandon Keiji <[email protected]> | 2025-05-29 23:43:20 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-29 23:43:20 +0000 |
| commit | 7468d3cddfb55d70c85051c35a48c7090df3ccb3 (patch) | |
| tree | f9190a6a6067e0f0ada41d8cfe4f4ffe837f2849 /scripts/bind_package_version.js | |
| parent | 1c066548b4d5fcaea4f784a0cddab7a644716eab (diff) | |
fix(sandbox): add SHORT_SHA to image tag (#604)
Diffstat (limited to 'scripts/bind_package_version.js')
| -rw-r--r-- | scripts/bind_package_version.js | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/scripts/bind_package_version.js b/scripts/bind_package_version.js index 35c662d3..4e7a2ff7 100644 --- a/scripts/bind_package_version.js +++ b/scripts/bind_package_version.js @@ -6,41 +6,19 @@ import fs from 'node:fs'; import path from 'node:path'; -import yargs from 'yargs'; -import { hideBin } from 'yargs/helpers'; -import { execSync } from 'node:child_process'; // Assuming script is run from a package directory (e.g., packages/cli) const packageDir = process.cwd(); const rootDir = path.join(packageDir, '..', '..'); // Go up two directories to find the repo root -function getBaseVersion() { +function getRepoVersion() { // Read root package.json const rootPackageJsonPath = path.join(rootDir, 'package.json'); const rootPackage = JSON.parse(fs.readFileSync(rootPackageJsonPath, 'utf8')); - return rootPackage.version; + return rootPackage.version; // This version is now expected to be the full version string } -function getDefaultSuffix() { - // Get latest commit hash - const commitHash = execSync('git rev-parse --short HEAD', { - encoding: 'utf8', - }).trim(); - - // Append dev suffix with commit hash - return `dev-${commitHash}.0`; -} - -const argv = yargs(hideBin(process.argv)) - .option('suffix', { - type: 'string', - description: 'Set the package version suffix', - }) - .parse(); - -const baseVersion = getBaseVersion(); -const suffix = argv['suffix'] ?? getDefaultSuffix(); -const newVersion = `${baseVersion}${suffix.length ? '-' : ''}${suffix}`; +const newVersion = getRepoVersion(); console.log(`Setting package version to: ${newVersion}`); const packageJsonPath = path.join(packageDir, 'package.json'); |
