0.0.2 • Published 1 year ago

u-library v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Psst — looking for an app template? Go here --> sveltejs/template


svelt-component-library-template

A base for building shareable Svelte component library. Clone it with degit:

npx degit nirmaoz/svelte-component-library-template my-new-component
cd my-new-component
npm install # or yarn

Your component's source code lives in src/Component.svelte.

You can create a package that exports multiple components by adding them to the src directory and editing src/index.js to reexport them as named exports.

This template includes:

  • Svelte Component
  • Testing using svelte-testing-library + Jest
  • Storybook
  • Rollup, configured to build .js (umd), .min.js (iife), .mjs (es)

Setting up

  • Run npm init (or yarn init)
  • Replace this README with your own

Consuming components

Your package.json has a "svelte" field pointing to src/index.js, which allows Svelte apps to import the source code directly, if they are using a bundler plugin like rollup-plugin-svelte or svelte-loader (where resolve.mainFields in your webpack config includes "svelte"). This is recommended.

For everyone else, npm run build will bundle your component's source code into a plain JavaScript module (dist/index.mjs) and a UMD script (dist/index.js). This will happen automatically when you publish your component to npm, courtesy of the prepublishOnly hook in package.json.

Based on sveltejs/component-template

I couldn't find an opinionated components library template to my liking, so I used sveltejs/component-template as base. And then I added minified build configuration using terser plugin + tests + storybook.

Testing

Comes with tests out of the box using svelte-testing-library + Jest.

To Run tests:

npm test # or yarn

Storybook

To serve development build:

npm run storybook

To build static storybook site (default output folder is /docs for easly sharing on github pages):

npm run build-storybook
ababacceptsacornacorn-globalsacorn-walkaddressaggregate-errorairbnb-js-shimsajvajv-errorsajv-keywordsansi-alignansi-colorsansi-escapesansi-html-communityansi-regexansi-stylesansi-to-htmlanymatchapp-root-diraprobaare-we-there-yetargparsearia-queryarr-diffarr-flattenarr-unionarray-equalarray-flattenarray-includesarray-unionarray-uniqarray-uniquearray.prototype.flatarray.prototype.flatmaparray.prototype.maparrifyasn1asn1.jsassertassert-plusassign-symbolsastral-regexasync-eachasynckitatobautoprefixeraws-sign2aws4axiosbabel-code-framebabel-helper-evaluate-pathbabel-helper-flip-expressionsbabel-helper-is-nodes-equivbabel-helper-is-void-0babel-helper-mark-eval-scopesbabel-helper-remove-or-voidbabel-helper-to-multiple-sequence-expressionsbabel-plugin-add-react-displaynamebabel-plugin-dynamic-import-nodebabel-plugin-emotionbabel-plugin-istanbulbabel-plugin-jest-hoistbabel-plugin-macrosbabel-plugin-minify-builtinsbabel-plugin-minify-constant-foldingbabel-plugin-minify-dead-code-eliminationbabel-plugin-minify-flip-comparisonsbabel-plugin-minify-guarded-expressionsbabel-plugin-minify-infinitybabel-plugin-minify-mangle-namesbabel-plugin-minify-numeric-literalsbabel-plugin-minify-replacebabel-plugin-minify-simplifybabel-plugin-minify-type-constructorsbabel-plugin-syntax-jsxbabel-plugin-transform-inline-consecutive-addsbabel-plugin-transform-member-expression-literalsbabel-plugin-transform-merge-sibling-variablesbabel-plugin-transform-minify-booleansbabel-plugin-transform-property-literalsbabel-plugin-transform-regexp-constructorsbabel-plugin-transform-remove-consolebabel-plugin-transform-remove-debuggerbabel-plugin-transform-remove-undefinedbabel-plugin-transform-simplify-comparison-operatorsbabel-plugin-transform-undefined-to-voidbabel-preset-current-node-syntaxbabel-preset-jestbabel-preset-minifybalanced-matchbasebase64-jsbatch-processorbcrypt-pbkdfbig.jsbinary-extensionsbluebirdbn.jsbody-parserboolbaseboxenbrace-expansionbracesbrorandbrowser-process-hrtimebrowser-resolvebrowserify-aesbrowserify-cipherbrowserify-desbrowserify-rsabrowserify-signbrowserify-zlibbrowserslistbserbufferbuffer-frombuffer-xorbuiltin-modulesbuiltin-status-codesbytescacachecache-basecall-bindcall-me-maybecaller-callsitecaller-pathcallsitescamel-casecamelcasecamelcase-keyscan-use-domcaniuse-litecapture-exitcase-sensitive-paths-webpack-plugincaselesschalkcharacter-entitiescharacter-entities-legacycharacter-reference-invalidchardetchokidarchownrchrome-trace-eventci-infocipher-baseclass-utilsclean-cssclean-stackcli-boxescli-cursorcli-table3cli-widthclipboardcliuiclsxcocode-point-atcollect-v8-coveragecollection-visitcolor-convertcolor-namecolorscombined-streamcomma-separated-tokenscommandercommondircomponent-emitterconcat-mapconcat-streamconsole-browserifyconsole-control-stringsconstants-browserifycontent-dispositioncontent-typeconvert-source-mapcookiecookie-signaturecopy-concurrentlycopy-descriptorcopy-to-clipboardcore-jscore-js-compatcore-js-purecore-util-iscorejs-upgrade-webpack-plugincosmiconfigcreate-ecdhcreate-hashcreate-hmaccreate-react-contextcross-spawncrypto-browserifycsscss-loadercss-selectcss-whatcss.escapecssesccssomcssstylecsstypecyclistdashdashdata-urlsdebugdecamelizedecamelize-keysdecode-uri-componentdeep-equaldeep-isdeep-object-diffdeepmergedefine-propertiesdefine-propertydeldelayed-streamdelegatedelegatesdepddes.jsdestroydetect-newlinedetect-nodedetect-portdetect-port-altdiff-sequencesdiffie-hellmandir-globdom-accessibility-apidom-converterdom-serializerdom-walkdomain-browserdomelementtypedomexceptiondomhandlerdomutilsdot-casedotenvdotenv-defaultsdotenv-expanddotenv-webpackduplexerduplexifyecc-jsbnee-firstejselectron-to-chromiumelement-resize-detectorellipticemoji-regexemojis-listemotion-themingencodeurlend-of-streamenhanced-resolveentitieserrnoerror-exes-abstractes-array-method-boxes-properlyes-get-iteratores-to-primitivees5-shimes6-shimescaladeescape-htmlescape-string-regexpescodegeneslint-scopeesprimaesrecurseestraverseestree-walkeresutilsetageventemitter3eventseventsourceevp_bytestokeyexec-shexecaexitexpand-bracketsexpectexpressextendextend-shallowexternal-editorextglobextsprintffast-deep-equalfast-globfast-json-stable-stringifyfast-levenshteinfastqfaultfaye-websocketfb-watchmanfiggy-puddingfiguresfile-loaderfile-system-cachefilesizefill-rangefinalhandlerfind-cache-dirfind-rootfind-upflush-write-streamfocus-lockfor-inforever-agentfork-ts-checker-webpack-pluginform-dataformatforwardedfragment-cachefreshfrom2fs-extrafs-minipassfs-write-stream-atomicfs.realpathfunction-bindfunction.prototype.namefunctions-have-namesfuse.jsgaugegensyncget-caller-fileget-intrinsicget-streamget-symbol-descriptionget-valuegetpassglobglob-baseglob-parentglob-to-regexpglobalglobal-modulesglobal-prefixglobalsglobalthisglobbygood-listenergraceful-fsgrowlygudgzip-sizehar-schemahar-validatorhard-rejectionhashas-ansihas-bigintshas-flaghas-symbolshas-tostringtaghas-unicodehas-valuehas-valueshash-basehash.jshast-util-parse-selectorhastscripthehighlight.jshmac-drbghoist-non-react-staticshosted-git-infohtml-encoding-snifferhtml-entitieshtml-escaperhtml-minifier-terserhtml-webpack-pluginhtmlparser2http-errorshttp-parser-jshttp-signaturehttps-browserifyhuman-signalsiconv-liteicss-utilsieee754iferrignoreimmerimport-cwdimport-freshimport-fromimport-localimurmurhashindent-stringinfer-ownerinflightinheritsiniinquirerinternal-slotinterpretinvariantipip-regexipaddr.jsis-accessor-descriptoris-alphabeticalis-alphanumericalis-argumentsis-arrayishis-bigintis-binary-pathis-boolean-objectis-bufferis-callableis-ciis-core-moduleis-data-descriptoris-date-objectis-decimalis-descriptoris-directoryis-dockeris-domis-extendableis-extglobis-fullwidth-code-pointis-functionis-generator-fnis-globis-hexadecimalis-mapis-moduleis-negative-zerois-numberis-number-objectis-objectis-path-cwdis-path-insideis-plain-objis-plain-objectis-regexis-rootis-setis-shared-array-bufferis-streamis-stringis-symbolis-typedarrayis-weakrefis-windowis-windowsis-wslisarrayisexeisobjectisstreamistanbul-lib-coverageistanbul-lib-instrumentistanbul-lib-reportistanbul-lib-source-mapsistanbul-reportsiterate-iteratoriterate-valuejest-changed-filesjest-clijest-configjest-diffjest-docblockjest-eachjest-environment-jsdomjest-environment-nodejest-get-typejest-haste-mapjest-jasmine2jest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-pnp-resolverjest-regex-utiljest-resolvejest-resolve-dependenciesjest-runnerjest-runtimejest-serializerjest-snapshotjest-utiljest-validatejest-watcherjest-workerjs-tokensjs-yamljsbnjsdomjsescjson-parse-better-errorsjson-schemajson-schema-traversejson-stringify-safejson3json5jsonfilejsprimkind-ofklawkleurlazy-universal-dotenvlevenlevenarylevnlines-and-columnsloader-runnerloader-utilslocate-pathlodashlodash.debouncelodash.memoizelodash.sortbylodash.throttlelolexloose-envifylower-caselowlightlru-cachemake-dirmakeerrormap-cachemap-objmap-or-similarmap-visitmarkdown-to-jsxmd5.jsmedia-typermemoizerificmemory-fsmeowmerge-descriptorsmerge-streammerge2methodsmicroevent.tsmicromatchmiller-rabinmimemime-dbmime-typesmimic-fnmin-documentmin-indentminimalistic-assertminimalistic-crypto-utilsminimatchminimistminimist-optionsminipassminipass-collectminipass-flushminipass-pipelinemississippimixin-deepmkdirpmomentmove-concurrentlymsmute-streamnanomatchnatural-comparenegotiatorneo-asyncnice-tryno-casenode-fetchnode-int64node-libs-browsernode-modules-regexpnode-notifiernode-releasesnormalize-package-datanormalize-pathnormalize-rangenpm-run-pathnpmlognth-checknum2fractionnumber-is-nannwsapioauth-signobject-assignobject-copyobject-inspectobject-isobject-keysobject-visitobject.assignobject.entriesobject.fromentriesobject.getownpropertydescriptorsobject.pickobject.valueson-finishedonceonetimeopenoptionatororiginalos-browserifyos-tmpdirp-each-seriesp-finallyp-limitp-locatep-mapp-trypakoparallel-transformparam-caseparent-moduleparse-asn1parse-entitiesparse-jsonparse5parseurlpascal-casepascalcasepath-browserifypath-dirnamepath-existspath-is-absolutepath-keypath-parsepath-to-regexppath-typepbkdf2performance-nowpicocolorspicomatchpifypiratespkg-dirpkg-uppnpnp-webpack-pluginpolishedpopper.jsposix-character-classespostcsspostcss-flexbugs-fixespostcss-load-configpostcss-loaderpostcss-modules-extract-importspostcss-modules-local-by-defaultpostcss-modules-scopepostcss-modules-valuespostcss-selector-parserpostcss-value-parserprelude-lspretty-errorpretty-formatpretty-hrtimeprismjsprivateprocessprocess-nextick-argspromise-inflightpromise.allsettledpromise.prototype.finallypromptsprop-typesproperty-informationproxy-addrprrpslpublic-encryptpumppumpifypunycodeqsquerystringquerystring-es3querystringifyquick-lruramdarandombytesrandomfillrange-parserraw-bodyraw-loaderreactreact-clientside-effectreact-dev-utilsreact-domreact-draggablereact-error-overlayreact-fast-comparereact-focus-lockreact-helmet-asyncreact-hotkeysreact-inspectorreact-isreact-lifecycles-compatreact-popperreact-popper-tooltipreact-sizemereact-syntax-highlighterreact-textarea-autosizeread-pkgread-pkg-upreadable-streamreaddirprealpath-nativerechoirrecursive-readdirredentrefractorregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregex-notregexp.prototype.flagsregexpu-coreregjsgenregjsparserrelateurlremove-trailing-separatorrenderkidrepeat-elementrepeat-stringrequestrequest-promise-corerequest-promise-nativerequire-directoryrequire-main-filenamerequire-relativerequires-portresize-observer-polyfillresolveresolve-cwdresolve-fromresolve-urlrestore-cursorretreusifyrimrafripemd160rollup-pluginutilsrsvprun-asyncrun-parallelrun-queuerxjssafe-buffersafe-regexsafer-buffersanesaxesschedulerschema-utilsselectsemversendserialize-javascriptserve-faviconserve-staticset-blockingset-valuesetimmediatesetprototypeofsha.jsshallow-equalshallowequalshebang-commandshebang-regexshell-quoteshelljsshellwordsside-channelsignal-exitsimplebarsimplebar-reactsisteransislashsnapdragonsnapdragon-nodesnapdragon-utilsockjs-clientsource-list-mapsource-mapsource-map-resolvesource-map-supportsource-map-urlsourcemap-codecspace-separated-tokensspdx-correctspdx-exceptionsspdx-expression-parsespdx-license-idssplit-stringsprintf-jssshpkssristablestack-utilsstatic-extendstatusesstealthy-requirestore2stream-browserifystream-eachstream-httpstream-shiftstring-lengthstring-widthstring.prototype.matchallstring.prototype.padendstring.prototype.padstartstring.prototype.trimendstring.prototype.trimstartstring_decoderstrip-ansistrip-bomstrip-eofstrip-final-newlinestrip-indentstyle-loadersupports-colorsupports-hyperlinkssvelte-dev-helpersymbol-treesymbol.prototype.descriptiontapabletelejsonterm-sizeterminal-linkterserterser-webpack-plugintest-excludetext-tablethroatthrottle-debouncethroughthrough2timers-browserifytiny-emittertmptmplto-arraybufferto-fast-propertiesto-object-pathto-regexto-regex-rangetoggle-selectiontoidentifiertough-cookietr46trim-newlinests-dedentts-pnptslibtty-browserifytunnel-agenttweetnacltype-checktype-detecttype-festtype-istyped-stylestypedarraytypedarray-to-bufferunbox-primitiveunfetchunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunion-valueunique-filenameunique-sluguniversalifyunpipeunquoteunset-valueupathuri-jsurixurlurl-loaderurl-parseuseuse-callback-refuse-sidecarutilutil-deprecateutil.promisifyutilautils-mergeuuidv8-to-istanbulvalidate-npm-package-licensevaryverrorvm-browserifyw3c-hr-timew3c-xmlserializerwalkerwarningwatchpackwatchpack-chokidar2webidl-conversionswebpackwebpack-dev-middlewarewebpack-hot-middlewarewebpack-logwebpack-sourceswebpack-virtual-moduleswebsocket-driverwebsocket-extensionswhatwg-encodingwhatwg-mimetypewhatwg-urlwhichwhich-boxed-primitivewhich-modulewide-alignwidest-lineword-wrapworker-farmworker-rpcwrap-ansiwrappywrite-file-atomicwsxml-name-validatorxmlcharsxtendy18nyallistyamlyargsyargs-parser
0.0.2

1 year ago

0.0.1

1 year ago