Skip to content
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

Store module schemas alongside app #5606

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shauns
Copy link
Contributor

@shauns shauns commented Apr 4, 2025

WHAT is this pull request doing?

Adds a new refreshSchemaBank function that stores JSON schemas from extension specifications in the .shopify/schemas directory. This enables better IDE integration for extension configuration validation.

How to test your changes?

Run this CLI against any app, and see that the .shopify/schemas folder is updated.

Copy link
Contributor Author

shauns commented Apr 4, 2025

Copy link
Contributor

github-actions bot commented Apr 4, 2025

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

Copy link
Contributor

github-actions bot commented Apr 4, 2025

Differences in type declarations

We 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:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/fs.d.ts
@@ -103,13 +103,13 @@ export declare function writeFile(path: string, data: string | Buffer, options?:
  */
 export declare function writeFileSync(path: string, data: string): void;
 /**
- * Creates a directory at the given path.
+ * Creates a directory at the given path. Directories are created recursively if needed.
  *
  * @param path - Path to the directory to be created.
  */
 export declare function mkdir(path: string): Promise<void>;
 /**
- * Synchronously creates a directory at the given path.
+ * Synchronously creates a directory at the given path. Directories are created recursively if needed.
  *
  * @param path - Path to the directory to be created.
  */
@@ -263,6 +263,13 @@ interface GenerateRandomDirectoryOptions {
  * @returns It returns the name of the directory.
  */
 export declare function generateRandomNameForSubdirectory(options: GenerateRandomDirectoryOptions): Promise<string>;
+/**
+ * Read the contents of a directory.
+ *
+ * @param path - Path to the directory.
+ * @returns A promise that resolves to an array of the names of the files in the directory.
+ */
+export declare function readdir(path: string): Promise<string[]>;
 /**
  * Traverse the file system and return pathnames that match the given pattern.
  *

Copy link
Contributor

github-actions bot commented Apr 4, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
76.6% (+0.03% 🔼)
9418/12295
🟡 Branches
71.76% (+0.05% 🔼)
4615/6431
🟡 Functions
76.34% (+0.01% 🔼)
2446/3204
🟡 Lines
77.13% (+0.03% 🔼)
8905/11546
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / fs.ts
68.48% (-1.52% 🔻)
93.75%
66.67% (-1.52% 🔻)
67.78% (-1.54% 🔻)

Test suite run success

2175 tests passing in 954 suites.

Report generated by 🧪jest coverage report action from 66d18c8

* @param specifications - The list of extension specifications
* @param directory - The app directory where .shopify folder will be created
*/
export async function refreshSchemaBank(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you measure how long it takes for this to run? Just to be sure we are not adding a lot of delay to every command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing between 0.3 and 2ms. I think an end state for this is to pair it with specification caching in some way. Then the overhead is less often too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants