define winget pkg

This commit is contained in:
EthanShoeDev
2025-12-19 20:02:03 -05:00
parent c47b62d617
commit 27309e1261
2 changed files with 20 additions and 9 deletions

View File

@@ -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' }),
],
});

View File

@@ -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<typeof Configuration>;
* });
*/
export const defineConfig = (config: Configuration): Configuration => config;
export const defineWingetPackage = ({
id,
name,
...rest
}: {
id: string;
name?: string;
} & Partial<Resources.MicrosoftWinGetPackage.MicrosoftWinGetPackage>): Configuration['resources'][number] => ({
name: name ?? id,
type: 'Microsoft.WinGet/Package',
properties: {
id,
_exist: true,
...rest,
},
});