Template for building Svelte component libraries.
app/
)Clone the repository:
git clone [email protected]:metonym/template-lib-svelte.git
cd template-lib-svelte
Install its dependencies:
yarn install
When developing, use the webpack app set-up in the app/
folder to reload any changes to the library.
cd app
yarn install
yarn start
yarn build
Builds the library for production using Rollup and outputs artifacts to the lib
folder.
// package.json
{
"svelte": "src/index.js", // preferred Svelte entry
"main": "lib/index.js", // UMD build
"module": "lib/index.mjs" // ES Module build
}
yarn test
Runs tests using Jest with @testing-library/svelte and generates a coverage report.
yarn test:tdd
Runs tests in watch mode.
npm
Update the library name in package.json and rollup.config.js.
{
- "name": "template-lib-svelte",
+ "name": "<YOUR_LIBRARY_NAME>"
}
// rollup.config.js
if (UMD) {
- output.name = 'template-lib-svelte';
+ output.name = '<YOUR_LIBRARY_NAME>';
}