From 27309e12611c21f8506f1540850561489efa787e Mon Sep 17 00:00:00 2001 From: EthanShoeDev <13422990+EthanShoeDev@users.noreply.github.com> Date: Fri, 19 Dec 2025 20:02:03 -0500 Subject: [PATCH] define winget pkg --- src/bin.ts | 11 ++--------- src/dsl.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/bin.ts b/src/bin.ts index 6de075f..42439d7 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -3,7 +3,7 @@ import { Command as PlatformCommand } from '@effect/platform'; import { BunContext, BunRuntime } from '@effect/platform-bun'; import { Effect } from 'effect'; import pkg from '../package.json' with { type: 'json' }; -import { defineConfig } from './dsl'; +import { defineConfig, defineWingetPackage } from './dsl'; import { CommandUtils } from './utils'; import { decodeAndPrettyLogTestResult, @@ -25,14 +25,7 @@ const machineConfig = defineConfig({ // _exist: true, // }, // }, - { - name: 'Ripgrep', - type: 'Microsoft.WinGet/Package', - properties: { - id: 'BurntSushi.ripgrep.MSVC', - _exist: true, - }, - }, + defineWingetPackage({ id: 'BurntSushi.ripgrep.MSVC' }), ], }); diff --git a/src/dsl.ts b/src/dsl.ts index 8d5a2f2..e76ce2e 100644 --- a/src/dsl.ts +++ b/src/dsl.ts @@ -1,6 +1,7 @@ import * as S from 'effect/Schema'; import { ResourceUnion } from './dsc-resource-schema-types/_resource-union.gen'; import { Configuration as DscConfiguration } from './dsc-schema-types/configuration.gen'; +import type * as Resources from './dsc-resource-schema-types/index'; /** * Enhanced configuration schema with strong typing for resources. @@ -34,3 +35,20 @@ export type Configuration = S.Schema.Type; * }); */ export const defineConfig = (config: Configuration): Configuration => config; + +export const defineWingetPackage = ({ + id, + name, + ...rest +}: { + id: string; + name?: string; +} & Partial): Configuration['resources'][number] => ({ + name: name ?? id, + type: 'Microsoft.WinGet/Package', + properties: { + id, + _exist: true, + ...rest, + }, +});