Files
renovate/tools/static-data/generate-lambda-node-schedule.mjs
T
renovate[bot] 4a2578d18d build(deps): update dependency zod to v4 (main) (#41225)
* build(deps): update dependency zod to v4

| datasource | package | from    | to    |
| ---------- | ------- | ------- | ----- |
| npm        | zod     | 3.25.76 | 4.3.6 |

* fix: zod migration

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-18 07:37:50 +00:00

53 lines
1.3 KiB
JavaScript

import { z } from 'zod/v4';
import { updateJsonFile } from './utils.mjs';
const Runtimes = z.object({
cycle: z.string().describe('The ID of the Runtime'),
support: z
.union([z.boolean(), z.string()])
.describe(
'Either `true` if in support, or a string denoting when support for this Runtime will end. 0.10.x is a sole exception which has a value of `false` and will be filtered out',
),
});
const RuntimesArray = z.array(Runtimes);
const lambdaDataUrl = 'https://endoflife.date/api/aws-lambda.json';
await (async () => {
console.log('Generating node schedule');
const lambdas = await fetch(lambdaDataUrl).then(async (response) => {
if (!response.ok) {
console.error(`Failed to fetch ${lambdaDataUrl}`, response);
process.exit(1);
}
return RuntimesArray.parseAsync(await response.json());
});
/** @type {Record<string, z.infer<Runtimes>>} */
const nodeRuntimes = {};
for (let lambda of lambdas) {
if (!lambda.cycle.startsWith('nodejs')) {
continue;
}
if (lambda.support === false) {
continue;
}
const versionMatch = /^nodejs([0-9]+)\.x$/.exec(lambda.cycle);
if (!versionMatch?.[1]) {
continue;
}
nodeRuntimes[versionMatch[1]] = lambda;
}
await updateJsonFile(
'./data/lambda-node-js-schedule.json',
JSON.stringify(nodeRuntimes, null, 2),
);
})();