You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently when we make change in Directus and run pull command, all of the fields in files sometimes changes the ordering making the code review is difficult to follow (example image below).
Describe the solution you'd like
In the past, we used directus-utilities to import the changes, it has the same issues but we make custom script to make sure sort alphabetically. I think we can do something similar.
Either sort fields alphabetically or default fields but make sure it's consistent.
// Example script we used in directus-utilities of Directus 10const{ Directus }=require('@directus/sdk');// Directus SDK v10constsortJson=require('sort-json');const{
exportDefaultPreset,
exportPublicPermissions,
exportPermissionsByRolename
}=require('directus-utilities');const{ presets, publicPermission, roles }=require('./config');construn=async()=>{constdirectus=newDirectus('http://localhost:8055',{auth: {staticToken: 'MY_TOKEN'}});awaitPromise.all(presets.map(x=>exportDefaultPreset(directus,x.collection,x.target)));awaitPromise.all(roles.map(x=>exportPermissionsByRolename(directus,x.roleName,x.target)));awaitexportPublicPermissions(directus,publicPermission);// Sort fields in jsonsortJson.overwrite([
...presets.map(x=>x.target),
...roles.map(x=>x.target),publicPermission]);};run().then(()=>{process.exit();});
Describe alternatives you've considered
N/A
Additional context
The text was updated successfully, but these errors were encountered:
Dominic-Preap
changed the title
Sort fields inside JSON files of for easier code review
Sort fields inside JSON files for easier code review
Feb 5, 2025
Is your feature request related to a problem? Please describe.
Currently when we make change in Directus and run pull command, all of the fields in files sometimes changes the ordering making the code review is difficult to follow (example image below).
Describe the solution you'd like
In the past, we used
directus-utilities
to import the changes, it has the same issues but we make custom script to make sure sort alphabetically. I think we can do something similar.Either sort fields alphabetically or default fields but make sure it's consistent.
Describe alternatives you've considered
N/A
Additional context
The text was updated successfully, but these errors were encountered: