define winget pkg
This commit is contained in:
11
src/bin.ts
11
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' }),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
18
src/dsl.ts
18
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<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,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user