@ankhorage/devtools 1.21.2 → 1.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/devtools
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v1.21.2](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v1.21.3](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
7
 
8
8
  Shared tooling, repository automation, runtime policies, and agent standards for Ankhorage TypeScript projects
9
9
 
@@ -1,5 +1,7 @@
1
1
  /**
2
- * @readme
2
+ * Repository configuration
3
+ *
4
+ * Loads the canonical Ankhorage dependency-update policy from its default branch.
3
5
  */
4
6
  {
5
7
  $schema: 'https://docs.renovatebot.com/renovate-schema.json',
@@ -5,6 +5,7 @@ import { resolveStructureReleaseCommandAsync } from '../../features/structure-de
5
5
  import { bunRuntimePolicy, nodeRuntimePolicy } from '../../policy/bunRuntimePolicy.js';
6
6
  import { resolvePkgvizAuditPolicyAsync } from '../../policy/resolvePkgvizAuditPolicyAsync.js';
7
7
  import { readCurrentDoctorVersion } from './readCurrentDoctorVersion.js';
8
+ import { renderRenovateConfigAsync } from './renderRenovateConfigAsync.js';
8
9
  import { renderRenovateWorkflowAsync } from './renderRenovateWorkflowAsync.js';
9
10
  import { renderWorkflowAsync } from './renderWorkflowAsync.js';
10
11
  export const workflowManagedFiles = [
@@ -26,8 +27,7 @@ export const workflowManagedFiles = [
26
27
  createRenovateWorkflowDefinition(),
27
28
  {
28
29
  relativePath: 'renovate.json5',
29
- sourceUrl: new URL('./files/renovate.json5', import.meta.url),
30
- mode: 'create-only',
30
+ render: renderRenovateConfigAsync,
31
31
  },
32
32
  ];
33
33
  /*** Create a managed workflow definition rendered from current shared runtime policies. */
@@ -0,0 +1,2 @@
1
+ /*** Render Renovate config while preserving repository-owned rules and removing obsolete Paradox metadata. */
2
+ export declare function renderRenovateConfigAsync(targetDirectory: string): Promise<string>;
@@ -0,0 +1,35 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ const TEMPLATE_URL = new URL('./files/renovate.json5', import.meta.url);
4
+ const LEGACY_HEADER_PATTERN = /^\/\*\*\*([\s\S]*?)\*\/\n/u;
5
+ /*** Render Renovate config while preserving repository-owned rules and removing obsolete Paradox metadata. */
6
+ export async function renderRenovateConfigAsync(targetDirectory) {
7
+ const targetPath = join(targetDirectory, 'renovate.json5');
8
+ let current;
9
+ try {
10
+ current = await readFile(targetPath, 'utf8');
11
+ }
12
+ catch (error) {
13
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
14
+ return await readFile(TEMPLATE_URL, 'utf8');
15
+ }
16
+ throw error;
17
+ }
18
+ return migrateLegacyRenovateHeader(current);
19
+ }
20
+ /*** Convert the historical managed Paradox header to an ordinary comment without changing config data. */
21
+ function migrateLegacyRenovateHeader(contents) {
22
+ const match = LEGACY_HEADER_PATTERN.exec(contents);
23
+ if (match === null)
24
+ return contents;
25
+ const [header, body = ''] = match;
26
+ if (!body.includes('Repository configuration'))
27
+ return contents;
28
+ if (!body.includes('@usage') && !body.includes('@readme'))
29
+ return contents;
30
+ const migratedBody = body
31
+ .split('\n')
32
+ .filter((line) => !/^\s*\*\s+@(usage|readme)\s*$/u.test(line))
33
+ .join('\n');
34
+ return `/**${migratedBody}*/\n${contents.slice(header.length)}`;
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "1.21.2",
3
+ "version": "1.21.3",
4
4
  "description": "Shared tooling, repository automation, runtime policies, and agent standards for Ankhorage TypeScript projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankhorage/devtools#readme",