Navigation Menu

Skip to content
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

Feat/forestry migration updates #3510

Merged
merged 21 commits into from Jan 19, 2023
Merged

Conversation

logan-anderson
Copy link
Contributor

@logan-anderson logan-anderson commented Jan 10, 2023

This PR updates the forestry migration tool in a couple of ways.

  • It now migrates templates correctly
  • It can migrate when no templates are provided
  • It add a root level _tempalte key to documents
  • updates Error messages to have red text and warning message to have yellow
  • Adds a spinner

Steps to test.

Run

yarn add --dev @tinacms/cli@forestry-migration-updates

and then run

yarn tinacms init

I am going to work on some docs that we can link to for certain errors that occur.

@changeset-bot
Copy link

changeset-bot bot commented Jan 10, 2023

🦋 Changeset detected

Latest commit: d9d27a4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@tinacms/cli Patch
starter-empty Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 10, 2023

Warnings
⚠️

packages/@tinacms/graphql was modified but its README.md was not updated. Please check if any changes should be reflected in the documentation.

⚠️

packages/@tinacms/cli was modified but its README.md was not updated. Please check if any changes should be reflected in the documentation.

Modified Packages

The following packages were modified by this pull request:

  • @tinacms/cli
  • @tinacms/graphql

Generated by 🚫 dangerJS against d9d27a4

@logan-anderson logan-anderson marked this pull request as ready for review January 13, 2023 15:37
@logan-anderson logan-anderson requested a review from a team as a code owner January 13, 2023 15:37
public addErrorName(error: NameError) {
this.allErrorNames.push(error)
}
public printErrorNames() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I get what's happening in this function. It looks like we'd log out several different error types when called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only for "name errors".

For example if you had a template name "my-template" or a field name "my-field".


const errorSingletonInstance = ErrorSingleton.getInstance()

export const stringifyName = (name: string, template: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we changing the name of their fields in their content pages along with this? I have a bit of concern it might be some overhead for the user to update their site to make sure it doesn't break the build (as opposed to, if we were to just support characters like dashes in our field names)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamespohalloran No we are not updating the users content. This would require recursively traversing all of their files and the new config at the same time and keeping track of where you are in the tree, the old name and the new name. I could see this being a rabbit hole and costing 1-2 weeks of work to get it right. I left it out of this scope of work on purpose for this reason.

The user will also have to update there code as well (we definitely cant migrate their code).

Copy link
Contributor

@jamespohalloran jamespohalloran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one small comment on the naming of a function.

Overall this looks great. One thing though, I think we might be leaving the user in a bit of a confusing state by renaming the fields. Out of the box, the fields will look like they are working, however when editing they'll just update a new field that isn't used by their site.
We can address this in a next step, but I think supporting dashes in field names may be worth the investment.

@logan-anderson logan-anderson merged commit f105224 into main Jan 19, 2023
@logan-anderson logan-anderson deleted the feat/forestry-migration-updates branch January 19, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants