Skip to content

Custom-Add-On Protected Files #100

Open
@jherr

Description

@jherr

Which project does this relate to?

Create Tanstack App

Describe the bug

Some files in the applications that are generated are protected "high contention files". Meaning that multiple add-ons will want to alter them. An example of this is src/routes/__root.tsx where providers are often placed. Instead of allowing add-ons to mutate these files directly we instead allow for framework specific integrations. There is documentation about them with each framework.

Authoring an add-on should be as easy as possible, and for the most part it is. The integrations part are the most difficult part of creating an add-on. So we could be more proactive about telling folks to use these integrations when authoring an add-on.

  1. The framework should be able to expose a list of these protected "high contention" files
  2. The file list should have messages attached to each file indicating what integration type should be used to modify the file.
  3. Changes to one the protected files should be ignored and not included in the .add-on/assets directory.

An example message would be:

This add-on template includes modifications to ... These modifications are ignored. You should use the Providers integration instead to make changes to this file. Documentation for that is at (url).

Your Example Website or App

https://github.com/TanStack/create-tsrouter-app

Steps to Reproduce the Bug or Issue

  1. Attempt to do pnpx create-tsrouter-app@latest add-on init when a file like ./src/routes/__root.tsx has been altered.

Expected behavior

It should ignore the alteration and give you a message about how to properly modify that file.

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions