Skip to content

Commit

Permalink
Merge pull request #6 from mijailr/refactor-names-location
Browse files Browse the repository at this point in the history
refactor(core): refactor types and main class name
  • Loading branch information
mijailr authored Aug 14, 2020
2 parents cec519e + 4c996f4 commit ee94502
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"preset": "angular",
"releaseRules": [
{ "type": "docs", "scope": "README", "release": "patch" },
{ "type": "ref", "release": "patch" },
{ "type": "refactor", "release": "patch" },
{ "type": "fix", "release": "patch" },
{ "type": "build", "release": "minor" },
{ "type": "feat", "release": "minor" },
{ "type": "fix", "release": "patch" }
{ "type": "feat", "release": "minor" }
],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
Expand Down
4 changes: 2 additions & 2 deletions src/api/TerraformCloudApi.ts → src/api/TerraformCloud.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AxiosInstance } from 'axios'
import { EventEmitter } from 'events'
import terraformCloudApiClient from './terraformCloudApiClient'
import { Account, Plan, Run } from './types'
import { Account, Plan, Run } from '../types'

export default class TerraformCloudApi extends EventEmitter {
export default class TerraformCloud extends EventEmitter {
private readonly client: AxiosInstance

constructor(apiKey: string) {
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import TerraformCloudApi from './api/TerraformCloudApi'
import TerraformCloud from './api/TerraformCloud'
import { Account, Plan, Run } from './types'

export { TerraformCloudApi }
export { TerraformCloud, Account, Plan, Run }
2 changes: 1 addition & 1 deletion src/api/types/Account.ts → src/types/Account.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TerraformCloudData, Links } from '../types/TerraformCloudData'
import { TerraformCloudData, Links } from './TerraformCloudData'

export type Account = TerraformCloudData<AccountAttributes> & {
relationships: AccountRelationships
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/api/types/Run.ts → src/types/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ export type Run = TerraformCloudData<RunAttributes> & {
relationships: RunRelationship
}

export interface RunRelationship {
interface RunRelationship {
plan: Relationship
'created-by': Relationship
'confirmed-by': Relationship
}

export interface RunAttributes {
interface RunAttributes {
'auto-apply': boolean
'error-text': null | string
'is-destroy': boolean
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions test/api/TerraformCloudApi.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import nock from 'nock'
import TerraformCloudApi from '../../src/api/TerraformCloudApi'
import AccountMock from '../mocks/AccountMock'
import RunMock from '../mocks/RunMock'
import TerraformCloud from '../../src/api/TerraformCloud'
import { AccountMock, RunMock } from '../mocks'

const client = new TerraformCloudApi('any-key')
const client = new TerraformCloud('any-key')

describe('Api requests', () => {
describe('Account', () => {
Expand Down
4 changes: 4 additions & 0 deletions test/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import AccountMock from './AccountMock'
import RunMock from './RunMock'

export { AccountMock, RunMock }

0 comments on commit ee94502

Please sign in to comment.