Comments (8)
Nice! thanks for asking me to join the conversation :)
I must admit I love the first option. It reduces the burden on the end user side, eases adoption, at the cost on some time investment in tooling and "magic".
Maybe the workflow could be even more simplified:
For the idyll module developer:
- may use a prefix (eg. idyll-component-*) as a convention, because it's nice for branding
- should use a keyword (eg. ”idyll-component”) as a convention, to be listed in search results
For the end user:
- list idyll modules using some
idyll list
command (see https://github.com/nodesource/npmsearch#api + https://npmsearch.com/?q=keywords:idyll ) - install the component using
npm i some-module-name
- use
[SomeModuleName /]
in the .idl
Observations:
- in this scenario the Idyll component name (or just the default Idyll component name) would be inferred from the Node module name using the same convention as in React for dom props (ie. package name in hyphen-case -> idyll component name in UpperCamelCase).
- Developers would have a strong incentive to use the correct idyll keyword in order to be found in search results
- idyll would have to try to require the module to check if it's ok (or do whatever operation Idyll needs)
- Idyll could be smart and try to automatically wrap (convert) “non-native idyll” React modules when the user try to use them
- bonus:
[MonoRepo:Component1 /]
,[MonoRepo:Component2 /]
etc? for those who want to store multiple components in the same master package/repo. It could work of they follow some convention (eg. name sub folders the name of their Component, use anindex.js
..) (just a thought!)
from idyll.
Thanks for the comments, these are super helpful for thinking through everything.
@jbilcke In the case that you npm install idyll-component-some-thing
do you imagine the prefix should be dropped so that it is invoked with [SomeThing /]
?
Idyll could be smart and try to automatically wrap (convert) “non-native idyll” React modules when the user try to use them
I think this would be pretty hard to do without an explicit listing in package.json. The reason being that its hard to tell what module maps to a component vs. any other kind of library. That would lead to anything in node_modules
being a candidate component which I think we should avoid.
The thing that I'm concerned about in addition to making it as friendly as possible is trying to make sure that it doesn't do anything surprising, and I worry with the first option we could be getting too close to that, especially with all the name mapping.
At the moment I am leaning towards (2) for the following reasons:
- Even though its potentially more work for the end user I think its conceptually simpler
- we can add an
idyll install
shortcut to minimize how much extra work it really is. - I think we'd have to add the package.json field to support arbitrary react components anyways, so even if we wanted to add some automated resolution in the future this wouldn't be wasted work.
That being said, feel free to push back, because I agree that it would be really slick to have everything just resolve automatically.
Also, @jbilcke see #30 re: your last point. I agree that will probably prove to be very useful
from idyll.
I think that would be a great compromise!
Combining the safety (and accuracy - my idea would also have caused naming collision issues) of the package.json
with the ease of use of a small command (idyll install
) to help add components in it.. that would be the best indeed :)
(btw: I didn't see #30 at the time, but the dot syntax is cleaner 👍 )
from idyll.
from idyll.
One advantage of the second option is that you can install and use any react components (or similar), they don't have to be explicit idyll components.
It is more work for the end user, but we could make it easier by providing some shortcut for it
idyll install componentA:idyll-component-a
and have that automatically updated package.json
from idyll.
Ooh. Yeah. I like parts of both. The two that I like are scanning for explicit triggers in the package.json and explicitly defining things in your package.json. The reason I like those is that it's less magic than relying on npm module names, which it seems a bit unfriendly to constrain with no escape hatch. If I had to take only one, I guess I think listing the component paths in your package.json is more flexible as you pointed out. The solution I'd use is both since they're not mutually exclusive. But I think a far better solution is to actually pick one. 😬
from idyll.
I'm not familiar with the compiler (yet) so forgive me if this is ignorant of real world constraints. I think it would be wise to optimize for the end user's experience since, almost by definition, they will outnumber authors. To that end, could Idyll look in node_modules
by default if listed component is not found in the components directory?
End user
npm install secret-idyll-comp
[SecretIdyllComp /]
Idyll
- Sees
[SecretIdyllComp /]
- Does not find
components/secret-idyll-comp.js
- Looks for
node_modules/secret-idyll-comp
I think the component naming and keywords make sense and should be encouraged, but avoiding them as a hard requirement would be nice.
from idyll.
closed in #32
from idyll.
Related Issues (20)
- Publish fails when project name has special characters HOT 5
- Graphic Annoations HOT 4
- Idyll crashes with JavaScript heap out of memory HOT 2
- Update react-table dependency in idyll-components to latest HOT 2
- Upgrade to React 17 HOT 1
- Incorrect link to editor in getting started docs HOT 1
- Insert em-dashes when there are three hyphens HOT 2
- Idyll does not build (Node 16 issue?) HOT 4
- Upgrade D3 dependency HOT 4
- Docs website error with JS enabled HOT 2
- Automatic reload running idyll in WSL: it seems not work HOT 4
- SSR option doesn't work if specified in `package.json`
- Babel/d3-array incompatibility issue in new Windows installs HOT 5
- Add support for Typescript based React components HOT 4
- Update the component dependencies and re test? HOT 2
- Error while building post in multipage setup
- Support for google analytics 4 HOT 3
- Idyll runs component code in Node, causing crashes HOT 1
- Scroller not working
- Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: on a fresh Windows 10 install HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idyll.