-
Notifications
You must be signed in to change notification settings - Fork 25
chore: publish cwmsjs for production releases #1900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krowvin
wants to merge
4
commits into
develop
Choose a base branch
from
devops/publish-cwmsjs
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
clients/typescript/scripts/package-updates/modPackage.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| const assert = require("node:assert/strict"); | ||
| const test = require("node:test"); | ||
|
|
||
| const { getVersionSuffix, normalizeVersionSuffix } = require("./modPackage.js"); | ||
|
|
||
| test("normalizes zero-padded production CalVer identifiers", () => { | ||
| assert.equal(normalizeVersionSuffix("2026.08.25"), "2026.8.25"); | ||
| }); | ||
|
|
||
| test("preserves a suffixed production release", () => { | ||
| assert.equal(normalizeVersionSuffix("2026.03.31-b"), "2026.3.31-b"); | ||
| }); | ||
|
|
||
| test("normalizes prerelease and nightly version suffixes", () => { | ||
| assert.equal(normalizeVersionSuffix("2026.08.25-dev"), "2026.8.25-dev"); | ||
| assert.equal(normalizeVersionSuffix("develop-nightly"), "develop-nightly"); | ||
| }); | ||
|
|
||
| test("rejects empty and invalid version suffixes", () => { | ||
| assert.throws(() => normalizeVersionSuffix(""), /non-empty string/); | ||
| assert.throws(() => normalizeVersionSuffix("2026..25"), /Invalid version/); | ||
| assert.throws( | ||
| () => normalizeVersionSuffix("release/2026.08.25"), | ||
| /Invalid version/, | ||
| ); | ||
| }); | ||
|
|
||
| test("reads the CLI argument before environment variables", () => { | ||
| assert.equal( | ||
| getVersionSuffix(["--version-suffix=2026.08.25"], { | ||
| CDA_CLIENT_VERSION_SUFFIX: "2026.03.31", | ||
| }), | ||
| "2026.8.25", | ||
| ); | ||
| }); | ||
|
|
||
| test("reads supported environment variables", () => { | ||
| assert.equal( | ||
| getVersionSuffix([], { CDA_CLIENT_VERSION_SUFFIX: "2026.08.25-test" }), | ||
| "2026.8.25-test", | ||
| ); | ||
| assert.equal( | ||
| getVersionSuffix([], { CWMSJS_VERSION_SUFFIX: "2026.08.25-dev" }), | ||
| "2026.8.25-dev", | ||
| ); | ||
| }); | ||
|
|
||
| test("requires an explicit version suffix", () => { | ||
| assert.throws(() => getVersionSuffix([], {}), /Missing version suffix/); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the
2.4.0-for/from in this example?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.4.0-is the current release of the cwmsjs generator side. Not the CDA instance.You can read about the generator version choice here:
https://github.com/USACE/cwms-data-api/blob/develop/clients/typescript/README.md#versioning
https://hydrologicengineeringcenter.github.io/cwms-data-api-client-javascript/ - listed at the top of the last release.
Here's smore more background on this choice to have this:
A while back BK and I had decided we need a version for what we decide on the generator side vs what target of CDA that version was built against.
Here are some examples on why you might want to prefix with a semVar:
CDA swagger spec is written such that every method would requre you to write CWMS in the function name. Version, I believe, 1 to 2 changed this so instead of
cwmsjs.getCWMSTimeSeriesyou would typecwmsjs.getTimeSeriesThe generator lets you specify what sort of writing style/naming convention you wish to have for methods/classes.
If you try to query CDA without cwmsjs you will be forced to do things like
tsGroupVar["assigned-time-series"].However, the generator we have specified to use camelCase and in turn you can then use tsGroupVar.assignedTimeSeries. The distinction here is that they both could be a dot operator if it was tsGroupVar.value == tsGroupVar["value"].
But with dashes you are forced to use the brackets/quotes to access the value in javascript.
Changing that in the generator but having only
2026.8.26as the version, set to CDA, would mean we would overwrite the other version instead of having 2.4.0 vs 2.5.0.Hope that answers your question!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of, but I'm still not sure why we would still need it.