Skip to content

Commit

Permalink
Merge pull request #223 from nimblehq/release/2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangmirs authored Sep 13, 2023
2 parents d044fe0 + 85291ff commit 5537995
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/wiki/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
The CLI can be installed globally or run directly with `npx`:

```bash
npm install -g @nimblehq/infra-template
npm install -g @nimblehq/infra-template@latest
nimble-infra generate {project-name}

# or

npx @nimblehq/infra-template generate {project-name}
npx @nimblehq/infra-template@latest generate {project-name}
```

The CLI supports the following commands:
Expand Down
2 changes: 1 addition & 1 deletion bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ process.env.NODE_ENV = 'production';
// Register tsconfig-paths to allow importing without relative paths
await import('tsconfig-paths').then((m) => m.register());
const oclif = await import('@oclif/core');
await oclif.execute({ type: 'cjs', dir: import.meta.url });
await oclif.execute({ type: 'cjs', dir: __dirname });
})();
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nimblehq/infra-template",
"version": "2.0.1",
"version": "2.0.2",
"description": "Nimble Infrastructure Template generator",
"author": "Nimblehq",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion src/generators/addons/terraformCloud/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dedent = require('dedent');
import { prompt } from 'inquirer';
import { dedent } from 'ts-dedent';

import { GeneralOptions } from '@/commands/generate';
import {
Expand Down
8 changes: 5 additions & 3 deletions src/helpers/terraform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Terraform helper', () => {
(runCommand as jest.Mock).mockRejectedValueOnce(
new Error('terraform not found')
);
const consoleSpy = jest.spyOn(global.console, 'error');
const consoleSpy = jest.spyOn(global.console, 'log');

await detectTerraform();

Expand Down Expand Up @@ -65,11 +65,13 @@ describe('Terraform helper', () => {
(runCommand as jest.Mock).mockRejectedValueOnce(
new Error('terraform not found')
);
const consoleSpy = jest.spyOn(global.console, 'error');
const consoleSpy = jest.spyOn(global.console, 'log');

await formatCode('/');

expect(consoleSpy).toHaveBeenCalledWith(Error('terraform not found'));
expect(consoleSpy).toHaveBeenCalledWith(
"Couldn't format terraform code."
);
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/terraform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { runCommand } from './childProcess';

const detectTerraform = async () => {
try {
await runCommand('which', ['terraform']);
await runCommand('terraform', []);

return true;
} catch (error) {
console.error('Terraform not found. Please install terraform.');
console.log('Terraform not found. Please install terraform.');

return false;
}
Expand All @@ -16,7 +16,7 @@ const formatCode = async (projectDir: string) => {
try {
await runCommand('terraform', ['fmt', '-recursive'], projectDir);
} catch (error) {
console.error(error);
console.log("Couldn't format terraform code.");
}
};

Expand Down

0 comments on commit 5537995

Please sign in to comment.