-
Notifications
You must be signed in to change notification settings - Fork 559
feat(build-tools): add flag and environment variable to preserve version info in generated type tests #25988
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: tylerbutler <19589+tylerbutler@users.noreply.github.com>
…ON_OUTPUT Co-authored-by: tylerbutler <19589+tylerbutler@users.noreply.github.com>
Co-authored-by: tylerbutler <19589+tylerbutler@users.noreply.github.com>
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
/azp run Build - api-markdown-documenter,Build - benchmark-tool,Build - build-common,Build - build-tools,Build - common-utils,Build - eslint-config-fluid,Build - eslint-plugin-fluid,server-historian |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Azure Pipelines successfully started running 2 pipeline(s). |
| const previousVersionRegex = /Baseline \(previous\) version: (.+)/; | ||
| const currentVersionRegex = /Current version: (.+)/; | ||
| const previousVersionMatch = previousVersionRegex.exec(content); | ||
| const currentVersionMatch = currentVersionRegex.exec(content); |
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.
Seems easier than storing the metadata in the typetest field in package.json, even though it's brittle.
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
/azp run Build - api-markdown-documenter,Build - benchmark-tool,Build - build-common,Build - build-tools,Build - common-utils,Build - eslint-config-fluid,Build - eslint-plugin-fluid,server-historian |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
@copilot Look at the ADO pipelines, specifically the Build - client pipeline. We want to set the new env var you created to 1 only when running a build from a test/* branch. I think we may already have variables for such cases to enable/disable parts of the pipeline, so we just need to find the righ one and thread it through. |
- Add hidden skipVersionBump boolean flag - Set env property to FLUB_TYPETEST_SKIP_VERSION_OUTPUT - Use flag value instead of directly accessing process.env - Remove env variable from description (now in flag definition) - Simplify logic by removing string comparison checks Co-authored-by: tylerbutler <19589+tylerbutler@users.noreply.github.com>
build-tools/packages/build-cli/src/commands/generate/typetests.ts
Outdated
Show resolved
Hide resolved
- Rename skipVersionBump to skipVersionOutput per review feedback - Remove hidden property to make flag visible in help output - Update all references throughout the code Co-authored-by: tylerbutler <19589+tylerbutler@users.noreply.github.com>
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
/azp run Build - api-markdown-documenter,Build - benchmark-tool,Build - build-common,Build - build-tools,Build - common-utils,Build - eslint-config-fluid,Build - eslint-plugin-fluid,server-historian |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
/azp run Build - api-markdown-documenter,Build - benchmark-tool,Build - build-common,Build - build-tools,Build - common-utils,Build - eslint-config-fluid,Build - eslint-plugin-fluid,server-historian |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
build-tools/packages/build-cli/src/test/commands/generate/typetests.test.ts
Show resolved
Hide resolved
Addresses PR feedback from Josmithr to add test coverage for the FLUB_TYPETEST_SKIP_VERSION_OUTPUT environment variable. Following the pattern from generate:buildVersion tests, added tests that: - Verify the flag has the correct env property configured - Test that the environment variable is properly read - Confirm the default value when env var is not set Also includes unit tests for the readExistingVersions function and version preservation behavior.
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
/azp run Build - api-markdown-documenter,Build - benchmark-tool,Build - build-common,Build - build-tools,Build - common-utils,Build - eslint-config-fluid,Build - eslint-plugin-fluid,server-historian |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Adds
skipVersionOutputflag andFLUB_TYPETEST_SKIP_VERSION_OUTPUTenvironment variable togenerate:typetestscommand. When set, preserves existing version information in generated type test file headers instead of updating to current package versions.Implementation:
readExistingVersions()function: Parses existing type test files to extract baseline and current version commentsskipVersionOutputflag: Boolean flag withenvproperty set toFLUB_TYPETEST_SKIP_VERSION_OUTPUT, allowing the value to be set via environment variable or command line. The flag is visible in help output for discoverability.test/*branches using the existingtestBuildvariableUsage:
Pipeline behavior: The environment variable is automatically set to
truewhen building fromtest/*branches in CI. The oclif flag system automatically handles the type conversion from environment variable to boolean. This preserves existing version information during test branch builds without manual configuration.Use case: in CI pipelines building from test branches, setting the version may not be the preferred behavior. This flag/env variable allows override.
Breaking Changes
None. Feature only activates when environment variable is set or flag is used.
Reviewer Guidance
processPackage()around line 178-194readExistingVersions()usesRegExp.exec()and"utf8"encoding per linting requirementsos.tmpdir()for cross-platform compatibilitytools/pipelines/templates/include-build-lint.ymluse existingtestBuildvariable to automatically set the environment variable fortest/*branchesenvproperty for environment variable integration, following oclif best practices