Add utilities for schema management and dependency updates#611
Closed
davejcameron wants to merge 6 commits intomainfrom
Closed
Add utilities for schema management and dependency updates#611davejcameron wants to merge 6 commits intomainfrom
davejcameron wants to merge 6 commits intomainfrom
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); |
Contributor
There was a problem hiding this comment.
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) { |
Contributor
There was a problem hiding this comment.
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
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.
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.jsto automatically update API versions across all extensions based on the current dategenerate-app.jsandupdate-schemas.jsto automate schema updates using Shopify CLIcheck-js-dependencies.jsfor updating npm packages in package.json.liquid filescheck-rust-dependencies.jsfor updating crates in Cargo.toml and Cargo.toml.liquid filesWhy
These tools help address several maintenance challenges:
How to Test
yarn generate-appto create the shopify.app.toml fileshopify app config linkto link the app to a Shopify dev storeyarn update-api-versionto update API versions and schemasyarn check-js-dependenciesoryarn check-rust-dependenciesto update dependenciesAdditional Notes
The key workflows are documented in the README under the following sections: