-
Notifications
You must be signed in to change notification settings - Fork 576
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
Packaging & publishing to npm #202
Conversation
Did you close this accidentally @mishig25 or was it intended? |
@Pierrci Yeah it was intended. I think changes I've made to |
@Pierrci Please let me know if you think this approach is acceptable. Why we can't use a package generated by
|
nit, but the npm package name (if we go that way) would be better named |
I finally had a look at it, and IMO it looks very promising @mishig25 :)
I bumped the version of
I agree the approach can be considered as "hacky", but I'm not sure why adding more components would make it worse than it is now? More generally, I think we could refactor a bit the js structure in this repo w/ a more generic This way we can import all the js code we need from |
I made an ambiguous statement above. I meant: we should switch to rollup if/when we add third-party svelte component libraries.
|
No strong opinion (I think git-submodules are fine for non-Svelte files), I'll leave that up to you guys. |
Yes, we can leave the hub doc outside of the package 😄. But moving @LysandreJik, what do you think would be the best way to regroup all the js code ( |
What about keeping |
I'd rather we don't move it inside Moving widgets under |
sounds great to me. In that case, @Pierrci, could we just add |
I'll reiterate that I'd prefer to nest widgets under |
got it 👍 |
What benefits do you see @julien-c in keeping Moving (w/ the current setup - same w/ simply moving |
Ok ok, I haven't tested the whole tooling so let's go with what @Pierrci preconizes. 🙏 |
@Pierrci in terms for publishing the widgets, what should be the next step:
|
@mishig25 option A, but following #227 we can simplify what's done in this PR and remove a few steps from the Ideally we would end up exposing |
"strictFunctionTypes": true, | ||
"strictNullChecks": true, | ||
"strictBindCallApply": true, | ||
"lib": ["es6", "es2016", "es2017", "es2018", "esnext"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the lib
entry can be removed here no? (see https://www.typescriptlang.org/tsconfig#target: "Changing target
also changes the default value of lib
.")
@Pierrci @beurkinger
And it gets consumed as:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're almost there! :)
import type { ModelData } from "../../src/lib/interfaces/Types"; | ||
|
||
import InferenceWidget from "$lib/InferenceWidget/InferenceWidget.svelte"; | ||
import InferenceWidget from "../../src/lib/InferenceWidget/InferenceWidget.svelte"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not ../lib
directly here?
delete pkg.type; | ||
fs.writeFileSync(pathtToJson, JSON.stringify(pkg)); | ||
|
||
copyRecursiveSync("../docs", "./package/docs"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in https://github.com/huggingface/moon-landing/pull/1172, let's keep the docs separate, at least for now.
"./interfaces/DefaultWidget": "./interfaces/DefaultWidget.js", | ||
"./interfaces/Language": "./interfaces/Language.js", | ||
"./interfaces/Libraries": "./interfaces/Libraries.js", | ||
"./interfaces/Types": "./interfaces/Types.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have an interfaces/index.js
that re-exports those rather, so that we can do import { DefaultWidget, Language, ... } from "huggingface-widgets/interfaces"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to do so? because, the use case has always been:
import { x, y, z } from Interfaces or Language
,
not import Interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right actually, let's keep it that way! I think I'm feeling the effects of the jetlag x)
"version": "0.0.1", | ||
"version": "0.15.0", | ||
"type": "module", | ||
"main": "./InferenceWidget/InferenceWidget.svelte", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main
is supposed to be something in plain js I think (that's why you can add a specific svelte
entry for the "non-compiled" version), but for now, we can leave it as is - and add a "compiled" version later if there is a demand for it.
@@ -1,10 +1,23 @@ | |||
{ | |||
"name": "huggingface-widgets", | |||
"version": "0.0.1", | |||
"version": "0.15.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about bumping the version to 1.0.0
when we release for good? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea!
Closing it for now |
Update: 2021-09-09
@Pierrci @beurkinger
Since internal was merged, I've advanced this PR.
To remind:
$lib
usage since Resolve aliases while runningsvelte-kit package
sveltejs/kit#1950 is still open. (You mentioned about it here)And it gets consumed as: