bicep-node
Version:
Node wrapper for interacting with the Bicep CLI.
43 lines (34 loc) • 1.16 kB
Markdown
for programatically interacting with Bicep files.
[](https://badge.fury.io/js/bicep-node)
Install this package, and add the following:
```typescript
import { Bicep } from 'bicep-node';
```
Install the Bicep CLI to a temporary folder. `bicepPath` will be set to the location of the Bicep CLI. This will install the current latest version of Bicep.
```typescript
const parentPath = os.tmpdir();
const bicepPath = await Bicep.install(parentPath);
```
Install a particular version of the Bicep CLI.
```typescript
const bicepPath = await Bicep.install(parentPath, '0.25.3');
```
Compiling a Bicep file.
```typescript
const bicep = await Bicep.initialize(bicepPath);
const bicepFile = '/path/to/main.bicep'
const result = await bicep.compile({
path: bicepFile,
});
```
Closing the connection to Bicep CLI after usage.
```typescript
bicep.dispose();
```
See [Examples](https://github.com/anthony-c-martin/bicep-node/tree/main/examples/README.md) for some example usages.
Node wrapper to expose functionality