npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dpa-id-components/dpa-shared-components

v10.1.0

Published

Shared Vue components library for dpa projects

Downloads

1,610

Readme

DPA shared components library

Collection of vue 3 components for usage across dpa projects.

Pre-requirements

This project requires a node version of 16.x or higher. For Node environments such as nuxt.js Node v20 or higher is required to prevent errors from the missing crypto library, which is needed for uuid.

You need to add and integrate the Inter font that can be found in src/assets/fonts to your project manually. An example how the CSS could look can be found in src/tailwind/fonts.css

Notes

This project uses Typescript version >= 5.0. This upgrade included changes to the module resolution, which are not yet reflected fully in the tsconfig. If your project uses TS 5.0 or higher itself you most likely need to set

"resolvePackageJsonExports": false

to prevent transpiler errors. For more information see the migration guide of ts.

Usage

To use a component just import it from @dpa-id-components/dpa-shared-components like

import { UiBadge } from "@dpa-id-components/dpa-shared-components";

Tailwind

To have the styling working correctly you have to extend the tailwind config in your project.

Please ensure that the version of Tailwind in your host application meets the version specified under peerDependencies in package.json.

import sharedComponentsConfig from '@dpa-id-components/dpa-shared-components/tailwindConfig'
import { Config } from 'tailwindcss'

export default {
  presets: [sharedComponentsConfig],
  content: [
    // ... your content globs ...
    './node_modules/@dpa-id-components/dpa-shared-components/**/*.{js,mjs,cjs}'
  ]
}
satisfies
Config

The tailwind config is located at ./src/tailwind/tailwind.config.ts. Please be aware that used plugins must be listed in the dependencies or the projects using the components have to install it.

Add a component

To add a new component please add at least the following files:

  • Readme.md
  • Component.spec.ts
  • Component.stories.js
  • Component.vue

The readme should contain a minimal explanation of the usage and a definition of the api of the component (props, events, slots...). Also don't forget to add an import/export in ./src/components/index.ts to make your component available.

Tests

Tests are based on vitest and Vue Test Utils 2 running in a jsdom environment. To run the tests run

npm run test

The tests automatically are run as a watch task.

Storybook

This project runs on a 6.5 version of Storybook with a vite integration. If you want to change the vite config for storybook, please be aware that storybook overwrites the plugin section of the config in ./.storybook/main.ts, since storybook can't handle the vue plugin.

To start storybook locally run

npm run storybook

A deployed version of the storybook can be found here.

Link the project locally

For a better developer experience and testing in your actual it's recommended to link the package locally. For that run

npm link

in the root of your cloned shared components and

npm link "@dpa-id-components/dpa-shared-components"

in your target project.

Don't forget to run

npm run build

before linking or otherwise you wouldn't have a dist folder.

If linking doesn't seem to work, you can try to clear your vite-cache by deleting the node_modules/.vite folder

SVG icons

To add SVG icons, just copy the .svg file to ./src/assets/icons. Preferably you add the filename also to the ìconNames.ts so it's available in Storybook as option and in the overview. SVGs get loaded by vite-svg-loader, which optimizes the SVGs with svgo. Config can be added in vite.config.ts and ./.storybook/main.ts ( duplicated since Storybook can't handle the vite config plugins). Custom optimizations right now are:

  • removing dimensions (width/height attributes)
  • removing fills (to enable styling)

Releasing

To publish a new release just go to the Actions tab and click "Publish new version". You are prompted with the option to choose which version to bump. Behind the scenes it just does one of those commands below. They will still work on their own but the #shared-components Slack channel won't be notified.

npm run release:patch
npm run release:minor
npm run release:major