I took the Svelte tutorial and rewrote the keypad in the component bindings
section with a state machine. That worked lovely.
Now I want to extract the Machine.svelte
file into a npm
package and I am not sure how to do that. I could not find any documentation about publishing. For what I saw from svelte-virtual-list, I probably have to configure either the main
or svelte
field of my package.json
:
{
"name": "@sveltejs/svelte-virtual-list",
"version": "3.0.0",
"description": "A <VirtualList> component for Svelte apps",
"main": "VirtualList.svelte",
"svelte": "VirtualList.svelte",
"scripts": {
"build": "rollup -c",
"dev": "rollup -cw",
"prepublishOnly": "npm test",
"test": "node test/runner.js",
"test:browser": "npm run build && serve test/public",
"pretest": "npm run build",
"lint": "eslint src/VirtualList.svelte"
},
"devDependencies": {
"eslint": "^5.12.1",
"eslint-plugin-svelte3": "git+https://github.com/sveltejs/eslint-plugin-svelte3.git",
"port-authority": "^1.0.5",
"puppeteer": "^1.9.0",
"rollup": "^1.1.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-svelte": "^5.0.1",
"sirv": "^0.2.2",
"svelte": "^3.0.0-beta.2",
"tap-diff": "^0.1.1",
"tap-dot": "^2.0.0",
"tape-modern": "^1.1.1"
},
"repository": "https://github.com/sveltejs/svelte-virtual-list",
"author": "Rich Harris",
"license": "LIL",
"keywords": [
"svelte"
],
"files": [
"src",
"index.mjs",
"index.js"
]
}
Is that a correct assumption? Additionally I am perplexed by the fact that in the package.json.files
the VirtualList.svelte
is not present? How would you go about publishing a svelte component??
EDIT: final gist correctly importing the Machine
Svelte component