-
Notifications
You must be signed in to change notification settings - Fork 63
Add API version update utilities #613
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
base: main
Are you sure you want to change the base?
Conversation
- Add @shopify/toml-patch for TOML manipulation - Create utilities for API version management and schema updates - Add check-api-version.js to auto-update extension API versions - Add configure-extension-directories.js to manage app config - Add update-schemas.js script for schema updates with CLI - Update README with simplified instructions - Add yarn commands for API version maintenance - Add .gitignore entry for shopify.app.toml
- Rename script file to better reflect its actual function - Update package.json script reference
const date = dayjs(); | ||
const year = date.year(); | ||
const month = date.month(); |
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.
We can use JS dates directly instead of bringing in a new dependency.
const date = dayjs(); | |
const year = date.year(); | |
const month = date.month(); | |
const date = new Date(); | |
const year = date.getFullYear(); | |
const month = date.getMonth(); |
import { updateTomlValues } from '@shopify/toml-patch'; | ||
|
||
const ROOT_DIR = '.'; | ||
const FILE_PATTERN = '**/shopify.extension.toml.liquid'; |
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.
Do we only want to update the versions for Liquid files? This would exclude the sample apps.
console.log(`Updated API version in ${filePath} to ${latestVersion}`); | ||
|
||
} catch (error) { | ||
console.error(`Error updating API version in ${filePath}:`, error.message); |
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.
It seems like some functions run into this error because the liquid placeholder logic doesn't create a valid TOML file. For example order-routing/rust/location-rules/default/shopify.extension.toml.liquid:
{% if uid %}uid = "{{ uid }}"{% endif %}
Maybe we need a different approach that doesn't really expect a valid TOML file. Perhaps a simple find/replace would be sufficient here (assuming nobody does any Liquid shenanigans with the API version).
This PR adds utilities for managing API versions and function schemas:
Changes
Benefits