-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
importing package.json directly from the require / import system causes it to be bundled with the transpiled code in ./lib which then causes problems with release. Closes #249
- Loading branch information
Showing
5 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { name, version } from '../package.json' | ||
import pkg from './package' | ||
|
||
export const USER_AGENT = `${name}/${version}` | ||
export const USER_AGENT = `${pkg.name}/${pkg.version}` | ||
|
||
export const JSON_CONTENT_TYPE = 'application/json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { readFileSync } from 'fs' | ||
import { join } from 'path' | ||
import { IPackageJson } from 'package-json-type' | ||
|
||
const packageJson: IPackageJson = JSON.parse( | ||
readFileSync(join(__dirname, '../package.json'), { encoding: 'utf8' }), | ||
) | ||
|
||
export default packageJson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pkg from '../src/package' | ||
|
||
describe('package', () => { | ||
it('should have package name', () => { | ||
expect(pkg.name).toBe('amazon-advertising-api-sdk') | ||
}) | ||
|
||
it('should have package version', () => { | ||
expect(pkg.version).toMatch(/^\d+\.\d+\.\d+$/) | ||
}) | ||
}) |