-
Notifications
You must be signed in to change notification settings - Fork 630
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
Changes from all commits
c2b1e54
f143c73
d76a6c1
6a361ed
338e79c
3741efe
446d5d5
9aaa54b
2dea8b7
600dbd1
d4fdc25
5fec184
2e791b4
3c5326a
a7fc371
c217710
2c08231
42c6a21
000b9ee
b9ed3f6
185b204
5b8492e
585288a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.DS_Store | ||
node_modules | ||
/.svelte-kit | ||
/package | ||
package |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
static/** | ||
build/** | ||
node_modules/** | ||
package/** | ||
*.js | ||
*.mjs | ||
*.cjs | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
{ | ||
"name": "huggingface-widgets", | ||
"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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"svelte": "./InferenceWidget/InferenceWidget.svelte", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/huggingface/huggingface_hub.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/huggingface/huggingface_hub/issues" | ||
}, | ||
"homepage": "https://github.com/huggingface/huggingface_hub/tree/main/widgets", | ||
"scripts": { | ||
"dev": "svelte-kit dev", | ||
"build": "svelte-kit build", | ||
"package": "svelte-kit package && node postpackage.js", | ||
"preview": "svelte-kit preview", | ||
"publish": "npm run package && npm publish package", | ||
"check": "svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", | ||
"lint": "prettier --check --plugin-search-dir=. .", | ||
|
@@ -15,18 +28,37 @@ | |
"@sveltejs/kit": "next", | ||
"@tailwindcss/forms": "^0.3.3", | ||
"@tailwindcss/line-clamp": "^0.2.1", | ||
"@tsconfig/svelte": "^2.0.1", | ||
"@types/dom-mediacapture-record": "^1.0.7", | ||
"autoprefixer": "^10.2.6", | ||
"postcss": "^8.3.1", | ||
"postcss-load-config": "^3.0.1", | ||
"prettier": "2.3.0", | ||
"prettier-plugin-svelte": "2.3.0", | ||
"svelte": "^3.34.0", | ||
"svelte-check": "^2.0.0", | ||
"svelte-check": "^2.2.3", | ||
"svelte-preprocess": "^4.0.0", | ||
"svelte2tsx": "^0.4.5", | ||
"tailwindcss": "^2.1.4", | ||
"tslib": "^2.0.0", | ||
"typescript": "^4.0.0" | ||
}, | ||
"type": "module" | ||
"keywords": [ | ||
"hugging face", | ||
"machine learning inference", | ||
"svelte" | ||
], | ||
"exports": { | ||
".": "./InferenceWidget/InferenceWidget.svelte", | ||
"./WidgetHeader.svelte": "./InferenceWidget/shared/WidgetHeader/WidgetHeader.svelte", | ||
"./ModelPipelineIcon.svelte": "./ModelPipelineIcon/ModelPipelineIcon.svelte", | ||
"./ModelPipelineTag.svelte": "./ModelPipelineTag/ModelPipelineTag.svelte", | ||
"./inferenceSnippets": "./inferenceSnippets/index.js", | ||
"./inferenceSnippets/inputs": "./inferenceSnippets/inputs.js", | ||
"./interfaces/DefaultWidget": "./interfaces/DefaultWidget.js", | ||
"./interfaces/Language": "./interfaces/Language.js", | ||
"./interfaces/Libraries": "./interfaces/Libraries.js", | ||
"./interfaces/Types": "./interfaces/Types.js" | ||
Comment on lines
+58
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have an There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) |
||
}, | ||
"license": "Apache-2.0" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
const copyRecursiveSync = (src, dest) => { | ||
const exists = fs.existsSync(src); | ||
const stats = exists && fs.statSync(src); | ||
const isDirectory = exists && stats.isDirectory(); | ||
if (isDirectory) { | ||
fs.mkdirSync(dest); | ||
fs.readdirSync(src).forEach(function(childItemName) { | ||
copyRecursiveSync(path.join(src, childItemName), | ||
path.join(dest, childItemName)); | ||
}); | ||
} else { | ||
fs.copyFileSync(src, dest); | ||
} | ||
}; | ||
|
||
const pathtToJson = './package/package.json'; | ||
let pkg = fs.readFileSync(pathtToJson); | ||
pkg = JSON.parse(pkg); | ||
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 commentThe 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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<script context="module"> | ||
import type { Load } from "@sveltejs/kit"; | ||
import type { ModelData } from "$lib/interfaces/Types"; | ||
import type { ModelData } from "../../src/lib/interfaces/Types"; | ||
|
||
import InferenceWidget from "$lib/InferenceWidget/InferenceWidget.svelte"; | ||
import InferenceWidget from "../../src/lib/InferenceWidget/InferenceWidget.svelte"; | ||
Comment on lines
+3
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not |
||
|
||
/** | ||
* This page is capable of loading any model | ||
|
@@ -31,7 +31,7 @@ | |
</script> | ||
|
||
<script> | ||
import ModeSwitcher from "$lib/_demo/ModeSwitcher.svelte"; | ||
import ModeSwitcher from "../lib/_demo/ModeSwitcher.svelte"; | ||
|
||
export let model: ModelData | undefined; | ||
export let message: string | undefined; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "@tsconfig/svelte/tsconfig.json", | ||
"include": ["src/lib/**/*"], | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"alwaysStrict": true, | ||
"strictFunctionTypes": true, | ||
"strictNullChecks": true, | ||
"strictBindCallApply": true, | ||
"lib": ["es6", "es2016", "es2017", "es2018", "esnext"] | ||
Comment on lines
+7
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the |
||
} | ||
} |
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!