diff --git a/.changeset/thick-guests-wonder.md b/.changeset/thick-guests-wonder.md new file mode 100644 index 00000000..18e660c5 --- /dev/null +++ b/.changeset/thick-guests-wonder.md @@ -0,0 +1,5 @@ +--- +"@siteimprove/alfa-test-utils": patch +--- + +**Added:** The current version number is now exported. diff --git a/docs/review/api/alfa-test-utils.api.md b/docs/review/api/alfa-test-utils.api.md index bec1aa54..2ce27f77 100644 --- a/docs/review/api/alfa-test-utils.api.md +++ b/docs/review/api/alfa-test-utils.api.md @@ -89,6 +89,9 @@ export namespace Audit { export function run(page: Page, options?: Options): Promise; } +// @public (undocumented) +export const codeCheckerVersion = "0.76.0"; + // @public export interface CommitInformation { Author?: string; @@ -300,4 +303,6 @@ export namespace SIP { }): Promise>; } +// (No @packageDocumentation comment for this package) + ``` diff --git a/packages/alfa-test-utils/get-version.sh b/packages/alfa-test-utils/get-version.sh new file mode 100644 index 00000000..b57c9747 --- /dev/null +++ b/packages/alfa-test-utils/get-version.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# This script relies on npm package.json variables and thus must be called +# through npm, yarn or the like to correctly set them. + +set -eux + +echo "// Generated by yarn alfa-postversion +const version = \"$(node -e "console.log(process.env.npm_package_version)")\"; +export default version; +" diff --git a/packages/alfa-test-utils/package.json b/packages/alfa-test-utils/package.json index d7d64efa..b7290234 100644 --- a/packages/alfa-test-utils/package.json +++ b/packages/alfa-test-utils/package.json @@ -24,7 +24,9 @@ "./git": "./dist/report/git.js", "./git.js": "./dist/report/git.js", "./report": "./dist/report/index.js", - "./report.js": "./dist/report/index.js" + "./report.js": "./dist/report/index.js", + "./version": "./dist/version.js", + "./version.js": "./dist/version.js" }, "files": [ "dist/**/*.js", @@ -35,6 +37,17 @@ "access": "public", "registry": "https://npm.pkg.github.com/" }, + "//": [ + "For scripts:", + "We need to update the version number after creating a new one.", + "We also need to update the documentation, which includes the version number; updating the documentation from a CI tool requires CI=false to allow changes.", + "Finally we need to stage the changed files that will be commited later in the release process." + ], + "scripts": { + "alfa-postversion": "./get-version.sh > src/version.ts && yarn self-extract && git add src/version.ts ../../docs/review/api/alfa-test-utils.api.md", + "self-extract": "CI=false yarn run --top-level extract packages/alfa-test-utils", + "packages/alfa-test-utils": "echo workaround https://github.com/webpro-nl/knip/issues/739" + }, "dependencies": { "@siteimprove/alfa-act": "^0.96.0", "@siteimprove/alfa-aria": "^0.96.0", diff --git a/packages/alfa-test-utils/src/index.ts b/packages/alfa-test-utils/src/index.ts index 16030e82..94e22840 100644 --- a/packages/alfa-test-utils/src/index.ts +++ b/packages/alfa-test-utils/src/index.ts @@ -4,6 +4,12 @@ * * @packageDocumentation */ +import version from "./version.js"; +/** + * @public + */ +export const codeCheckerVersion = version; + export * from "./common.js"; export * from "./audit/index.js"; export * from "./report/index.js"; diff --git a/packages/alfa-test-utils/src/tsconfig.json b/packages/alfa-test-utils/src/tsconfig.json index d8acd3a1..78a9a331 100644 --- a/packages/alfa-test-utils/src/tsconfig.json +++ b/packages/alfa-test-utils/src/tsconfig.json @@ -5,6 +5,7 @@ "files": [ "./common.ts", "./index.ts", + "./version.ts", "audit/audit.ts", "audit/index.ts", "audit/outcomes.ts", diff --git a/packages/alfa-test-utils/src/version.ts b/packages/alfa-test-utils/src/version.ts new file mode 100644 index 00000000..c5ad02ad --- /dev/null +++ b/packages/alfa-test-utils/src/version.ts @@ -0,0 +1,4 @@ +// Generated by yarn alfa-postversion +const version = "0.76.0"; +export default version; +