Skip to content

Commit

Permalink
fix: semantic version object type for getVersion
Browse files Browse the repository at this point in the history
Was wrongly named and not available.
  • Loading branch information
ifiokjr committed May 8, 2020
1 parent 6b7c4bf commit e4ce973
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions json.macro.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PackageJson, SemanticVersionObject, TsConfigJson } from './types';
import { PackageJson, SemanticVersion, TsConfigJson } from './types';

/**
* This loads a json file from the provided path. The path can be relative to
Expand Down Expand Up @@ -203,4 +203,4 @@ export function loadTsConfigJson(fileName: string): TsConfigJson;
* ```
*/
export function getVersion(verbose?: false): string;
export function getVersion(verbose: true): SemanticVersionObject;
export function getVersion(verbose: true): SemanticVersion;
14 changes: 10 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
- [Table of Contents](#table-of-contents)
- [Usage](#usage)
- [Setup](#setup)
- [`.babelrc`](#babelrc)
- [`babel.config.js`](#babelconfigjs)
- [Code Example](#code-example)
- [API](#api)
- [`json.macro/types`](#jsonmacrotypes)
Expand Down Expand Up @@ -53,7 +51,7 @@ yarn add -D json.macro babel-plugin-macros

Once installed make sure to add the 'babel-plugin-macros' to your `babel.config.js` (or `.babelrc`) file.

##### `.babelrc`
**`.babelrc`**

```diff
{
Expand All @@ -64,7 +62,7 @@ Once installed make sure to add the 'babel-plugin-macros' to your `babel.config.
}
```

##### `babel.config.js`
**`babel.config.js`**

```diff
module.exports = {
Expand Down Expand Up @@ -125,6 +123,14 @@ let pkg: PackageJson;
let tsconfig: TsConfigJson;
```

There is also a `SemanticVersion` interface which exported by the same file. This is the return type for the `getVersion(true)` function call.

```ts
import { SemanticVersion } from 'json.macro/types';

let version: SemanticVersion;
```

<br />

## Contributing
Expand Down

0 comments on commit e4ce973

Please sign in to comment.