Skip to content
Merged
5 changes: 5 additions & 0 deletions .changeset/bright-nodes-align.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ankhorage/devtools': minor
---

Add the canonical Node 24 LTS tooling policy and render managed CI/release workflows from the shared Bun and Node runtime baselines.
19 changes: 16 additions & 3 deletions src/policy/bunRuntimePolicy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
/**
* Canonical Bun runtime policy for Ankhorage repositories.
* Canonical runtime/tooling policies for Ankhorage repositories.
*
* Import this from `@ankhorage/devtools/policy` when another package needs to inspect
* the managed Bun version without defining an independent version authority.
* Import these from `@ankhorage/devtools/policy` when another package needs to inspect
* the managed Bun or Node baseline without defining an independent version authority.
*/
export const bunRuntimePolicy = {
packageManager: 'bun@1.3.14',
typesRange: '^1.3.14',
version: '1.3.14',
} as const;

/**
* Canonical Node LTS baseline for Node-based Ankhorage tooling and CI execution.
*
* Bun remains the repository package manager/primary command runtime where configured;
* this policy makes Node-based tooling deterministic instead of inheriting the ambient
* Node version from a CI runner image.
*/
export const nodeRuntimePolicy = {
engineRange: '24.x',
major: 24,
setupVersion: '24',
} as const;
5 changes: 5 additions & 0 deletions src/tools/workflows/files/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
with:
bun-version: '__ANKH_BUN_VERSION__'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '__ANKH_NODE_VERSION__'

- name: Install dependencies
run: bun install --frozen-lockfile

Expand Down
2 changes: 1 addition & 1 deletion src/tools/workflows/files/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Node for npm publishing
uses: actions/setup-node@v4
with:
node-version: 24
node-version: '__ANKH_NODE_VERSION__'
registry-url: https://registry.npmjs.org

- name: Update npm
Expand Down
17 changes: 17 additions & 0 deletions src/tools/workflows/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, expect, test } from 'bun:test';

import { bunRuntimePolicy, nodeRuntimePolicy } from '../../policy/bunRuntimePolicy.js';
import { workflowManagedFiles } from './index.js';

describe('managed workflows', () => {
test('render the canonical Bun and Node runtime policies', async () => {
for (const definition of workflowManagedFiles) {
expect(definition.render).toBeDefined();
const rendered = await definition.render?.('.');
expect(rendered).toContain(`bun-version: '${bunRuntimePolicy.version}'`);
expect(rendered).toContain(`node-version: '${nodeRuntimePolicy.setupVersion}'`);
expect(rendered).not.toContain('__ANKH_BUN_VERSION__');
expect(rendered).not.toContain('__ANKH_NODE_VERSION__');
}
});
});
7 changes: 5 additions & 2 deletions src/tools/workflows/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { readFile } from 'node:fs/promises';

import { bunRuntimePolicy } from '../../policy/bunRuntimePolicy.js';
import { bunRuntimePolicy, nodeRuntimePolicy } from '../../policy/bunRuntimePolicy.js';
import type { ManagedFileDefinition } from '../shared/managedFiles.js';

const BUN_VERSION_TOKEN = '__ANKH_BUN_VERSION__';
const NODE_VERSION_TOKEN = '__ANKH_NODE_VERSION__';

export const workflowManagedFiles = [
createWorkflowDefinition('.github/workflows/ci.yml', './files/ci.yml'),
Expand All @@ -16,7 +17,9 @@ function createWorkflowDefinition(relativePath: string, sourcePath: string): Man
relativePath,
render: async () => {
const template = await readFile(sourceUrl, 'utf8');
return template.replaceAll(BUN_VERSION_TOKEN, bunRuntimePolicy.version);
return template
.replaceAll(BUN_VERSION_TOKEN, bunRuntimePolicy.version)
.replaceAll(NODE_VERSION_TOKEN, nodeRuntimePolicy.setupVersion);
},
};
}
Loading