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

Add tapioca/dsl entrypoint for custom DSL compilers #844

Merged
merged 2 commits into from Mar 7, 2022

Conversation

paracycle
Copy link
Member

Motivation

When writing a custom DSL compiler, the client code needs to require a minimal set of files from Tapioca, so that the DSL compiler can be loaded in isolation and tested inside the project. However, we don't have an entrypoint for that minimal require set and clients end up having to do require "tapioca/internal" to achieve this, which is not great.

Implementation

This PR adds a tapioca/dsl entrypoint, which DSL compiler classes can add as a require.

Tests

The test is super custom, since I wanted to test the experience of a client app declaring and loading a custom DSL compiler in isolation from the Tapioca CLI runner. When we load the Tapioca CLI dsl command and, that, in turn, loads custom compilers, everything works regardless of any Tapioca requires, since the CLI already bring everything with it.

The custom test defines a small executable inside the mock project that loads the custom compiler and tries to generate an RBI using it, just as how tests would do it. That allows us to test the loading and operation of a custom DSL compiler in isolation using only the minimal tapioca/dsl require.

@paracycle paracycle added the enhancement New feature or request label Mar 7, 2022
@paracycle paracycle requested a review from a team March 7, 2022 22:42
@paracycle paracycle merged commit 6262f87 into main Mar 7, 2022
@paracycle paracycle deleted the uk-tapioca-dsl-require branch March 7, 2022 23:01
@shopify-shipit shopify-shipit bot temporarily deployed to production May 13, 2022 23:08 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants