-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: cli gets version directly from package.json
import the version via a TS `import` from the _package.json_
- Loading branch information
1 parent
a0b6171
commit 3e942b0
Showing
8 changed files
with
23 additions
and
18 deletions.
There are no files selected for viewing
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
10 changes: 0 additions & 10 deletions
10
packages/core/src/lib/cli/tests/helpers/get-package-json-version.ts
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { it, expect } from 'vitest'; | ||
import { mockCli } from './helpers/mock-cli'; | ||
import { main } from '../main'; | ||
import { getPackageJsonVersion } from './helpers/get-package-json-version'; | ||
import {version} from '../../../../package.json'; | ||
|
||
it('should include the version in main', () => { | ||
const { allLogs } = mockCli(); | ||
main(); | ||
expect(allLogs()).toContain(`Sheriff (${getPackageJsonVersion()})`); | ||
expect(allLogs()).toContain(`Sheriff (${version})`); | ||
}); |
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,11 +1,11 @@ | ||
import { expect, it } from 'vitest'; | ||
import { mockCli } from './helpers/mock-cli'; | ||
import { main } from '../main'; | ||
import { getPackageJsonVersion } from './helpers/get-package-json-version'; | ||
import { version } from '../../../../package.json'; | ||
|
||
it('should print out the current version according to the package.json', () => { | ||
const { allLogs } = mockCli(); | ||
main('version'); | ||
|
||
expect(allLogs()).toBe(getPackageJsonVersion()); | ||
expect(allLogs()).toBe(version); | ||
}); |
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
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 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["vitest", "node"], | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"] | ||
} |
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