@ankhorage/devtools 1.18.0 → 1.18.2
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 +2 -1
- package/dist/cli/bin/structure.d.ts +2 -0
- package/dist/cli/bin/structure.js +15 -0
- package/dist/features/structure-descriptor-generation/adapters/outbound/resolveStructureReleaseCommandAsync.d.ts +2 -0
- package/dist/features/structure-descriptor-generation/adapters/outbound/resolveStructureReleaseCommandAsync.js +21 -0
- package/dist/tools/workflows/files/release.yml +3 -0
- package/dist/tools/workflows/index.js +3 -0
- package/dist/tools/workflows/renderWorkflowAsync.d.ts +1 -0
- package/dist/tools/workflows/renderWorkflowAsync.js +1 -0
- package/package.json +8 -10
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/devtools
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Shared tooling, repository automation, runtime policies, and agent standards for Ankhorage TypeScript projects
|
|
9
9
|
|
|
@@ -479,6 +479,7 @@ bunx @ankhorage/devtools ankhorage-changeset
|
|
|
479
479
|
bunx @ankhorage/devtools ankhorage-eslint
|
|
480
480
|
bunx @ankhorage/devtools ankhorage-knip
|
|
481
481
|
bunx @ankhorage/devtools ankhorage-prettier
|
|
482
|
+
bunx @ankhorage/devtools ankhorage-structure
|
|
482
483
|
```
|
|
483
484
|
|
|
484
485
|
## Generated documentation
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runStructureGenerationCommandAsync } from '../../features/structure-descriptor-generation/adapters/inbound/runStructureGenerationCommandAsync.js';
|
|
3
|
+
const [operation, ...argv] = process.argv.slice(2);
|
|
4
|
+
if (operation !== 'build' && operation !== 'check') {
|
|
5
|
+
console.error('Usage: ankhorage-structure <build|check> [directory]');
|
|
6
|
+
process.exitCode = 1;
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
const result = await runStructureGenerationCommandAsync(operation, argv, {
|
|
10
|
+
cwd: process.cwd(),
|
|
11
|
+
writeStdout: (text) => process.stdout.write(text),
|
|
12
|
+
writeStderr: (text) => process.stderr.write(text),
|
|
13
|
+
});
|
|
14
|
+
process.exitCode = result.exitCode;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
/*** Use Devtools' built structure CLI for self-release and the installed binary in consumers. */
|
|
4
|
+
export async function resolveStructureReleaseCommandAsync(targetDirectory) {
|
|
5
|
+
try {
|
|
6
|
+
const packageJson = JSON.parse(await readFile(resolve(targetDirectory, 'package.json'), 'utf8'));
|
|
7
|
+
return isPackageNamed(packageJson, '@ankhorage/devtools') ? SELF_COMMAND : CONSUMER_COMMAND;
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
11
|
+
return CONSUMER_COMMAND;
|
|
12
|
+
}
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/*** Narrow a package manifest by its canonical package name. */
|
|
17
|
+
function isPackageNamed(value, expectedName) {
|
|
18
|
+
return (typeof value === 'object' && value !== null && 'name' in value && value.name === expectedName);
|
|
19
|
+
}
|
|
20
|
+
const SELF_COMMAND = 'node ./dist/cli/bin/structure.js';
|
|
21
|
+
const CONSUMER_COMMAND = './node_modules/.bin/ankhorage-structure';
|
|
@@ -114,6 +114,9 @@ jobs:
|
|
|
114
114
|
after_version="$(node -p "require('./package.json').version")"
|
|
115
115
|
|
|
116
116
|
if [ "$before_version" != "$after_version" ]; then
|
|
117
|
+
if node -e "const p=require('./package.json'); process.exit(p.ankh?.structure === undefined ? 1 : 0)"; then
|
|
118
|
+
__ANKH_STRUCTURE_RELEASE_COMMAND__ build .
|
|
119
|
+
fi
|
|
117
120
|
if node -e "const p=require('./package.json'); process.exit(p.scripts?.docs ? 0 : 1)"; then
|
|
118
121
|
bun run docs
|
|
119
122
|
else
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { access } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { resolveApmReleaseCommandAsync } from '../../features/apm-release-validation/adapters/outbound/resolveApmReleaseCommandAsync.js';
|
|
4
|
+
import { resolveStructureReleaseCommandAsync } from '../../features/structure-descriptor-generation/adapters/outbound/resolveStructureReleaseCommandAsync.js';
|
|
4
5
|
import { bunRuntimePolicy, nodeRuntimePolicy } from '../../policy/bunRuntimePolicy.js';
|
|
5
6
|
import { readCurrentDoctorVersion } from './readCurrentDoctorVersion.js';
|
|
6
7
|
import { renderRenovateWorkflowAsync } from './renderRenovateWorkflowAsync.js';
|
|
@@ -35,6 +36,7 @@ function createWorkflowDefinition(relativePath, sourcePath) {
|
|
|
35
36
|
relativePath,
|
|
36
37
|
render: async (targetDirectory) => await renderWorkflowAsync(sourceUrl, {
|
|
37
38
|
apmReleaseCommand: await resolveApmReleaseCommandAsync(targetDirectory),
|
|
39
|
+
structureReleaseCommand: await resolveStructureReleaseCommandAsync(targetDirectory),
|
|
38
40
|
bunVersion: bunRuntimePolicy.version,
|
|
39
41
|
doctorVersion: readCurrentDoctorVersion(),
|
|
40
42
|
nodeVersion: nodeRuntimePolicy.setupVersion,
|
|
@@ -48,6 +50,7 @@ function createRenovateWorkflowDefinition() {
|
|
|
48
50
|
relativePath: '.github/workflows/renovate.yml',
|
|
49
51
|
render: async (targetDirectory) => await renderRenovateWorkflowAsync(sourceUrl, targetDirectory, {
|
|
50
52
|
apmReleaseCommand: await resolveApmReleaseCommandAsync(targetDirectory),
|
|
53
|
+
structureReleaseCommand: await resolveStructureReleaseCommandAsync(targetDirectory),
|
|
51
54
|
bunVersion: bunRuntimePolicy.version,
|
|
52
55
|
doctorVersion: readCurrentDoctorVersion(),
|
|
53
56
|
nodeVersion: nodeRuntimePolicy.setupVersion,
|
|
@@ -3,6 +3,7 @@ export interface WorkflowPolicy {
|
|
|
3
3
|
readonly doctorVersion: string;
|
|
4
4
|
readonly nodeVersion: string;
|
|
5
5
|
readonly apmReleaseCommand?: string;
|
|
6
|
+
readonly structureReleaseCommand?: string;
|
|
6
7
|
}
|
|
7
8
|
/*** Renders one workflow template with the canonical runtime, Doctor, and Changesets policy. */
|
|
8
9
|
export declare function renderWorkflowAsync(sourceUrl: URL, policy: WorkflowPolicy): Promise<string>;
|
|
@@ -10,6 +10,7 @@ export async function renderWorkflowAsync(sourceUrl, policy) {
|
|
|
10
10
|
.replaceAll(CHANGESETS_VERSION_COMMAND_TOKEN, changesetsPolicy.workflowCommands.version)
|
|
11
11
|
.replaceAll(DOCTOR_VERSION_TOKEN, policy.doctorVersion)
|
|
12
12
|
.replaceAll('__ANKH_APM_RELEASE_COMMAND__', policy.apmReleaseCommand ?? './node_modules/.bin/ankhorage-apm-release')
|
|
13
|
+
.replaceAll('__ANKH_STRUCTURE_RELEASE_COMMAND__', policy.structureReleaseCommand ?? './node_modules/.bin/ankhorage-structure')
|
|
13
14
|
.replaceAll(NODE_VERSION_TOKEN, policy.nodeVersion);
|
|
14
15
|
}
|
|
15
16
|
const BUN_VERSION_TOKEN = '__ANKH_BUN_VERSION__';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/devtools",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.2",
|
|
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",
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
"ankhorage-eslint": "./dist/cli/bin/eslint.js",
|
|
67
67
|
"ankhorage-knip": "./dist/cli/bin/knip.js",
|
|
68
68
|
"ankhorage-prettier": "./dist/cli/bin/prettier.js",
|
|
69
|
-
"ankhorage-apm-release": "./dist/cli/bin/apm-release.js"
|
|
69
|
+
"ankhorage-apm-release": "./dist/cli/bin/apm-release.js",
|
|
70
|
+
"ankhorage-structure": "./dist/cli/bin/structure.js"
|
|
70
71
|
},
|
|
71
72
|
"exports": {
|
|
72
73
|
"./cli": {
|
|
@@ -143,20 +144,17 @@
|
|
|
143
144
|
"knip": "^6.34.0",
|
|
144
145
|
"prettier": "^3.9.6",
|
|
145
146
|
"typescript-eslint": "^8.69.0",
|
|
146
|
-
"@ankhorage/contracts": "^22.1.1"
|
|
147
|
+
"@ankhorage/contracts": "^22.1.1",
|
|
148
|
+
"typescript": "~6.0.3"
|
|
147
149
|
},
|
|
148
150
|
"devDependencies": {
|
|
149
151
|
"@ankhorage/paradox": "^0.1.26",
|
|
150
152
|
"@ankhorage/ankh": "^0.8.11",
|
|
151
|
-
"@ankhorage/doctor": "0.10.
|
|
153
|
+
"@ankhorage/doctor": "0.10.26",
|
|
152
154
|
"@techstark/opencv-js": "^5.0.0-release.1",
|
|
153
155
|
"@types/bun": "^1.4.1",
|
|
154
156
|
"@types/node": "^26.4.1",
|
|
155
|
-
"sharp": "^0.35.4"
|
|
156
|
-
"typescript": "~6.0.3"
|
|
157
|
+
"sharp": "^0.35.4"
|
|
157
158
|
},
|
|
158
|
-
"packageManager": "bun@1.4.2"
|
|
159
|
-
"peerDependencies": {
|
|
160
|
-
"typescript": ">=5.9.3 <7"
|
|
161
|
-
}
|
|
159
|
+
"packageManager": "bun@1.4.2"
|
|
162
160
|
}
|