Skip to content

Commit 3d91efe

Browse files
committed
perf(version): not force the loading of lerna.
1 parent 1d67963 commit 3d91efe

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/utils.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ export const getVersion = (config: GeneriOptions): string | undefined => {
2323
const pkg = fs.existsSync(config.packagePath)
2424
? destr<Record<string, any>>(fs.readFileSync(config.packagePath))
2525
: {};
26+
27+
if (pkg?.version) return `v${pkg.version}`;
28+
2629
const lerna = fs.existsSync(config.lernaPath)
2730
? destr<Record<string, any>>(fs.readFileSync(config.lernaPath))
2831
: {};
2932

30-
return pkg.version
31-
? `v${pkg.version}`
32-
: lerna.version
33-
? `v${lerna.version}`
34-
: undefined;
33+
return lerna?.version ? `v${lerna.version}` : undefined;
3534
};
3635

3736
export const getChangelogRoot = (name: string = 'CHANGELOG.md') => {

0 commit comments

Comments
 (0)