GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — t3code/scripts/merge-update-manifests.ts at main · VitaCodez/t3code Expand file tree/ Copy pathmerge-update-manifests.tsMore file actions 112 lines (99 loc) · 3.57 KB / Copy pathmerge-update-manifests.tsFile metadata and controls112 lines (99 loc) · 3.57 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 #!/usr/bin/env node import * as NodeRuntime from "@effect/platform-node/NodeRuntime"; import * as NodeServices from "@effect/platform-node/NodeServices"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Option from "effect/Option"; import * as Path from "effect/Path"; import * as Schema from "effect/Schema"; import { Argument, Command, Flag } from "effect/cli"; import { mergeUpdateManifests, parseUpdateManifest, serializeUpdateManifest, type UpdateManifest, } from "./lib/update-manifest.ts"; const UpdateManifestPlatform = Schema.Literals(["mac", "win"]); export type UpdateManifestPlatform = typeof UpdateManifestPlatform.Type; function getPlatformLabel(platform: UpdateManifestPlatform): string { return platform === "mac" ? "macOS" : "Windows"; } export function parsePlatformUpdateManifest( platform: UpdateManifestPlatform, raw: string, sourcePath: string, ): UpdateManifest { return parseUpdateManifest(raw, sourcePath, getPlatformLabel(platform)); } export function mergePlatformUpdateManifests( platform: UpdateManifestPlatform, primary: UpdateManifest, secondary: UpdateManifest, ): UpdateManifest { return mergeUpdateManifests(primary, secondary, getPlatformLabel(platform)); } export function serializePlatformUpdateManifest( platform: UpdateManifestPlatform, manifest: UpdateManifest, ): string { return serializeUpdateManifest(manifest, { platformLabel: getPlatformLabel(platform), }); } export const mergeUpdateManifestFiles = Effect.fn("mergeUpdateManifestFiles")(function* ( platform: UpdateManifestPlatform, primaryPathArg: string, secondaryPathArg: string, outputPathArg: string | undefined, ) { const fs = yield* FileSystem.FileSystem; const path = yield* Path.Path; const primaryPath = path.resolve(primaryPathArg); const secondaryPath = path.resolve(secondaryPathArg); const outputPath = path.resolve(outputPathArg ?? primaryPathArg); const primaryManifest = parsePlatformUpdateManifest( platform, yield* fs.readFileString(primaryPath), primaryPath, ); const secondaryManifest = parsePlatformUpdateManifest( platform, yield* fs.readFileString(secondaryPath), secondaryPath, ); const merged = mergePlatformUpdateManifests(platform, primaryManifest, secondaryManifest); yield* fs.writeFileString(outputPath, serializePlatformUpdateManifest(platform, merged)); }); export const mergeUpdateManifestsCommand = Command.make( "merge-update-manifests", { platform: Flag.Literals("platform", UpdateManifestPlatform.literals).pipe( Flag.withDescription("Update manifest platform."), ), primaryPath: Argument.String("primary-path").pipe( Argument.withDescription("Primary update manifest path. Defaults to the output path."), ), secondaryPath: Argument.String("secondary-path").pipe( Argument.withDescription( "Secondary update manifest path to merge into the primary manifest.", ), ), outputPath: Argument.String("output-path").pipe( Argument.withDescription("Optional output path for the merged manifest."), Argument.optional, ), }, ({ platform, primaryPath, secondaryPath, outputPath }) => mergeUpdateManifestFiles( platform, primaryPath, secondaryPath, Option.getOrUndefined(outputPath), ), ).pipe(Command.withDescription("Merge two Electron updater manifests into a multi-arch manifest.")); if (import.meta.main) { Command.run(mergeUpdateManifestsCommand, { version: "0.0.0" }).pipe( Effect.provide(NodeServices.layer), NodeRuntime.runMain, ); } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |