Draft
Conversation
7056201 to
0287a52
Compare
a51cd38 to
085b95c
Compare
Contributor
Coverage report
Test suite run success3789 tests passing in 1456 suites. Report generated by 🧪jest coverage report action from a2e57d5 |
085b95c to
a8bb7b0
Compare
a8bb7b0 to
312b035
Compare
469480a to
2dd72ba
Compare
a8fb677 to
5351562
Compare
5351562 to
14a0139
Compare
14a0139 to
56914ab
Compare
56914ab to
864eb50
Compare
864eb50 to
64b11ef
Compare
95735eb to
f526cb2
Compare
f526cb2 to
8cb46d4
Compare
6137bf0 to
3a2cebb
Compare
42a4668 to
c9f0228
Compare
c9f0228 to
2b8ecd8
Compare
2b8ecd8 to
a2e57d5
Compare
a2e57d5 to
86446dd
Compare
86446dd to
a4327a7
Compare
a4327a7 to
4bc4f60
Compare
Contributor
Author
|
/snapit |
Contributor
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260213121951Caution After installing, validate the version by running just |
Co-Authored-By: Alfonso Noriega <alfonso.noriega.meneses@gmail.com>
4bc4f60 to
35c2e6a
Compare
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/constants.d.ts@@ -32,6 +32,7 @@ export declare const environmentVariables: {
neverUsePartnersApi: string;
skipNetworkLevelRetry: string;
maxRequestTimeForNetworkCalls: string;
+ noAutoUpgrade: string;
};
export declare const defaultThemeKitAccessDomain = "theme-kit-access.shopifyapps.com";
export declare const systemEnvironmentVariables: {
packages/cli-kit/dist/public/node/fs.d.ts@@ -1,6 +1,6 @@
import { RandomNameFamily } from '../common/string.js';
import { OverloadParameters } from '../../private/common/ts/overloaded-parameters.js';
-import { findUp as internalFindUp } from 'find-up';
+import { findUp as internalFindUp, findUpSync as internalFindUpSync } from 'find-up';
import { ReadStream, WriteStream } from 'fs';
import type { Pattern, Options as GlobOptions } from 'fast-glob';
/**
@@ -335,6 +335,14 @@ export declare function defaultEOL(): EOL;
* @returns The first path found that matches or if none could be found.
*/
export declare function findPathUp(matcher: OverloadParameters<typeof internalFindUp>[0], options: OverloadParameters<typeof internalFindUp>[1]): ReturnType<typeof internalFindUp>;
+/**
+ * Find a file by walking parent directories.
+ *
+ * @param matcher - A pattern or an array of patterns to match a file name.
+ * @param options - Options for the search.
+ * @returns The first path found that matches or if none could be found.
+ */
+export declare function findPathUpSync(matcher: OverloadParameters<typeof internalFindUp>[0], options: OverloadParameters<typeof internalFindUp>[1]): ReturnType<typeof internalFindUpSync>;
export interface MatchGlobOptions {
matchBase: boolean;
noglobstar: boolean;
packages/cli-kit/dist/public/node/is-global.d.ts@@ -26,6 +26,14 @@ export declare function installGlobalCLIPrompt(): Promise<InstallGlobalCLIPrompt
* Infers the package manager used by the global CLI.
*
* @param argv - The arguments passed to the process.
+ * @param env - The environment variables of the process.
* @returns The package manager used by the global CLI.
*/
-export declare function inferPackageManagerForGlobalCLI(argv?: string[]): PackageManager;
\ No newline at end of file
+export declare function inferPackageManagerForGlobalCLI(argv?: string[], env?: NodeJS.ProcessEnv): PackageManager;
+/**
+ * Returns the project directory for the given path.
+ *
+ * @param directory - The path to the directory to get the project directory for.
+ * @returns The project directory for the given path.
+ */
+export declare function getProjectDir(directory: string): string | undefined;
\ No newline at end of file
packages/cli-kit/dist/public/node/node-package-manager.d.ts@@ -27,7 +27,7 @@ export type DependencyType = 'dev' | 'prod' | 'peer';
/**
* A union that represents the package managers available.
*/
-export declare const packageManager: readonly ["yarn", "npm", "pnpm", "bun", "unknown"];
+export declare const packageManager: readonly ["yarn", "npm", "pnpm", "bun", "homebrew", "unknown"];
export type PackageManager = (typeof packageManager)[number];
/**
* Returns an abort error that's thrown when the package manager can't be determined.
packages/cli-kit/dist/public/node/upgrade.d.ts@@ -4,7 +4,21 @@
*
* @returns A string with the command to run.
*/
-export declare function cliInstallCommand(): string;
+export declare function cliInstallCommand(): string | undefined;
+/**
+ * Runs the CLI upgrade using the appropriate package manager.
+ * Determines the install command and executes it.
+ *
+ * @throws AbortError if the package manager or command cannot be determined.
+ */
+export declare function runCLIUpgrade(): Promise<void>;
+/**
+ * Returns the version to auto-upgrade to, or undefined if auto-upgrade should be skipped.
+ * Checks for a cached newer version and skips for CI, pre-release versions, SHOPIFY_CLI_NO_AUTO_UPGRADE, or major version changes.
+ *
+ * @returns The version string to upgrade to, or undefined if no upgrade should happen.
+ */
+export declare function versionToAutoUpgrade(): string | undefined;
/**
* Generates a message to remind the user to update the CLI.
*
packages/cli-kit/dist/public/node/version.d.ts@@ -1,3 +1,17 @@
+/**
+ * Returns the current CLI version, read from the nearest package.json.
+ * The result is cached after the first call.
+ *
+ * This is a lazy function (rather than a top-level constant) because
+ * depends on npm packages that may not yet be initialized during ESM module evaluation
+ * when circular imports are involved. Deferring the call to runtime avoids that issue.
+ *
+ * In unbundled (dev) mode this finds cli-kit's own package.json.
+ * In bundled (global install) mode this finds the CLI's package.json, which shares the same version.
+ *
+ * @returns The CLI version string.
+ */
+export declare function cliVersion(): string;
/**
* Returns the version of the local dependency of the CLI if it's installed in the provided directory.
*
@@ -18,4 +32,12 @@ export declare function globalCLIVersion(): Promise<string | undefined>;
* @param version - The version to check.
* @returns True if the version is a pre-release version.
*/
-export declare function isPreReleaseVersion(version: string): boolean;
\ No newline at end of file
+export declare function isPreReleaseVersion(version: string): boolean;
+/**
+ * Checks if the version is a major version change.
+ *
+ * @param currentVersion - The current version.
+ * @param newerVersion - The newer version.
+ * @returns True if the version is a major version change.
+ */
+export declare function isMajorVersionChange(currentVersion: string, newerVersion: string): boolean;
\ No newline at end of file
packages/cli-kit/dist/public/node/context/local.d.ts@@ -173,4 +173,11 @@ export declare function getThemeKitAccessDomain(env?: NodeJS.ProcessEnv): string
* @returns The domain to send OTEL metrics to.
*/
export declare function opentelemetryDomain(env?: NodeJS.ProcessEnv): string;
+/**
+ * Returns true if the CLIshould not automatically upgrade.
+ *
+ * @param env - The environment variables from the environment of the current process.
+ * @returns True if the CLI should not automatically upgrade.
+ */
+export declare function noAutoUpgrade(env?: NodeJS.ProcessEnv): boolean;
export type CIMetadata = Metadata;
\ No newline at end of file
packages/cli-kit/dist/public/node/hooks/postrun.d.ts@@ -5,4 +5,10 @@ import { Hook } from '@oclif/core';
* @returns Whether post run hook has completed.
*/
export declare function postRunHookHasCompleted(): boolean;
-export declare const hook: Hook.Postrun;
\ No newline at end of file
+export declare const hook: Hook.Postrun;
+/**
+ * Auto-upgrades the CLI after a command completes, if a newer version is available.
+ *
+ * @returns Resolves when the upgrade attempt (or fallback warning) is complete.
+ */
+export declare function autoUpgradeIfNeeded(): Promise<void>;
\ No newline at end of file
packages/cli-kit/dist/public/node/hooks/prerun.d.ts@@ -11,6 +11,7 @@ export declare function parseCommandContent(cmdInfo: {
pluginAlias?: string;
}): CommandContent;
/**
- * Warns the user if there is a new version of the CLI available
+ * Triggers a background check for a newer CLI version (non-blocking).
+ * The result is cached and consumed by the postrun hook for auto-upgrade.
*/
-export declare function warnOnAvailableUpgrade(): Promise<void>;
\ No newline at end of file
+export declare function checkForNewVersionInBackground(): void;
\ No newline at end of file
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

HackDays project: https://vault.shopify.io/hackdays/153/projects/22255
WHY are these changes introduced?
We want our devs to always use the latest CLI version and avoid fragmentation
WHAT is this pull request doing?
Checks once per day if there is a new CLI version available and automatically upgrades unless:
SHOPIFY_CLI_NO_AUTO_UPGRADE=1TODO:
How to test your changes?
TBD
Measuring impact
How do we know this change was effective? Please choose one:
Checklist