@pulumi/command 0.3.3-alpha.1656628464 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -276,6 +276,60 @@ const cleanupKubernetesNamespaces = new local.Command("cleanupKubernetesNamespac
276
276
  });
277
277
  ```
278
278
 
279
+ ### Working with Assets and Paths
280
+
281
+ When a local command creates assets as part of its execution, these can be captured by specifying `assetPaths` or `archivePaths`.
282
+
283
+ ```typescript
284
+ const lambdaBuild = local.runOutput({
285
+ dir: "../my-function",
286
+ command: `yarn && yarn build`,
287
+ archivePaths: ["dist/**"],
288
+ });
289
+
290
+ new aws.lambda.Function("my-function", {
291
+ code: lambdaBuild.archive,
292
+ // ...
293
+ });
294
+ ```
295
+
296
+ When using the `assetPaths` and `archivePaths`, they take a list of 'globs'.
297
+ - We only include files not directories for assets and archives.
298
+ - Path separators are `/` on all platforms - including Windows.
299
+ - Patterns starting with `!` are 'exclude' rules.
300
+ - Rules are evaluated in order, so exclude rules should be after inclusion rules.
301
+ - `*` matches anything except `/`
302
+ - `**` matches anything, _including_ `/`
303
+ - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
304
+ - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
305
+
306
+ #### Asset Paths Example
307
+
308
+ Given the rules:
309
+ ```yaml
310
+ - "assets/**"
311
+ - "src/**.js"
312
+ - "!**secret.*"
313
+ ```
314
+
315
+ When evaluating against this folder:
316
+
317
+ ```yaml
318
+ - assets/
319
+ - logos/
320
+ - logo.svg
321
+ - src/
322
+ - index.js
323
+ - secret.js
324
+ ```
325
+
326
+ The following paths will be returned:
327
+
328
+ ```yaml
329
+ - assets/logos/logo.svg
330
+ - src/index.js
331
+ ```
332
+
279
333
  ## Building
280
334
 
281
335
  ### Dependencies
@@ -21,6 +21,25 @@ export declare class Command extends pulumi.CustomResource {
21
21
  * when multiple copies of the Pulumi SDK have been loaded into the same process.
22
22
  */
23
23
  static isInstance(obj: any): obj is Command;
24
+ /**
25
+ * An archive asset containing files found after running the command.
26
+ */
27
+ readonly archive: pulumi.Output<pulumi.asset.Archive | undefined>;
28
+ /**
29
+ * A list of path globs to return as a single archive asset after the command completes.
30
+ */
31
+ readonly archivePaths: pulumi.Output<string[] | undefined>;
32
+ /**
33
+ * A list of path globs to read after the command completes.
34
+ */
35
+ readonly assetPaths: pulumi.Output<string[] | undefined>;
36
+ /**
37
+ * A map of assets found after running the command.
38
+ * The key is the relative path from the command dir
39
+ */
40
+ readonly assets: pulumi.Output<{
41
+ [key: string]: pulumi.asset.Asset | pulumi.asset.Archive;
42
+ } | undefined>;
24
43
  /**
25
44
  * The command to run on create.
26
45
  */
@@ -78,6 +97,88 @@ export declare class Command extends pulumi.CustomResource {
78
97
  * The set of arguments for constructing a Command resource.
79
98
  */
80
99
  export interface CommandArgs {
100
+ /**
101
+ * A list of path globs to return as a single archive asset after the command completes.
102
+ *
103
+ * When specifying glob patterns the following rules apply:
104
+ * - We only include files not directories for assets and archives.
105
+ * - Path separators are `/` on all platforms - including Windows.
106
+ * - Patterns starting with `!` are 'exclude' rules.
107
+ * - Rules are evaluated in order, so exclude rules should be after inclusion rules.
108
+ * - `*` matches anything except `/`
109
+ * - `**` matches anything, _including_ `/`
110
+ * - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
111
+ * - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
112
+ *
113
+ * #### Example
114
+ *
115
+ * Given the rules:
116
+ * ```yaml
117
+ * - "assets/**"
118
+ * - "src/**.js"
119
+ * - "!**secret.*"
120
+ * ```
121
+ *
122
+ * When evaluating against this folder:
123
+ *
124
+ * ```yaml
125
+ * - assets/
126
+ * - logos/
127
+ * - logo.svg
128
+ * - src/
129
+ * - index.js
130
+ * - secret.js
131
+ * ```
132
+ *
133
+ * The following paths will be returned:
134
+ *
135
+ * ```yaml
136
+ * - assets/logos/logo.svg
137
+ * - src/index.js
138
+ * ```
139
+ */
140
+ archivePaths?: pulumi.Input<pulumi.Input<string>[]>;
141
+ /**
142
+ * A list of path globs to read after the command completes.
143
+ *
144
+ * When specifying glob patterns the following rules apply:
145
+ * - We only include files not directories for assets and archives.
146
+ * - Path separators are `/` on all platforms - including Windows.
147
+ * - Patterns starting with `!` are 'exclude' rules.
148
+ * - Rules are evaluated in order, so exclude rules should be after inclusion rules.
149
+ * - `*` matches anything except `/`
150
+ * - `**` matches anything, _including_ `/`
151
+ * - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
152
+ * - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
153
+ *
154
+ * #### Example
155
+ *
156
+ * Given the rules:
157
+ * ```yaml
158
+ * - "assets/**"
159
+ * - "src/**.js"
160
+ * - "!**secret.*"
161
+ * ```
162
+ *
163
+ * When evaluating against this folder:
164
+ *
165
+ * ```yaml
166
+ * - assets/
167
+ * - logos/
168
+ * - logo.svg
169
+ * - src/
170
+ * - index.js
171
+ * - secret.js
172
+ * ```
173
+ *
174
+ * The following paths will be returned:
175
+ *
176
+ * ```yaml
177
+ * - assets/logos/logo.svg
178
+ * - src/index.js
179
+ * ```
180
+ */
181
+ assetPaths?: pulumi.Input<pulumi.Input<string>[]>;
81
182
  /**
82
183
  * The command to run on create.
83
184
  */
package/local/command.js CHANGED
@@ -24,6 +24,8 @@ class Command extends pulumi.CustomResource {
24
24
  let resourceInputs = {};
25
25
  opts = opts || {};
26
26
  if (!opts.id) {
27
+ resourceInputs["archivePaths"] = args ? args.archivePaths : undefined;
28
+ resourceInputs["assetPaths"] = args ? args.assetPaths : undefined;
27
29
  resourceInputs["create"] = args ? args.create : undefined;
28
30
  resourceInputs["delete"] = args ? args.delete : undefined;
29
31
  resourceInputs["dir"] = args ? args.dir : undefined;
@@ -32,10 +34,16 @@ class Command extends pulumi.CustomResource {
32
34
  resourceInputs["stdin"] = args ? args.stdin : undefined;
33
35
  resourceInputs["triggers"] = args ? args.triggers : undefined;
34
36
  resourceInputs["update"] = args ? args.update : undefined;
37
+ resourceInputs["archive"] = undefined /*out*/;
38
+ resourceInputs["assets"] = undefined /*out*/;
35
39
  resourceInputs["stderr"] = undefined /*out*/;
36
40
  resourceInputs["stdout"] = undefined /*out*/;
37
41
  }
38
42
  else {
43
+ resourceInputs["archive"] = undefined /*out*/;
44
+ resourceInputs["archivePaths"] = undefined /*out*/;
45
+ resourceInputs["assetPaths"] = undefined /*out*/;
46
+ resourceInputs["assets"] = undefined /*out*/;
39
47
  resourceInputs["create"] = undefined /*out*/;
40
48
  resourceInputs["delete"] = undefined /*out*/;
41
49
  resourceInputs["dir"] = undefined /*out*/;
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../local/command.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,iFAAiF;;;AAEjF,yCAAyC;AACzC,0CAA0C;AAE1C;;;;;;GAMG;AACH,MAAa,OAAQ,SAAQ,MAAM,CAAC,cAAc;IAsE9C;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,IAAkB,EAAE,IAAmC;QAC7E,IAAI,cAAc,GAAkB,EAAE,CAAC;QACvC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;YACV,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;YAC1D,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;YAC1D,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;YACpD,cAAc,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CA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,CAAC,GAAQ;QAC7B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,GAAG,CAAC,cAAc,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC;IACxD,CAAC;;AAzBL,0BAmIC;AAtHG,gBAAgB;AACO,oBAAY,GAAG,uBAAuB,CAAC"}
package/local/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./command";
2
+ export * from "./run";
package/local/index.js CHANGED
@@ -20,6 +20,7 @@ const pulumi = require("@pulumi/pulumi");
20
20
  const utilities = require("../utilities");
21
21
  // Export members:
22
22
  __exportStar(require("./command"), exports);
23
+ __exportStar(require("./run"), exports);
23
24
  // Import resources to register:
24
25
  const command_1 = require("./command");
25
26
  const _module = {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../local/index.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,iFAAiF;;;;;;;;;;;;;;;;AAEjF,yCAAyC;AACzC,0CAA0C;AAE1C,kBAAkB;AAClB,4CAA0B;AAE1B,gCAAgC;AAChC,uCAAoC;AAEpC,MAAM,OAAO,GAAG;IACZ,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE;IAC/B,SAAS,EAAE,CAAC,IAAY,EAAE,IAAY,EAAE,GAAW,EAAmB,EAAE;QACpE,QAAQ,IAAI,EAAE;YACV,KAAK,uBAAuB;gBACxB,OAAO,IAAI,iBAAO,CAAC,IAAI,EAAO,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;YACrD;gBACI,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;SACxD;IACL,CAAC;CACJ,CAAC;AACF,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../local/index.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,iFAAiF;;;;;;;;;;;;;;;;AAEjF,yCAAyC;AACzC,0CAA0C;AAE1C,kBAAkB;AAClB,4CAA0B;AAC1B,wCAAsB;AAEtB,gCAAgC;AAChC,uCAAoC;AAEpC,MAAM,OAAO,GAAG;IACZ,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE;IAC/B,SAAS,EAAE,CAAC,IAAY,EAAE,IAAY,EAAE,GAAW,EAAmB,EAAE;QACpE,QAAQ,IAAI,EAAE;YACV,KAAK,uBAAuB;gBACxB,OAAO,IAAI,iBAAO,CAAC,IAAI,EAAO,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;YACrD;gBACI,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;SACxD;IACL,CAAC;CACJ,CAAC;AACF,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA"}
package/local/run.d.ts ADDED
@@ -0,0 +1,265 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ /**
3
+ * A local command to be executed.
4
+ * This command will always be run on any preview or deployment. Use `local.Command` to avoid duplicating executions.
5
+ */
6
+ export declare function run(args: RunArgs, opts?: pulumi.InvokeOptions): Promise<RunResult>;
7
+ export interface RunArgs {
8
+ /**
9
+ * A list of path globs to return as a single archive asset after the command completes.
10
+ *
11
+ * When specifying glob patterns the following rules apply:
12
+ * - We only include files not directories for assets and archives.
13
+ * - Path separators are `/` on all platforms - including Windows.
14
+ * - Patterns starting with `!` are 'exclude' rules.
15
+ * - Rules are evaluated in order, so exclude rules should be after inclusion rules.
16
+ * - `*` matches anything except `/`
17
+ * - `**` matches anything, _including_ `/`
18
+ * - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
19
+ * - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
20
+ *
21
+ * #### Example
22
+ *
23
+ * Given the rules:
24
+ * ```yaml
25
+ * - "assets/**"
26
+ * - "src/**.js"
27
+ * - "!**secret.*"
28
+ * ```
29
+ *
30
+ * When evaluating against this folder:
31
+ *
32
+ * ```yaml
33
+ * - assets/
34
+ * - logos/
35
+ * - logo.svg
36
+ * - src/
37
+ * - index.js
38
+ * - secret.js
39
+ * ```
40
+ *
41
+ * The following paths will be returned:
42
+ *
43
+ * ```yaml
44
+ * - assets/logos/logo.svg
45
+ * - src/index.js
46
+ * ```
47
+ */
48
+ archivePaths?: string[];
49
+ /**
50
+ * A list of path globs to read after the command completes.
51
+ *
52
+ * When specifying glob patterns the following rules apply:
53
+ * - We only include files not directories for assets and archives.
54
+ * - Path separators are `/` on all platforms - including Windows.
55
+ * - Patterns starting with `!` are 'exclude' rules.
56
+ * - Rules are evaluated in order, so exclude rules should be after inclusion rules.
57
+ * - `*` matches anything except `/`
58
+ * - `**` matches anything, _including_ `/`
59
+ * - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
60
+ * - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
61
+ *
62
+ * #### Example
63
+ *
64
+ * Given the rules:
65
+ * ```yaml
66
+ * - "assets/**"
67
+ * - "src/**.js"
68
+ * - "!**secret.*"
69
+ * ```
70
+ *
71
+ * When evaluating against this folder:
72
+ *
73
+ * ```yaml
74
+ * - assets/
75
+ * - logos/
76
+ * - logo.svg
77
+ * - src/
78
+ * - index.js
79
+ * - secret.js
80
+ * ```
81
+ *
82
+ * The following paths will be returned:
83
+ *
84
+ * ```yaml
85
+ * - assets/logos/logo.svg
86
+ * - src/index.js
87
+ * ```
88
+ */
89
+ assetPaths?: string[];
90
+ /**
91
+ * The command to run.
92
+ */
93
+ command: string;
94
+ /**
95
+ * The working directory in which to run the command from.
96
+ */
97
+ dir?: string;
98
+ /**
99
+ * Additional environment variables available to the command's process.
100
+ */
101
+ environment?: {
102
+ [key: string]: string;
103
+ };
104
+ /**
105
+ * The program and arguments to run the command.
106
+ * On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
107
+ */
108
+ interpreter?: string[];
109
+ /**
110
+ * Pass a string to the command's process as standard in
111
+ */
112
+ stdin?: string;
113
+ }
114
+ export interface RunResult {
115
+ /**
116
+ * An archive asset containing files found after running the command.
117
+ */
118
+ readonly archive?: pulumi.asset.Archive;
119
+ /**
120
+ * A map of assets found after running the command.
121
+ * The key is the relative path from the command dir
122
+ */
123
+ readonly assets?: {
124
+ [key: string]: pulumi.asset.Asset | pulumi.asset.Archive;
125
+ };
126
+ /**
127
+ * The command to run.
128
+ */
129
+ readonly command: string;
130
+ /**
131
+ * The directory from which the command was run from.
132
+ */
133
+ readonly dir?: string;
134
+ /**
135
+ * Additional environment variables available to the command's process.
136
+ */
137
+ readonly environment?: {
138
+ [key: string]: string;
139
+ };
140
+ /**
141
+ * The program and arguments to run the command.
142
+ * For example: `["/bin/sh", "-c"]`
143
+ */
144
+ readonly interpreter?: string[];
145
+ /**
146
+ * The standard error of the command's process
147
+ */
148
+ readonly stderr: string;
149
+ /**
150
+ * String passed to the command's process as standard in.
151
+ */
152
+ readonly stdin: string;
153
+ /**
154
+ * The standard output of the command's process
155
+ */
156
+ readonly stdout?: string;
157
+ }
158
+ export declare function runOutput(args: RunOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output<RunResult>;
159
+ export interface RunOutputArgs {
160
+ /**
161
+ * A list of path globs to return as a single archive asset after the command completes.
162
+ *
163
+ * When specifying glob patterns the following rules apply:
164
+ * - We only include files not directories for assets and archives.
165
+ * - Path separators are `/` on all platforms - including Windows.
166
+ * - Patterns starting with `!` are 'exclude' rules.
167
+ * - Rules are evaluated in order, so exclude rules should be after inclusion rules.
168
+ * - `*` matches anything except `/`
169
+ * - `**` matches anything, _including_ `/`
170
+ * - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
171
+ * - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
172
+ *
173
+ * #### Example
174
+ *
175
+ * Given the rules:
176
+ * ```yaml
177
+ * - "assets/**"
178
+ * - "src/**.js"
179
+ * - "!**secret.*"
180
+ * ```
181
+ *
182
+ * When evaluating against this folder:
183
+ *
184
+ * ```yaml
185
+ * - assets/
186
+ * - logos/
187
+ * - logo.svg
188
+ * - src/
189
+ * - index.js
190
+ * - secret.js
191
+ * ```
192
+ *
193
+ * The following paths will be returned:
194
+ *
195
+ * ```yaml
196
+ * - assets/logos/logo.svg
197
+ * - src/index.js
198
+ * ```
199
+ */
200
+ archivePaths?: pulumi.Input<pulumi.Input<string>[]>;
201
+ /**
202
+ * A list of path globs to read after the command completes.
203
+ *
204
+ * When specifying glob patterns the following rules apply:
205
+ * - We only include files not directories for assets and archives.
206
+ * - Path separators are `/` on all platforms - including Windows.
207
+ * - Patterns starting with `!` are 'exclude' rules.
208
+ * - Rules are evaluated in order, so exclude rules should be after inclusion rules.
209
+ * - `*` matches anything except `/`
210
+ * - `**` matches anything, _including_ `/`
211
+ * - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
212
+ * - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
213
+ *
214
+ * #### Example
215
+ *
216
+ * Given the rules:
217
+ * ```yaml
218
+ * - "assets/**"
219
+ * - "src/**.js"
220
+ * - "!**secret.*"
221
+ * ```
222
+ *
223
+ * When evaluating against this folder:
224
+ *
225
+ * ```yaml
226
+ * - assets/
227
+ * - logos/
228
+ * - logo.svg
229
+ * - src/
230
+ * - index.js
231
+ * - secret.js
232
+ * ```
233
+ *
234
+ * The following paths will be returned:
235
+ *
236
+ * ```yaml
237
+ * - assets/logos/logo.svg
238
+ * - src/index.js
239
+ * ```
240
+ */
241
+ assetPaths?: pulumi.Input<pulumi.Input<string>[]>;
242
+ /**
243
+ * The command to run.
244
+ */
245
+ command: pulumi.Input<string>;
246
+ /**
247
+ * The working directory in which to run the command from.
248
+ */
249
+ dir?: pulumi.Input<string>;
250
+ /**
251
+ * Additional environment variables available to the command's process.
252
+ */
253
+ environment?: pulumi.Input<{
254
+ [key: string]: pulumi.Input<string>;
255
+ }>;
256
+ /**
257
+ * The program and arguments to run the command.
258
+ * On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
259
+ */
260
+ interpreter?: pulumi.Input<pulumi.Input<string>[]>;
261
+ /**
262
+ * Pass a string to the command's process as standard in
263
+ */
264
+ stdin?: pulumi.Input<string>;
265
+ }
package/local/run.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // *** WARNING: this file was generated by pulumigen. ***
3
+ // *** Do not edit by hand unless you're certain you know what you are doing! ***
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.runOutput = exports.run = void 0;
6
+ const pulumi = require("@pulumi/pulumi");
7
+ const utilities = require("../utilities");
8
+ /**
9
+ * A local command to be executed.
10
+ * This command will always be run on any preview or deployment. Use `local.Command` to avoid duplicating executions.
11
+ */
12
+ function run(args, opts) {
13
+ if (!opts) {
14
+ opts = {};
15
+ }
16
+ opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
17
+ return pulumi.runtime.invoke("command:local:run", {
18
+ "archivePaths": args.archivePaths,
19
+ "assetPaths": args.assetPaths,
20
+ "command": args.command,
21
+ "dir": args.dir,
22
+ "environment": args.environment,
23
+ "interpreter": args.interpreter,
24
+ "stdin": args.stdin,
25
+ }, opts);
26
+ }
27
+ exports.run = run;
28
+ function runOutput(args, opts) {
29
+ return pulumi.output(args).apply(a => run(a, opts));
30
+ }
31
+ exports.runOutput = runOutput;
32
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../local/run.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,iFAAiF;;;AAEjF,yCAAyC;AACzC,0CAA0C;AAE1C;;;GAGG;AACH,SAAgB,GAAG,CAAC,IAAa,EAAE,IAA2B;IAC1D,IAAI,CAAC,IAAI,EAAE;QACP,IAAI,GAAG,EAAE,CAAA;KACZ;IAED,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,oBAAoB,EAAE,EAAE,IAAI,CAAC,CAAC;IACnE,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE;QAC9C,cAAc,EAAE,IAAI,CAAC,YAAY;QACjC,YAAY,EAAE,IAAI,CAAC,UAAU;QAC7B,SAAS,EAAE,IAAI,CAAC,OAAO;QACvB,KAAK,EAAE,IAAI,CAAC,GAAG;QACf,aAAa,EAAE,IAAI,CAAC,WAAW;QAC/B,aAAa,EAAE,IAAI,CAAC,WAAW;QAC/B,OAAO,EAAE,IAAI,CAAC,KAAK;KACtB,EAAE,IAAI,CAAC,CAAC;AACb,CAAC;AAfD,kBAeC;AAqJD,SAAgB,SAAS,CAAC,IAAmB,EAAE,IAA2B;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;AACvD,CAAC;AAFD,8BAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulumi/command",
3
- "version": "v0.3.3-alpha.1656628464+a3a15c79",
3
+ "version": "v0.4.0",
4
4
  "keywords": [
5
5
  "pulumi",
6
6
  "command",
@@ -12,7 +12,7 @@
12
12
  "license": "Apache-2.0",
13
13
  "scripts": {
14
14
  "build": "tsc",
15
- "install": "node scripts/install-pulumi-plugin.js resource command v0.3.3-alpha.1656628464+a3a15c79"
15
+ "install": "node scripts/install-pulumi-plugin.js resource command v0.4.0"
16
16
  },
17
17
  "dependencies": {
18
18
  "@pulumi/pulumi": "^3.0.0"
package/package.json.dev CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulumi/command",
3
- "version": "v0.3.3-alpha.1656628464+a3a15c79",
3
+ "version": "v0.4.0",
4
4
  "keywords": [
5
5
  "pulumi",
6
6
  "command",
@@ -12,7 +12,7 @@
12
12
  "license": "Apache-2.0",
13
13
  "scripts": {
14
14
  "build": "tsc",
15
- "install": "node scripts/install-pulumi-plugin.js resource command v0.3.3-alpha.1656628464+a3a15c79"
15
+ "install": "node scripts/install-pulumi-plugin.js resource command v0.4.0"
16
16
  },
17
17
  "dependencies": {
18
18
  "@pulumi/pulumi": "^3.0.0"