-
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
Conversation
Co-authored-by: tylerbutler <[email protected]>
…ON_OUTPUT Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
|
/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.
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.
Shouldn't they be the same? I.e., "current" is version and "previous" is the version of the corresponding previous dev dep. Or do we mutate those files in the test PRs?
|
/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. |
|
/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). |
|
@copilot The build-tools workspace fails to build with an Eslint error. Run lint and fix the error, assuming it is new code, then make sure everything is formatted and that running Pnpm build from the build-tools folder passes. |
- Use object destructuring for accessing GenerateTypetestsCommand.flags - Fixes build failure in build-tools workspace Co-authored-by: tylerbutler <[email protected]>
Fixed! The ESLint errors were Commit: 6a76de3 |
|
/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). |
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 compatibility and include coverage for environment variable behaviortools/pipelines/templates/include-build-lint.ymluse existingtestBuildvariable to automatically set the environment variable fortest/*branchesenvproperty for environment variable integration, following oclif best practices💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.