Closed ing-norante closed 1 year ago
I was testing the auto-generation feature for migrations and I found an issue on projects that have a dashed locale (i.e. "en-US", "pt-br", ...)
On a project with a normal locale (it), everything runs smoothly:
datocms migrations:new 'add visibility switch to categories' --autogenerate=add-switch-to-category Writing "migrations/1667488257_addVisibilitySwitchToCategories.ts"... done
On a project with a dashed locale instead, it hangs (in this example the locale is "en-US"):
datocms migrations:new 'add visibility switch to categories' --autogenerate=add-switch-to-category Writing "migrations/1667487675_addVisibilitySwitchToCategories.ts"... ! SyntaxError: ',' expected. (9:318) 7 | 8 | console.log("Create Boolean field \"Show in menu?\" (`show_in_menu`) in model \"Category\" (`category`)") > 9 | newFields["3643874"] = await client.fields.create("461463", { label: "Show in menu?", field_type: "boolean", api_key: "show_in_menu", hint: "Check this if you want this category to appear on the sidebar menu", localized: true, appearance: { addons: [], editor: "boolean", parameters: {} }, default_value: { en-US: true } }); | ^ 10 | 11 | console.log("Update existing fields/fieldsets") 12 |
Perhaps the locale needs to be escaped...?
Cheers!
Should be fixed in v1.0.16 of the CLI! Thanks for reporting @ing-norante ;)
I was testing the auto-generation feature for migrations and I found an issue on projects that have a dashed locale (i.e. "en-US", "pt-br", ...)
On a project with a normal locale (it), everything runs smoothly:
On a project with a dashed locale instead, it hangs (in this example the locale is "en-US"):
Perhaps the locale needs to be escaped...?
Cheers!