@aws/agentcore 1.0.0-preview.28 → 1.0.0-preview.29
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/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
|
|
7
|
+
const CDK_PACKAGE = '@aws/agentcore-cdk';
|
|
8
|
+
const TEMPLATE_PATH = path.resolve(__dirname, '../src/assets/cdk/package.json');
|
|
9
|
+
|
|
10
|
+
function getFlagValue(flag: string): string | undefined {
|
|
11
|
+
const index = process.argv.indexOf(flag);
|
|
12
|
+
return index !== -1 ? process.argv[index + 1] : undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function resolveTargetVersion(): string {
|
|
16
|
+
const explicit = getFlagValue('--to');
|
|
17
|
+
if (explicit) {
|
|
18
|
+
return explicit;
|
|
19
|
+
}
|
|
20
|
+
const tag = getFlagValue('--tag') ?? 'latest';
|
|
21
|
+
const version = execFileSync('npm', ['view', `${CDK_PACKAGE}@${tag}`, 'version'], { encoding: 'utf-8' }).trim();
|
|
22
|
+
if (!version) {
|
|
23
|
+
throw new Error(`could not resolve ${CDK_PACKAGE}@${tag} from npm`);
|
|
24
|
+
}
|
|
25
|
+
return version;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function main(): void {
|
|
29
|
+
const dryRun = process.argv.includes('--dry-run');
|
|
30
|
+
const target = resolveTargetVersion();
|
|
31
|
+
|
|
32
|
+
const pkg = JSON.parse(readFileSync(TEMPLATE_PATH, 'utf-8')) as { dependencies: Record<string, string> };
|
|
33
|
+
const current = pkg.dependencies[CDK_PACKAGE];
|
|
34
|
+
|
|
35
|
+
if (current === target) {
|
|
36
|
+
console.log(`${CDK_PACKAGE} already pinned to ${target} — no change`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (dryRun) {
|
|
40
|
+
console.log(`[dry-run] ${CDK_PACKAGE}: ${current} -> ${target}`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
pkg.dependencies[CDK_PACKAGE] = target;
|
|
45
|
+
writeFileSync(TEMPLATE_PATH, JSON.stringify(pkg, null, 2) + '\n');
|
|
46
|
+
console.log(`${CDK_PACKAGE}: ${current} -> ${target}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
main();
|