-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New app events watcher #4103
base: main
Are you sure you want to change the base?
New app events watcher #4103
Conversation
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success1742 tests passing in 798 suites. Report generated by 🧪jest coverage report action from 5a19e64 |
/snapit |
🫰✨ Thanks @isaacroldan! Your snapshot has been published to npm. Test the snapshot by installing the package globally: pnpm i -g @shopify/[email protected] |
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 declarationspackages/cli-kit/dist/public/node/promises.d.ts/**
* Flushes all pending promises.
*
* @returns A promise that resolves when all pending promises are resolved.
*/
export declare function flushPromises(): Promise<void>;
Existing type declarationspackages/cli-kit/dist/public/node/path.d.ts /// <reference types="node" resolution-mode="require"/>
import type { URL } from 'url';
/**
* Joins a list of paths together.
*
* @param paths - Paths to join.
* @returns Joined path.
*/
export declare function joinPath(...paths: string[]): string;
/**
* Normalizes a path.
*
* @param path - Path to normalize.
* @returns Normalized path.
*/
export declare function normalizePath(path: string): string;
/**
* Resolves a list of paths together.
*
* @param paths - Paths to resolve.
* @returns Resolved path.
*/
export declare function resolvePath(...paths: string[]): string;
/**
* Returns the relative path from one path to another.
*
* @param from - Path to resolve from.
* @param to - Path to resolve to.
* @returns Relative path.
*/
export declare function relativePath(from: string, to: string): string;
/**
* Returns whether the path is absolute.
*
* @param path - Path to check.
* @returns Whether the path is absolute.
*/
export declare function isAbsolutePath(path: string): boolean;
/**
* Returns the directory name of a path.
*
* @param path - Path to get the directory name of.
* @returns Directory name.
*/
export declare function dirname(path: string): string;
/**
* Returns the base name of a path.
*
* @param path - Path to get the base name of.
* @param ext - Optional extension to remove from the result.
* @returns Base name.
*/
export declare function basename(path: string, ext?: string): string;
/**
* Returns the extension of the path.
*
* @param path - Path to get the extension of.
* @returns Extension.
*/
export declare function extname(path: string): string;
/**
* Given an absolute filesystem path, it makes it relative to
* the current working directory. This is useful when logging paths
* to allow the users to click on the file and let the OS open it
* in the editor of choice.
*
* @param path - Path to relativize.
* @param dir - Current working directory.
* @returns Relativized path.
*/
export declare function relativizePath(path: string, dir?: string): string;
/**
+ * Given 2 paths, it returns whether the second path is a subpath of the first path.
+ *
+ * @param mainPath - The main path.
+ * @param subpath - The subpath.
+ * @returns Whether the subpath is a subpath of the main path.
+ */
+export declare function isSubpath(mainPath: string, subpath: string): boolean;
+/**
* Given a module's import.meta.url it returns the directory containing the module.
*
* @param moduleURL - The value of import.meta.url in the context of the caller module.
* @returns The path to the directory containing the caller module.
*/
export declare function moduleDirectory(moduleURL: string | URL): string;
/**
* When running a script using `npm run`, something interesting happens. If the current
* folder does not have a `package.json` or a `node_modules` folder, npm will traverse
* the directory tree upwards until it finds one. Then it will run the script and set
* `process.cwd()` to that folder, while the actual path is stored in the INIT_CWD
* environment variable (see here: https://docs.npmjs.com/cli/v9/commands/npm-run-script#description).
*
* @returns The path to the current working directory.
*/
export declare function cwd(): string;
/**
* Tries to get the value of the `--path` argument, if provided.
*
* @param argv - The arguments to search for the `--path` argument.
* @returns The value of the `--path` argument, if provided.
*/
export declare function sniffForPath(argv?: string[]): string | undefined;
/**
* Returns whether the `--json` flag is present in the arguments.
*
* @param argv - The arguments to search for the `--json` flag.
* @returns Whether the `--json` flag is present in the arguments.
*/
export declare function sniffForJson(argv?: string[]): boolean;
|
WHY are these changes introduced?
Introducing a new App watcher that handles all possible filesystem events for a given app.
WHAT is this pull request doing?
2 Main files to review here:
file-watcher.ts
is the actual filesystem watcher, receives events from chokidar and transforms them.app-event-watcher.ts
receives the events fromfile-watcher
and interprets them in the app context, reloading the app if necessary. It then emits a more high level event with the changes to the app.Also added:
demo watcher
command to test this featuresHow to test your changes?
The best way is to pull this branch and run
pnpm shopify demo watcher --path <path_to_an_app>
And then try all changes you can think of!
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist
dev
ordeploy
have been reflected in the internal flowchart.