@quiltdata/benchling-webhook 0.4.13 → 0.5.0-20251029T180511Z
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/dist/bin/benchling-webhook.d.ts +50 -0
- package/dist/bin/benchling-webhook.d.ts.map +1 -0
- package/dist/bin/benchling-webhook.js +268 -0
- package/dist/bin/benchling-webhook.js.map +1 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +83 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/commands/deploy.d.ts +7 -0
- package/dist/bin/commands/deploy.d.ts.map +1 -0
- package/dist/bin/commands/deploy.js +154 -0
- package/dist/bin/commands/deploy.js.map +1 -0
- package/dist/bin/commands/init.d.ts +9 -0
- package/dist/bin/commands/init.d.ts.map +1 -0
- package/dist/bin/commands/init.js +155 -0
- package/dist/bin/commands/init.js.map +1 -0
- package/dist/bin/commands/validate.d.ts +5 -0
- package/dist/bin/commands/validate.d.ts.map +1 -0
- package/dist/bin/commands/validate.js +135 -0
- package/dist/bin/commands/validate.js.map +1 -0
- package/dist/bin/get-env.js +180 -0
- package/dist/bin/publish.js +327 -0
- package/{bin → dist/bin}/version.js +73 -37
- package/dist/lib/alb-api-gateway.d.ts +17 -0
- package/dist/lib/alb-api-gateway.d.ts.map +1 -0
- package/dist/lib/alb-api-gateway.js +191 -0
- package/dist/lib/alb-api-gateway.js.map +1 -0
- package/dist/lib/benchling-webhook-stack.d.ts +25 -0
- package/dist/lib/benchling-webhook-stack.d.ts.map +1 -0
- package/dist/lib/benchling-webhook-stack.js +165 -0
- package/dist/lib/benchling-webhook-stack.js.map +1 -0
- package/dist/lib/constants.d.ts +28 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +31 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/ecr-repository.d.ts +16 -0
- package/dist/lib/ecr-repository.d.ts.map +1 -0
- package/dist/lib/ecr-repository.js +90 -0
- package/dist/lib/ecr-repository.js.map +1 -0
- package/dist/lib/fargate-service.d.ts +32 -0
- package/dist/lib/fargate-service.d.ts.map +1 -0
- package/dist/lib/fargate-service.js +294 -0
- package/dist/lib/fargate-service.js.map +1 -0
- package/{lib/index.ts → dist/lib/index.d.ts} +5 -5
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +38 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/templates/base-template.d.ts +14 -0
- package/dist/lib/templates/base-template.d.ts.map +1 -0
- package/dist/lib/templates/base-template.js +68 -0
- package/dist/lib/templates/base-template.js.map +1 -0
- package/dist/lib/templates/readme.d.ts +11 -0
- package/dist/lib/templates/readme.d.ts.map +1 -0
- package/dist/lib/templates/readme.js +105 -0
- package/dist/lib/templates/readme.js.map +1 -0
- package/dist/lib/utils/config.d.ts +68 -0
- package/dist/lib/utils/config.d.ts.map +1 -0
- package/dist/lib/utils/config.js +195 -0
- package/dist/lib/utils/config.js.map +1 -0
- package/dist/lib/utils/stack-inference.d.ts +73 -0
- package/dist/lib/utils/stack-inference.d.ts.map +1 -0
- package/dist/lib/utils/stack-inference.js +410 -0
- package/dist/lib/utils/stack-inference.js.map +1 -0
- package/dist/package.json +90 -0
- package/package.json +31 -20
- package/AGENTS.md +0 -226
- package/CHANGELOG.md +0 -91
- package/bin/benchling-webhook.ts +0 -172
- package/bin/cli-auth.sh +0 -74
- package/bin/get-env.js +0 -564
- package/bin/publish-manual.js +0 -211
- package/bin/release-notes.sh +0 -82
- package/bin/sync-version.js +0 -72
- package/cdk.context.json +0 -58
- package/cdk.json +0 -85
- package/doc/NPM_OIDC_SETUP.md +0 -95
- package/doc/PARAMETERS.md +0 -203
- package/doc/RELEASE.md +0 -297
- package/doc/RELEASE_NOTES.md +0 -64
- package/jest.config.js +0 -14
- package/lib/README.md +0 -50
- package/lib/oauth-tester.json +0 -35
- package/tsconfig.json +0 -34
- /package/{bin → dist/bin}/check-logs.js +0 -0
- /package/{bin → dist/bin}/release.js +0 -0
- /package/{bin → dist/bin}/send-event.js +0 -0
- /package/{bin → dist/bin}/test-invalid-signature.js +0 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* NPM publish script with dev/prod modes
|
|
5
|
+
*
|
|
6
|
+
* By default, publishes with 'dev' tag (prerelease).
|
|
7
|
+
* Use --prod to publish as 'latest' (production).
|
|
8
|
+
* Use --check to view current package status without publishing.
|
|
9
|
+
*
|
|
10
|
+
* Prerequisites:
|
|
11
|
+
* 1. You must have an NPM access token with publish permissions
|
|
12
|
+
* 2. Set the token as environment variable: NPM_TOKEN=your_token_here
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* npm run publish # Publish as dev (prerelease)
|
|
16
|
+
* npm run publish -- --prod # Publish as latest (production)
|
|
17
|
+
* npm run publish -- --check # Check package status only
|
|
18
|
+
* npm run publish -- --dry-run # Test without publishing
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const { execSync } = require('child_process');
|
|
24
|
+
|
|
25
|
+
const NPMRC_PATH = path.join(__dirname, '..', '.npmrc');
|
|
26
|
+
const NPMRC_BACKUP_PATH = path.join(__dirname, '..', '.npmrc.backup');
|
|
27
|
+
|
|
28
|
+
function getPackageInfo() {
|
|
29
|
+
const packagePath = path.join(__dirname, '..', 'package.json');
|
|
30
|
+
return JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function checkPackageStatus() {
|
|
34
|
+
const pkg = getPackageInfo();
|
|
35
|
+
|
|
36
|
+
console.log('📦 Package Status');
|
|
37
|
+
console.log('═'.repeat(50));
|
|
38
|
+
console.log('Name: ', pkg.name);
|
|
39
|
+
console.log('Version: ', pkg.version);
|
|
40
|
+
console.log('');
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
console.log('Checking npm registry...');
|
|
44
|
+
const registryInfo = execSync(`npm view ${pkg.name} --json`, {
|
|
45
|
+
encoding: 'utf8',
|
|
46
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const registryData = JSON.parse(registryInfo);
|
|
50
|
+
const versions = Array.isArray(registryData.versions) ? registryData.versions : [registryData.version];
|
|
51
|
+
const latestVersion = registryData['dist-tags']?.latest || 'unknown';
|
|
52
|
+
const devVersion = registryData['dist-tags']?.dev || 'none';
|
|
53
|
+
|
|
54
|
+
console.log('');
|
|
55
|
+
console.log('Published Versions:', versions.length);
|
|
56
|
+
console.log('Latest (prod): ', latestVersion);
|
|
57
|
+
console.log('Dev (prerelease): ', devVersion);
|
|
58
|
+
console.log('');
|
|
59
|
+
|
|
60
|
+
if (versions.includes(pkg.version)) {
|
|
61
|
+
console.log(`⚠️ Version ${pkg.version} is already published`);
|
|
62
|
+
} else {
|
|
63
|
+
console.log(`✅ Version ${pkg.version} is ready to publish`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log('');
|
|
67
|
+
console.log(`View at: https://www.npmjs.com/package/${pkg.name}`);
|
|
68
|
+
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (error.message.includes('E404')) {
|
|
71
|
+
console.log('');
|
|
72
|
+
console.log('📭 Package not yet published to npm');
|
|
73
|
+
console.log(' Run without --check to publish');
|
|
74
|
+
} else {
|
|
75
|
+
console.error('');
|
|
76
|
+
console.error('❌ Error checking registry:', error.message);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function validateToken() {
|
|
82
|
+
const token = process.env.NPM_TOKEN;
|
|
83
|
+
|
|
84
|
+
if (!token) {
|
|
85
|
+
console.error('❌ Error: NPM_TOKEN environment variable is not set');
|
|
86
|
+
console.error('');
|
|
87
|
+
console.error('Usage:');
|
|
88
|
+
console.error(' NPM_TOKEN=your_token_here npm run publish');
|
|
89
|
+
console.error('');
|
|
90
|
+
console.error('To get an NPM access token:');
|
|
91
|
+
console.error(' 1. Go to https://www.npmjs.com/settings/[your-username]/tokens');
|
|
92
|
+
console.error(' 2. Click "Generate New Token"');
|
|
93
|
+
console.error(' 3. Select "Automation" type for CI/CD or "Publish" for manual use');
|
|
94
|
+
console.error(' 4. Copy the token and use it with this script');
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return token;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function validateGitState(isDryRun) {
|
|
102
|
+
// Check for uncommitted changes
|
|
103
|
+
try {
|
|
104
|
+
execSync('git diff-index --quiet HEAD --', { stdio: 'ignore' });
|
|
105
|
+
} catch (e) {
|
|
106
|
+
console.error('⚠️ Warning: You have uncommitted changes');
|
|
107
|
+
console.error(' It is recommended to commit changes before publishing');
|
|
108
|
+
console.error('');
|
|
109
|
+
|
|
110
|
+
// Skip prompt in dry-run mode
|
|
111
|
+
if (isDryRun) {
|
|
112
|
+
console.log(' Continuing with dry-run...');
|
|
113
|
+
console.log('');
|
|
114
|
+
return Promise.resolve();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const readline = require('readline').createInterface({
|
|
118
|
+
input: process.stdin,
|
|
119
|
+
output: process.stdout
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return new Promise((resolve) => {
|
|
123
|
+
readline.question('Continue anyway? (y/N): ', (answer) => {
|
|
124
|
+
readline.close();
|
|
125
|
+
if (answer.toLowerCase() !== 'y') {
|
|
126
|
+
console.log('Aborted');
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
resolve();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function createNpmrc(token) {
|
|
136
|
+
// Backup existing .npmrc if it exists
|
|
137
|
+
if (fs.existsSync(NPMRC_PATH)) {
|
|
138
|
+
console.log('📋 Backing up existing .npmrc');
|
|
139
|
+
fs.copyFileSync(NPMRC_PATH, NPMRC_BACKUP_PATH);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Create .npmrc with token
|
|
143
|
+
const npmrcContent = `//registry.npmjs.org/:_authToken=${token}\nregistry=https://registry.npmjs.org/\n`;
|
|
144
|
+
fs.writeFileSync(NPMRC_PATH, npmrcContent, { mode: 0o600 });
|
|
145
|
+
console.log('✅ Created .npmrc with authentication token');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function restoreNpmrc() {
|
|
149
|
+
// Remove the temporary .npmrc
|
|
150
|
+
if (fs.existsSync(NPMRC_PATH)) {
|
|
151
|
+
fs.unlinkSync(NPMRC_PATH);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Restore backup if it exists
|
|
155
|
+
if (fs.existsSync(NPMRC_BACKUP_PATH)) {
|
|
156
|
+
console.log('📋 Restoring original .npmrc');
|
|
157
|
+
fs.renameSync(NPMRC_BACKUP_PATH, NPMRC_PATH);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function buildPackage() {
|
|
162
|
+
const rootDir = path.join(__dirname, '..');
|
|
163
|
+
const distDir = path.join(rootDir, 'dist');
|
|
164
|
+
|
|
165
|
+
console.log('🔨 Building package...');
|
|
166
|
+
console.log('');
|
|
167
|
+
|
|
168
|
+
// Clean dist directory
|
|
169
|
+
if (fs.existsSync(distDir)) {
|
|
170
|
+
console.log(' Cleaning dist/');
|
|
171
|
+
fs.rmSync(distDir, { recursive: true, force: true });
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Compile TypeScript
|
|
175
|
+
console.log(' Compiling TypeScript...');
|
|
176
|
+
try {
|
|
177
|
+
execSync('npx tsc --outDir dist --declaration --declarationMap --sourceMap --noEmit false --inlineSourceMap false', {
|
|
178
|
+
cwd: rootDir,
|
|
179
|
+
stdio: 'inherit'
|
|
180
|
+
});
|
|
181
|
+
console.log('');
|
|
182
|
+
console.log('✅ Build completed successfully');
|
|
183
|
+
console.log('');
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error('');
|
|
186
|
+
console.error('❌ Build failed');
|
|
187
|
+
throw error;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function cleanBuildArtifacts() {
|
|
192
|
+
const distDir = path.join(__dirname, '..', 'dist');
|
|
193
|
+
if (fs.existsSync(distDir)) {
|
|
194
|
+
console.log('🧹 Cleaning build artifacts...');
|
|
195
|
+
fs.rmSync(distDir, { recursive: true, force: true });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function publishPackage(isDryRun, isProd) {
|
|
200
|
+
const pkg = getPackageInfo();
|
|
201
|
+
const tag = isProd ? 'latest' : 'dev';
|
|
202
|
+
|
|
203
|
+
console.log('📦 Publishing package: ' + pkg.name);
|
|
204
|
+
console.log('📌 Version: ' + pkg.version);
|
|
205
|
+
console.log('🏷️ Tag: ' + tag + (isProd ? ' (production)' : ' (prerelease)'));
|
|
206
|
+
console.log('');
|
|
207
|
+
|
|
208
|
+
let publishCmd = 'npm publish --access public';
|
|
209
|
+
|
|
210
|
+
if (isDryRun) {
|
|
211
|
+
publishCmd += ' --dry-run';
|
|
212
|
+
console.log('🔍 Running in dry-run mode (no actual publish)');
|
|
213
|
+
console.log('');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
publishCmd += ` --tag ${tag}`;
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
execSync(publishCmd, { stdio: 'inherit', cwd: path.join(__dirname, '..') });
|
|
220
|
+
|
|
221
|
+
if (isDryRun) {
|
|
222
|
+
console.log('');
|
|
223
|
+
console.log('✅ Dry run completed successfully');
|
|
224
|
+
console.log(' Remove --dry-run to publish for real');
|
|
225
|
+
} else {
|
|
226
|
+
console.log('');
|
|
227
|
+
console.log('✅ Package published successfully!');
|
|
228
|
+
console.log(` View at: https://www.npmjs.com/package/${pkg.name}/v/${pkg.version}`);
|
|
229
|
+
console.log('');
|
|
230
|
+
if (!isProd) {
|
|
231
|
+
console.log(' 📝 Note: Published as prerelease (dev tag)');
|
|
232
|
+
console.log(' To install: npm install ' + pkg.name + '@dev');
|
|
233
|
+
console.log(' To publish as production: npm run publish -- --prod');
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} catch (error) {
|
|
237
|
+
console.error('');
|
|
238
|
+
console.error('❌ Failed to publish package');
|
|
239
|
+
throw error;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async function main() {
|
|
244
|
+
const args = process.argv.slice(2);
|
|
245
|
+
|
|
246
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
247
|
+
const pkg = getPackageInfo();
|
|
248
|
+
|
|
249
|
+
console.log('📦 NPM Publish');
|
|
250
|
+
console.log('');
|
|
251
|
+
console.log('Current package:', pkg.name);
|
|
252
|
+
console.log('Current version:', pkg.version);
|
|
253
|
+
console.log('');
|
|
254
|
+
console.log('Usage:');
|
|
255
|
+
console.log(' npm run publish [options]');
|
|
256
|
+
console.log('');
|
|
257
|
+
console.log('Options:');
|
|
258
|
+
console.log(' --check Check current package status on npm (no publish)');
|
|
259
|
+
console.log(' --prod Publish as production (tag: latest)');
|
|
260
|
+
console.log(' --dry-run Test the publish process without actually publishing');
|
|
261
|
+
console.log(' --help, -h Show this help message');
|
|
262
|
+
console.log('');
|
|
263
|
+
console.log('Default Behavior:');
|
|
264
|
+
console.log(' Without --prod, publishes with "dev" tag (prerelease)');
|
|
265
|
+
console.log('');
|
|
266
|
+
console.log('Examples:');
|
|
267
|
+
console.log(' npm run publish # Publish as dev (prerelease)');
|
|
268
|
+
console.log(' npm run publish -- --prod # Publish as latest (production)');
|
|
269
|
+
console.log(' npm run publish -- --check # Check status only');
|
|
270
|
+
console.log(' npm run publish -- --dry-run # Test without publishing');
|
|
271
|
+
console.log(' npm run publish -- --prod --dry-run # Test prod publish');
|
|
272
|
+
console.log('');
|
|
273
|
+
console.log('Getting an NPM token:');
|
|
274
|
+
console.log(' 1. Visit: https://www.npmjs.com/settings/[your-username]/tokens');
|
|
275
|
+
console.log(' 2. Click "Generate New Token"');
|
|
276
|
+
console.log(' 3. Choose "Automation" (for CI/CD) or "Publish" (for manual use)');
|
|
277
|
+
console.log(' 4. Set as environment variable: export NPM_TOKEN=npm_xxxxx');
|
|
278
|
+
process.exit(0);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Handle --check flag (no auth needed)
|
|
282
|
+
if (args.includes('--check')) {
|
|
283
|
+
checkPackageStatus();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const isDryRun = args.includes('--dry-run');
|
|
288
|
+
const isProd = args.includes('--prod');
|
|
289
|
+
|
|
290
|
+
console.log('🚀 NPM Publish Script');
|
|
291
|
+
console.log('═'.repeat(50));
|
|
292
|
+
|
|
293
|
+
// Validate token
|
|
294
|
+
const token = validateToken();
|
|
295
|
+
|
|
296
|
+
// Validate git state
|
|
297
|
+
await validateGitState(isDryRun);
|
|
298
|
+
|
|
299
|
+
try {
|
|
300
|
+
// Build package
|
|
301
|
+
buildPackage();
|
|
302
|
+
|
|
303
|
+
// Create .npmrc with token
|
|
304
|
+
createNpmrc(token);
|
|
305
|
+
|
|
306
|
+
// Publish package
|
|
307
|
+
publishPackage(isDryRun, isProd);
|
|
308
|
+
} catch (error) {
|
|
309
|
+
console.error('');
|
|
310
|
+
console.error('Publishing failed');
|
|
311
|
+
process.exit(1);
|
|
312
|
+
} finally {
|
|
313
|
+
// Always restore the original .npmrc
|
|
314
|
+
restoreNpmrc();
|
|
315
|
+
|
|
316
|
+
// Clean build artifacts (keep repo clean) unless --keep-dist is specified
|
|
317
|
+
if (!args.includes('--keep-dist')) {
|
|
318
|
+
cleanBuildArtifacts();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
main().catch((error) => {
|
|
324
|
+
console.error('Unexpected error:', error);
|
|
325
|
+
restoreNpmrc();
|
|
326
|
+
process.exit(1);
|
|
327
|
+
});
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
* Version management script - bumps version numbers across all files
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
|
-
* node bin/version.js # Show
|
|
7
|
+
* node bin/version.js # Show all three version files
|
|
8
8
|
* node bin/version.js patch # 0.4.7 -> 0.4.8
|
|
9
9
|
* node bin/version.js minor # 0.4.7 -> 0.5.0
|
|
10
10
|
* node bin/version.js major # 0.4.7 -> 1.0.0
|
|
11
|
-
* node bin/version.js
|
|
12
|
-
* node bin/version.js dev-bump # 0.4.8-dev.0 -> 0.4.8-dev.1
|
|
11
|
+
* node bin/version.js sync # Force TOML and YAML to match JSON version
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
const fs = require('fs');
|
|
@@ -21,25 +20,32 @@ const pyprojectPath = path.join(__dirname, '..', 'docker', 'pyproject.toml');
|
|
|
21
20
|
const appManifestPath = path.join(__dirname, '..', 'docker', 'app-manifest.yaml');
|
|
22
21
|
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
23
22
|
|
|
23
|
+
function readPyprojectVersion() {
|
|
24
|
+
const content = fs.readFileSync(pyprojectPath, 'utf8');
|
|
25
|
+
const match = content.match(/^version\s*=\s*"([^"]+)"/m);
|
|
26
|
+
return match ? match[1] : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function readAppManifestVersion() {
|
|
30
|
+
const content = fs.readFileSync(appManifestPath, 'utf8');
|
|
31
|
+
const match = content.match(/^\s*version:\s*(.+)$/m);
|
|
32
|
+
return match ? match[1].trim() : null;
|
|
33
|
+
}
|
|
34
|
+
|
|
24
35
|
function parseVersion(version) {
|
|
25
|
-
const match = version.match(/^(\d+)\.(\d+)\.(\d+)
|
|
36
|
+
const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
26
37
|
if (!match) {
|
|
27
38
|
throw new Error(`Invalid version format: ${version}`);
|
|
28
39
|
}
|
|
29
40
|
return {
|
|
30
41
|
major: parseInt(match[1]),
|
|
31
42
|
minor: parseInt(match[2]),
|
|
32
|
-
patch: parseInt(match[3])
|
|
33
|
-
dev: match[4] ? parseInt(match[4]) : null
|
|
43
|
+
patch: parseInt(match[3])
|
|
34
44
|
};
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
function formatVersion(ver) {
|
|
38
|
-
|
|
39
|
-
if (ver.dev !== null) {
|
|
40
|
-
version += `-dev.${ver.dev}`;
|
|
41
|
-
}
|
|
42
|
-
return version;
|
|
48
|
+
return `${ver.major}.${ver.minor}.${ver.patch}`;
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
function bumpVersion(currentVersion, bumpType) {
|
|
@@ -50,33 +56,13 @@ function bumpVersion(currentVersion, bumpType) {
|
|
|
50
56
|
ver.major++;
|
|
51
57
|
ver.minor = 0;
|
|
52
58
|
ver.patch = 0;
|
|
53
|
-
ver.dev = null;
|
|
54
59
|
break;
|
|
55
60
|
case 'minor':
|
|
56
61
|
ver.minor++;
|
|
57
62
|
ver.patch = 0;
|
|
58
|
-
ver.dev = null;
|
|
59
63
|
break;
|
|
60
64
|
case 'patch':
|
|
61
65
|
ver.patch++;
|
|
62
|
-
ver.dev = null;
|
|
63
|
-
break;
|
|
64
|
-
case 'dev':
|
|
65
|
-
// If already a dev version, increment dev counter
|
|
66
|
-
// Otherwise, bump patch and add dev.0
|
|
67
|
-
if (ver.dev !== null) {
|
|
68
|
-
ver.dev++;
|
|
69
|
-
} else {
|
|
70
|
-
ver.patch++;
|
|
71
|
-
ver.dev = 0;
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
case 'dev-bump':
|
|
75
|
-
// Only bump dev counter, error if not a dev version
|
|
76
|
-
if (ver.dev === null) {
|
|
77
|
-
throw new Error('Cannot bump dev counter on non-dev version. Use "dev" instead.');
|
|
78
|
-
}
|
|
79
|
-
ver.dev++;
|
|
80
66
|
break;
|
|
81
67
|
default:
|
|
82
68
|
throw new Error(`Unknown bump type: ${bumpType}`);
|
|
@@ -108,9 +94,22 @@ function updateAppManifestVersion(newVersion) {
|
|
|
108
94
|
function main() {
|
|
109
95
|
const args = process.argv.slice(2);
|
|
110
96
|
|
|
111
|
-
// No args:
|
|
97
|
+
// No args: display all three versions
|
|
112
98
|
if (args.length === 0) {
|
|
113
|
-
|
|
99
|
+
const jsonVersion = pkg.version;
|
|
100
|
+
const tomlVersion = readPyprojectVersion();
|
|
101
|
+
const yamlVersion = readAppManifestVersion();
|
|
102
|
+
|
|
103
|
+
console.log('Version files:');
|
|
104
|
+
console.log(` package.json: ${jsonVersion}`);
|
|
105
|
+
console.log(` docker/pyproject.toml: ${tomlVersion}`);
|
|
106
|
+
console.log(` docker/app-manifest.yaml: ${yamlVersion}`);
|
|
107
|
+
|
|
108
|
+
if (jsonVersion === tomlVersion && jsonVersion === yamlVersion) {
|
|
109
|
+
console.log('\n✅ All versions are in sync');
|
|
110
|
+
} else {
|
|
111
|
+
console.log('\n⚠️ Versions are out of sync! Run "node bin/version.js sync" to fix.');
|
|
112
|
+
}
|
|
114
113
|
process.exit(0);
|
|
115
114
|
}
|
|
116
115
|
|
|
@@ -121,14 +120,13 @@ function main() {
|
|
|
121
120
|
console.log('Usage: node bin/version.js [command]');
|
|
122
121
|
console.log('');
|
|
123
122
|
console.log('Commands:');
|
|
124
|
-
console.log(' (no args) -
|
|
123
|
+
console.log(' (no args) - Display all three version files');
|
|
125
124
|
console.log(' major - Bump major version (1.0.0 -> 2.0.0)');
|
|
126
125
|
console.log(' minor - Bump minor version (0.4.7 -> 0.5.0)');
|
|
127
126
|
console.log(' patch - Bump patch version (0.4.7 -> 0.4.8)');
|
|
128
|
-
console.log('
|
|
129
|
-
console.log(' dev-bump - Bump dev counter only (0.4.8-dev.0 -> 0.4.8-dev.1)');
|
|
127
|
+
console.log(' sync - Force TOML and YAML to match JSON version');
|
|
130
128
|
console.log('');
|
|
131
|
-
console.log('This script
|
|
129
|
+
console.log('This script updates version numbers in:');
|
|
132
130
|
console.log(' - package.json');
|
|
133
131
|
console.log(' - docker/pyproject.toml');
|
|
134
132
|
console.log(' - docker/app-manifest.yaml');
|
|
@@ -139,6 +137,44 @@ function main() {
|
|
|
139
137
|
|
|
140
138
|
const bumpType = args[0];
|
|
141
139
|
|
|
140
|
+
// Sync command - force TOML and YAML to match JSON
|
|
141
|
+
if (bumpType === 'sync') {
|
|
142
|
+
const jsonVersion = pkg.version;
|
|
143
|
+
const tomlVersion = readPyprojectVersion();
|
|
144
|
+
const yamlVersion = readAppManifestVersion();
|
|
145
|
+
|
|
146
|
+
console.log('Syncing versions to match package.json:');
|
|
147
|
+
console.log(` package.json: ${jsonVersion}`);
|
|
148
|
+
console.log(` docker/pyproject.toml: ${tomlVersion} -> ${jsonVersion}`);
|
|
149
|
+
console.log(` docker/app-manifest.yaml: ${yamlVersion} -> ${jsonVersion}`);
|
|
150
|
+
console.log('');
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
updatePyprojectVersion(jsonVersion);
|
|
154
|
+
updateAppManifestVersion(jsonVersion);
|
|
155
|
+
|
|
156
|
+
// Check if version files have changes
|
|
157
|
+
let hasChanges = false;
|
|
158
|
+
try {
|
|
159
|
+
execSync('git diff --quiet docker/pyproject.toml docker/app-manifest.yaml', { stdio: 'ignore' });
|
|
160
|
+
} catch (e) {
|
|
161
|
+
hasChanges = true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (hasChanges) {
|
|
165
|
+
execSync('git add docker/pyproject.toml docker/app-manifest.yaml', { stdio: 'inherit' });
|
|
166
|
+
execSync(`git commit -m "chore: sync versions to ${jsonVersion}"`, { stdio: 'inherit' });
|
|
167
|
+
console.log('✅ Committed version sync');
|
|
168
|
+
} else {
|
|
169
|
+
console.log('✅ All versions already in sync (no changes to commit)');
|
|
170
|
+
}
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error('❌ Error:', error.message);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
process.exit(0);
|
|
176
|
+
}
|
|
177
|
+
|
|
142
178
|
// Check for uncommitted changes
|
|
143
179
|
try {
|
|
144
180
|
execSync('git diff-index --quiet HEAD --', { stdio: 'ignore' });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
2
|
+
import * as logs from "aws-cdk-lib/aws-logs";
|
|
3
|
+
import * as elbv2 from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
4
|
+
import { Construct } from "constructs";
|
|
5
|
+
export interface AlbApiGatewayProps {
|
|
6
|
+
readonly loadBalancer: elbv2.ApplicationLoadBalancer;
|
|
7
|
+
readonly webhookAllowList?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class AlbApiGateway {
|
|
10
|
+
readonly api: apigateway.RestApi;
|
|
11
|
+
readonly logGroup: logs.ILogGroup;
|
|
12
|
+
constructor(scope: Construct, id: string, props: AlbApiGatewayProps);
|
|
13
|
+
private createResourcePolicy;
|
|
14
|
+
private createCloudWatchRole;
|
|
15
|
+
private addWebhookEndpoints;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=alb-api-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alb-api-gateway.d.ts","sourceRoot":"","sources":["../../lib/alb-api-gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,uBAAuB,CAAC;IACrD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,qBAAa,aAAa;IACtB,SAAgB,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC;IACxC,SAAgB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;gBAGrC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,kBAAkB;IA8D7B,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,mBAAmB;CAqE9B"}
|