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

中文文档
23.3.1发布于 2026/10/09ISCES Module近 30 天下载 2918

Shared Vue component library for dpa projects

原始使用文档
文档目录7 节
  1. Content
  2. Requirements
  3. Getting started
  4. Integrate shared Tailwind preset
  5. Set up code quality linting
  6. Set up code formatting
  7. Usage

DPA shared components library

Collection of common Vue.js components for use in dpa projects.

Content

Requirements

  • Node.js (see engines.node in package.json for compatible versions)
  • The packages @eslint/js @tailwindcss/typography eslint prettier tailwindcss vue vue-router (see peerDependencies in package.json for compatible versions)

Getting started

  1. Install the package.

    pnpm install @dpa-id-components/dpa-shared-components
    
  2. Install the peer dependencies.

    pnpm install @tailwindcss/typography tailwindcss vue vue-router
    pnpm install --dev @eslint/js eslint prettier
    
    • Tailwind and its plugins are needed because the shared Tailwind preset uses them.
    • Vue.js and vue-router are needed because the shared components depend on them.
    • ESLint and Prettier are needed because we want to enforce code quality linting and formatting across projects.
  3. Integrate the shared CSS and set up code quality linting and code formatting (see the following sections).

Integrate shared Tailwind preset

Reference the Tailwind preset from your CSS entrypoint (e.g. something like a main.css file).

@import "@dpa-id-components/dpa-shared-components/tailwindPreset";

@source "../../node_modules/@dpa-id-components/dpa-shared-components";
/* Make sure to adjust the `..` segments to match where the `node_modules` directory is. Tailwind won't produce an error if the path is wrong. */

/* … */

Set up code quality linting

A shared ESLint configuration is provided at @dpa-id-components/dpa-shared-components/config/eslint.config.js. Use it as a base configuration for code quality linting via ESLint.

Example ESLint configuration:

import sharedConfig from "@dpa-id-components/dpa-shared-components/config/eslint.config.js";
import { globalIgnores } from "eslint/config";

export default [
  {
    files: ["**/*.ts", "**/*.mts", "**/*.vue"],
  },

  globalIgnores(["**/dist/", "**/coverage/"]),

  ...sharedConfig,

  {
    settings: {
      "better-tailwindcss": {
        // The CSS entry point has to be manually configured in each host project.
        entryPoint: "src/assets/main.css",
      },
    },
  },

  {
    files: ["**/*.vue"],
    rules: {
      "vue/no-undef-components": [
        "error",
        {
          // Add globally-registered components here:
          ignorePatterns: ["i18n-t", "RouterLink", "RouterView"],
        },
      ],
    },
  },
];

Set up code formatting

A shared Prettier configuration is provided at @dpa-id-components/dpa-shared-components/config/prettier.config.js. Use it as a base configuration for code formatting via Prettier.

Example Prettier configuration:

import sharedConfig from "@dpa-id-components/dpa-shared-components/config/prettier.config.js";

/**
 * @see https://prettier.io/docs/configuration
 * @type {import("prettier").Config}
 */
export default {
  ...sharedConfig,
};

You might also want to add a Prettier ignore file (e.g. for ignoring Markdown files) and set up Prettier in your code editor to automatically format on save.

Usage

To use a component, import its source file directly:

import UiButton from "@dpa-id-components/dpa-shared-components/components/UiButton/UiButton.vue";

版本与发布记录

@dpa-id-components/dpa-shared-components 共发布 341 个版本,首次发布于 2023/01/31;过去 12 个月发布了 48 个版本。

版本发布日期距今
23.3.1latest2026/10/091 个月前
23.3.02026/09/281 个月前
23.2.12026/09/251 个月前
23.2.02026/09/221 个月前
23.1.12026/09/181 个月前
23.1.02026/09/092 个月前

其他发布通道:prerelease → 9.1.1-0,alpha → 11.0.0-alpha.0,next → 22.0.0-next.14。

关于 @dpa-id-components/dpa-shared-components 的常见问题

@dpa-id-components/dpa-shared-components 是什么?

Shared Vue component library for dpa projects

如何安装 @dpa-id-components/dpa-shared-components?

在项目目录运行 npm install @dpa-id-components/dpa-shared-components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.5.0)、eslint(^10.4.0)、prettier(^3.8.1)、@eslint/js(^10.0.1)、vue-router(^5.1.0)、tailwindcss(^4.1.11)、@tailwindcss/typography(^0.5.16)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dpa-id-components/dpa-shared-components 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dpa-id-components__dpa-shared-components 是否存在。

@dpa-id-components/dpa-shared-components 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@dpa-id-components/dpa-shared-components 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^24.10.0 || >=26。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dpa-id-components/dpa-shared-components 可以商用吗?

@dpa-id-components/dpa-shared-components 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@dpa-id-components/dpa-shared-components 的下载量有多少?

根据 npm 官方下载统计,@dpa-id-components/dpa-shared-components 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,918 次,日均约 97 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dpa-id-components/dpa-shared-components 还在维护吗?

最新版本 23.3.1 发布于 2026/10/09(1 个月前);至今共发布 341 个版本,其中过去 12 个月发布了 48 个;首次发布于 2023/01/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。