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

defnc- to create private component definitions #82

Closed
lilactown opened this issue Apr 27, 2021 · 3 comments
Closed

defnc- to create private component definitions #82

lilactown opened this issue Apr 27, 2021 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@lilactown
Copy link
Owner

No description provided.

@lilactown lilactown added enhancement New feature or request good first issue Good for newcomers labels Apr 27, 2021
@emmanueljohn1
Copy link

@lilactown I'm thinking of taking this on. I'm new to the code base. Do you have any tips on how I can tackle this?

@lilactown
Copy link
Owner Author

@emmanueljohn1 code-wise, the idea would be to introduce a new macro defnc- which adds :private true to the metadata of the display-name symbol and passes it to defnc.

I should take the time to create contributing docs, but as of now the best way to develop this would be to:

  1. start the dev server via shadow-cljs watch dev
  2. Navigate to http://localhost:8700
  3. Write new macro in helix.core
  4. Test by using defnc- in a new namespace and try and refer to it workshop.core. you should see a compiler warning saying that it's not public

I think you could also add a test for this in helix.core-test:

(defnc- private-comp
  []
  "can't see me outside of this namespace!")

(t/deftest private-component-definition
  (let [metadata (meta #'private-comp)]
    (t/is (:private metadata))))

Not 💯 on that but that's how I would try and tackle it first!

@lilactown
Copy link
Owner Author

Tests can be run via shadow-cljs watch test and navigating to http://localhost:8021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants