Skip to content

Commit 9fc8f3d

Browse files
committed
update
1 parent 8a9f920 commit 9fc8f3d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

packages/cli/src/actions/info.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ async function getZenStackPackages(projectPath: string): Promise<Array<{ pkg: st
5757
with: { type: 'json' },
5858
})
5959
).default;
60+
if (depPkgJson.private) {
61+
return undefined;
62+
}
6063
return { pkg, version: depPkgJson.version as string };
6164
} catch {
6265
return { pkg, version: undefined };
6366
}
6467
}),
6568
);
6669

67-
return result;
70+
return result.filter((p) => !!p);
6871
}

packages/cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function createProgram() {
143143
.action(checkAction);
144144

145145
program.hook('preAction', async (_thisCommand, actionCommand) => {
146-
if (actionCommand.getOptionValue('versionCheck')) {
146+
if (actionCommand.getOptionValue('versionCheck') !== false) {
147147
await checkNewVersion();
148148
}
149149
});

packages/cli/src/utils/version-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ export async function checkNewVersion() {
3333
}
3434

3535
export async function getLatestVersion() {
36-
const fetchResult = await fetch('https://registry.npmjs.org/@zenstackhq/cli', {
36+
const fetchResult = await fetch(`https://registry.npmjs.org/@zenstackhq/cli/${VERSION_CHECK_TAG}`, {
3737
headers: { accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' },
3838
signal: AbortSignal.timeout(CHECK_VERSION_TIMEOUT),
3939
});
4040

4141
if (fetchResult.ok) {
4242
const data: any = await fetchResult.json();
43-
const latestVersion = data?.['dist-tags']?.[VERSION_CHECK_TAG];
43+
const latestVersion = data?.version;
4444
if (typeof latestVersion === 'string' && semver.valid(latestVersion)) {
4545
return latestVersion;
4646
}

0 commit comments

Comments
 (0)