11import {
22 CreatePlan ,
3- DestroyPlan , ModifyPlan ,
3+ DestroyPlan ,
4+ ModifyPlan ,
45 ParameterChange ,
56 Plugin ,
67 Resource ,
78 ResourceSettings ,
89 runPlugin
910} from 'codify-plugin-lib' ;
10- import { StringIndexedObject } from 'codify-schemas' ;
11- import { b } from 'vitest/dist/reporters-yx5ZTtEV' ;
11+ import { OS , StringIndexedObject } from 'codify-schemas' ;
1212import * as fs from 'node:fs' ;
1313
1414export interface TestConfig extends StringIndexedObject {
@@ -27,6 +27,7 @@ export class TestResource extends Resource<TestConfig> {
2727 getSettings ( ) : ResourceSettings < TestConfig > {
2828 return {
2929 id : 'test' ,
30+ operatingSystems : [ OS . Linux , OS . Darwin ] ,
3031 allowMultiple : true ,
3132 } ;
3233 }
@@ -54,6 +55,7 @@ export class TestResource2 extends Resource<TestConfig2> {
5455 getSettings ( ) : ResourceSettings < TestConfig2 > {
5556 return {
5657 id : 'test2' ,
58+ operatingSystems : [ OS . Linux , OS . Darwin ] ,
5759 parameterSettings : {
5860 propB : { type : 'array' }
5961 }
@@ -82,7 +84,8 @@ export class TestUninstallResource extends Resource<TestConfig> {
8284 first = true ;
8385 getSettings ( ) : ResourceSettings < TestConfig > {
8486 return {
85- id : 'test-uninstall'
87+ id : 'test-uninstall' ,
88+ operatingSystems : [ OS . Linux , OS . Darwin ] ,
8689 }
8790 }
8891
@@ -106,6 +109,7 @@ export class TestModifyResource extends Resource<TestConfig> {
106109 getSettings ( ) : ResourceSettings < TestConfig > {
107110 return {
108111 id : 'test-modify' ,
112+ operatingSystems : [ OS . Linux , OS . Darwin ] ,
109113 parameterSettings : {
110114 propA : { type : 'string' , canModify : true } ,
111115 propB : { type : 'string' , canModify : true } ,
@@ -141,6 +145,7 @@ export class TestDestroyResource extends Resource<TestConfig> {
141145 getSettings ( ) : ResourceSettings < TestConfig > {
142146 return {
143147 id : 'test-destroy' ,
148+ operatingSystems : [ OS . Linux , OS . Darwin ] ,
144149 }
145150 }
146151
@@ -165,6 +170,29 @@ export class TestDestroyResource extends Resource<TestConfig> {
165170 }
166171}
167172
173+ export class WindowsOnlyResource extends Resource < TestConfig > {
174+ private name : string ;
175+
176+ getSettings ( ) : ResourceSettings < TestConfig > {
177+ return {
178+ id : 'windows-only' ,
179+ operatingSystems : [ OS . Windows ] ,
180+ }
181+ }
182+
183+ async refresh ( parameters : Partial < TestConfig > ) : Promise < Array < Partial < TestConfig > > | Partial < TestConfig > | null > {
184+ return { } ;
185+ }
186+
187+ async modify ( pc : ParameterChange < TestConfig > , plan : ModifyPlan < TestConfig > ) : Promise < void > {
188+ return super . modify ( pc , plan ) ;
189+ }
190+
191+ async create ( plan : CreatePlan < TestConfig > ) : Promise < void > { }
192+
193+ async destroy ( plan : DestroyPlan < TestConfig > ) : Promise < void > { }
194+ }
195+
168196export class TestDestroyResource2 extends TestDestroyResource {
169197 getSettings ( ) : ResourceSettings < TestConfig > {
170198 return {
@@ -181,6 +209,7 @@ runPlugin(Plugin.create(
181209 new TestUninstallResource ( ) ,
182210 new TestModifyResource ( ) ,
183211 new TestDestroyResource ( ) ,
184- new TestDestroyResource2 ( )
212+ new TestDestroyResource2 ( ) ,
213+ new WindowsOnlyResource ( ) ,
185214 ]
186215) ) ;
0 commit comments