Skip to content

Commit

Permalink
make it easy/automatic to update the versions.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Nov 4, 2023
1 parent 37164c8 commit bcfb781
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions code/lib/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"access": "public"
},
"bundler": {
"pre": "./scripts/generate-sb-packages-versions.js",
"entries": [
"./src/generate.ts",
"./src/index.ts"
Expand Down
6 changes: 4 additions & 2 deletions code/lib/cli/scripts/generate-sb-packages-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ const getMonorepoPackages = async () => {
};

const run = async () => {
const updatedVersion = process.argv[process.argv.length - 1];
let updatedVersion = process.argv[process.argv.length - 1];

if (!semver.valid(updatedVersion)) throw new Error(`Invalid version: ${updatedVersion}`);
if (!semver.valid(updatedVersion)) {
updatedVersion = (await readJson(path.join(rootDirectory, 'package.json'))).version;
}

logger.log(`Generating versions.ts with v${updatedVersion}`);

Expand Down

0 comments on commit bcfb781

Please sign in to comment.