-
Notifications
You must be signed in to change notification settings - Fork 62
Add utilities for schema management and dependency updates #611
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
Conversation
- Add check-api-version.js to automatically update API versions based on current date - Add generate-app.js to manage shopify.app.toml configuration - Add update-schemas.js to automate schema updates using Shopify CLI - Update expand-liquid.js to handle extension handles more robustly - Update README.md with comprehensive instructions - Add npm scripts and required dependencies This facilitates automatic updating of schemas and API versions across all function examples, making maintenance easier.
Add instructions for using: - check-js-dependencies to update JavaScript/TypeScript dependencies - check-rust-dependencies to update Rust crate dependencies
|
||
const updateDependencyVersion = async (dependencies) => { | ||
for (const [name, currentVersion] of Object.entries(dependencies)) { | ||
const latestVersion = await getLatestVersion(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we ensure that it's safe to update to the latest version? For example, if there's a major version bump. Are we relying on tests to tell us that something is wrong?
}); | ||
} | ||
|
||
async function checkAndUpdateDependencies(filePath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this, can't we transform the Liquid files to TOML files, run cargo update
, and then map back to Liquid (if applicable, like what you did in this file)?
Similarly, could we do that for JS too?
- Added @shopify/toml-patch package as a dependency - Replaced brittle manual TOML parsing in check-rust-dependencies.js - Updated check-api-version.js to use the more robust TOML patch library - Added proper handling of Liquid templates during TOML manipulation - Improved error handling and reporting
- Replace manual string manipulation with @shopify/toml-patch for TOML operations - Simplify directory listing handling with automatic array formatting - Remove unneeded formatDirectoriesForToml helper function
- Add validation to ensure shopify.app.toml exists before updating - Error with instructions to run 'shopify app config link' if file is missing
- Replace manual regex-based TOML parsing with @iarna/toml library - Simplify extension directory extraction logic - Add warning for directories specified in config that don't exist
Schema and API Version Automation Utilities
What's Changed
This PR adds automation utilities that make it easier to maintain function examples:
check-api-version.js
to automatically update API versions across all extensions based on the current dategenerate-app.js
andupdate-schemas.js
to automate schema updates using Shopify CLIcheck-js-dependencies.js
for updating npm packages in package.json.liquid filescheck-rust-dependencies.js
for updating crates in Cargo.toml and Cargo.toml.liquid filesWhy
These tools help address several maintenance challenges:
How to Test
yarn generate-app
to create the shopify.app.toml fileshopify app config link
to link the app to a Shopify dev storeyarn update-api-version
to update API versions and schemasyarn check-js-dependencies
oryarn check-rust-dependencies
to update dependenciesAdditional Notes
The key workflows are documented in the README under the following sections: