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

Introducing Pilet Variations #531

Open
FlorianRappl opened this issue Aug 22, 2022 · 0 comments
Open

Introducing Pilet Variations #531

FlorianRappl opened this issue Aug 22, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request in-review The item is currently being reviewed. pilets Concerns the API of the pilets.
Milestone

Comments

@FlorianRappl
Copy link
Contributor

New Feature Proposal

Description

Right now a pilet is just one library. What if a pilet could actually be multiple libraries? For instance, one library to use for SSR, one library to use for CSR. Or one library for region 1, another library for region 2. If we could build / construct multiple versions and make the feed service aware of it, then doing A/B testing, region-specific rollouts, and more quite easily.

Background

Right now, this is possible, too, but it requires specifically building (or rebuilding) the pilet and publishing either to a different feed or a different tag (or a different pilet name). Not convenient and not transparent.

Discussion

While including this in 0.15.0 would be nice, more likely this feature will come with one of the patches to 0.15 (or a 0.16 / 1.0 later). I am right now not sure how it should be triggered. Most likely, this will be via the pilet.json in a section like variations or output, e.g.,

{
  "variations": {
    "server": {
      "source": "./src/index.server.tsx",
      "env": {
         "ON_SERVER": "true"
       },
       "rules": {}
     }
  }
}

The server part in the example above is a variation name. The assigned object are the options for producing / building this variation. The actual options are all optional. If not given (e.g., if source is dropped) then the values from the default variation are picked. The default variation is still derived from the package.json, but could also be set explicitly, e.g.,

{
  "variations": {
    "default": {
      "source": "./src/index.client.tsx",
    },
    "server": {
      "source": "./src/index.server.tsx",
      "env": {
         "ON_SERVER": "true"
       },
       "rules": {}
     }
  }
}

The advantage of overriding the default variation is that a project could use the package.json for its library part, while the pilet part is all contained in the pilet.json, i.e., via the default key in variations.

@FlorianRappl FlorianRappl added enhancement New feature or request pilets Concerns the API of the pilets. in-review The item is currently being reviewed. labels Aug 22, 2022
@FlorianRappl FlorianRappl modified the milestones: 0.15.4, 0.15.5 Dec 16, 2022
@FlorianRappl FlorianRappl added the in-implementation The item is currently being implemented. label Jan 16, 2023
@FlorianRappl FlorianRappl self-assigned this Jan 16, 2023
@FlorianRappl FlorianRappl removed the in-review The item is currently being reviewed. label Jan 16, 2023
@FlorianRappl FlorianRappl modified the milestones: 0.15.5, 0.15.6, 1.0.0 Jan 23, 2023
@FlorianRappl FlorianRappl added in-review The item is currently being reviewed. and removed in-implementation The item is currently being implemented. labels Jan 28, 2023
@FlorianRappl FlorianRappl modified the milestones: 1.0.0, 2.0.0 Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in-review The item is currently being reviewed. pilets Concerns the API of the pilets.
Projects
None yet
Development

No branches or pull requests

1 participant