Skip to content

Commit

Permalink
Export version number (#115)
Browse files Browse the repository at this point in the history
* Export version number

* Export version number

* Export version separately

* Extract documentation
  • Loading branch information
Jym77 authored Dec 12, 2024
1 parent da3ddb0 commit 9f30e5c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/thick-guests-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@siteimprove/alfa-test-utils": patch
---

**Added:** The current version number is now exported.
5 changes: 5 additions & 0 deletions docs/review/api/alfa-test-utils.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ export namespace Audit {
export function run(page: Page, options?: Options): Promise<Audit>;
}

// @public (undocumented)
export const codeCheckerVersion = "0.76.0";

// @public
export interface CommitInformation {
Author?: string;
Expand Down Expand Up @@ -300,4 +303,6 @@ export namespace SIP {
}): Promise<Result<string, string>>;
}

// (No @packageDocumentation comment for this package)

```
11 changes: 11 additions & 0 deletions packages/alfa-test-utils/get-version.sh
Original file line number Diff line number Diff line change
@@ -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;
"
15 changes: 14 additions & 1 deletion packages/alfa-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions packages/alfa-test-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
1 change: 1 addition & 0 deletions packages/alfa-test-utils/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"files": [
"./common.ts",
"./index.ts",
"./version.ts",
"audit/audit.ts",
"audit/index.ts",
"audit/outcomes.ts",
Expand Down
4 changes: 4 additions & 0 deletions packages/alfa-test-utils/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Generated by yarn alfa-postversion
const version = "0.76.0";
export default version;

0 comments on commit 9f30e5c

Please sign in to comment.