@aurodesignsystem/auro-library

中文文档
5.14.4发布于 2026/10/09Apache-2.0CommonJS构建来源已验证近 30 天下载 2.9万

This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.

原始使用文档
文档目录10 节
  1. Scripts
  2. Publish Surge Demo
  3. Surge Demo Teardown
  4. Dependency Tag Versioning
  5. Sync All Templates
  6. How to Run the syncAllTemplates.mjs Script
  7. Prep to build api.md
  8. Example Calls
  9. Deprecation Prose to CEM Field Plugin
  10. Usage

Auro-Library

This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.

Scripts

Publish Surge Demo

This is an automated workflow that utilizes GitHub Actions to generate surge demos. Upon making any change to a PR a comment will be added or updated on the PR with a link to the demo similar to the following:

Surge demo deployment succeeded! 🚀🚀🚀

[Auro Web Component Generator](https://surge.sh/)

This workflow utilizes the file ./scripts/config/useBundles.js to update the demo HTML files to use the bundled versions of components so that they can be supported staticly in surge.

In order to add this functionality to an auro component you just need to add the following snippet into the publishDemo.yml file in the ./.github/workflows directory.

name: Deploy Demo

on:
  pull_request:
    branches: [ main ]


jobs:
  call-publish-demo-workflow:
    uses: AlaskaAirlines/auro-library/.github/workflows/publishDemo.yml@main
    secrets:
      SURGE_TOKEN: ${{secrets.AURO_SURGE_TOKEN}}

Note: This will only work properly in components located in the "AlaskaAirlines" organization due to a dependency on the org-wide Actions secret AURO_SURGE_TOKEN.

Afterwards you will want to make sure to update the script tags you want replaced with bundles in your ./demo/*.html files with the data-demo-scripts="true" attribute.

--    <script type="module" src="../index.js"></script>
++    <script type="module" src="../index.js" data-demo-script="true"></script>

Note: If you fail to do this, the components will fail to register in your demo.


Surge Demo Teardown

This workflow works to automatically delete and clear any surge demos that have been active for more than 2+ months. Surge in theory allows us to have an infinite amount of active pages but by clearing unused and stale demos we can keep our Surge account more organized in the future.

Note: This workflow executes on a monthly cronjob on the first of each month.

In order to clear all our surge projects we rely on this GitHub Action to handle the deletion logic.


Dependency Tag Versioning

This is a two part utility for the purpose of generating a custom string for dependency component tag naming. This is important to prevent version conflicts when multiple versions of a given Auro component may be loaded on a single page.

Note: The example configuration used below in all code samples assumes auro-dropdown is the dependency component. Substitute any Auro component in the example code as needed.

Part 1: The Build

Configuration
  1. Create a new file ./scripts/version.js with the following content:
const versionWriter = require("./versionWriter"); // need to update this with the right path when used from node_modules

versionWriter.writeDepVersionFile('@aurodesignsystem/auro-dropdown'); // duplicate this line for each Auro dependency.
  1. Add the following script to the component package.json file:
"build:version": "node scripts/version.js"
  1. The build:version script in package.json should be added as the first step of the build script.
"build": "npm-run-all build:version ... etc.",
Execution

Once configuration is complete, execute npm run build. This must be done once before npm run dev when developing locally. When Auro dependencies are initially installed or updated to new versions then npm run build:version or a complete npm run build must be executed.

Upon execution of build:version, for each Auro dependency defined in the ./scripts/version.js file, a new JS file will be created that contains the installed version of the dependency.

For example, following these steps:

  1. Run npm i @aurodesignsystem/[email protected]
  2. add the following to the ./scripts/version.js script file:
versionWriter.writeDepVersionFile('@aurodesignsystem/auro-dropdown');
  1. Run npm run build

Will result in:

  • A new file created: ./src/dropdownVersion.js
  • File content will export the version of the component installed. In this case: export default '1.0.0'

Part 2: The Runtime

Configuration

In the main component JS file located in the ./src directory add the following:

import { AuroDependencyVersioning } from "../scripts/dependencyTagVersioning.mjs";
import { AuroDropdown } from '@aurodesignsystem/auro-dropdown/src/auro-dropdown.js';
import dropdownVersion from './dropdownVersion';

In the components constructor add the following:

const versioning = new AuroDependencyVersioning();
this.dropdownTag = versioning.generateTag('auro-dropdown', dropdownVersion, AuroDropdown);

In the component properties add the following:

/**
 * @private
 */
dropdownTag: { type: Object }
Usage

The new dynamically named version of auro-dropdown may now be used in your component template as follows:

render() {
  return html`
    <div>
      <${this.dropdownTag}></${this.dropdownTag}>
    </div>
  `;
}

When the component is rendered during runtime the DOM will now show up as follows:

<div>
  <auro-dropdown_1_0_0></auro-dropdown_1_0_0>
</div>

Note: the numbers attached in the tag name will match the version of the dependency that was installed.

Accessing the dynamically named element with JS

The dynamic component is accessible using a the following string in a JS query selector:

this.dropdownTag._$litStatic$
firstUpdated() {
  this.dropdown = this.shadowRoot.querySelector(this.dropdownTag._$litStatic$);
};

Sync All Templates

How to Run the syncAllTemplates.mjs Script

To run the syncAllTemplates.mjs script, you will need to add a new node script into the linked component and point that to the syncAllTemplates.mjs file. You can individually run the workflow configurations by pointing to the syncAllTemplates.mjs file and adding a --github parameter after the path. The same can be done for the linter configurations by adding a --linters parameter.

Example Calls

// Default
"syncTemplates": "./node_modules/@aurodesignsystem/auro-library/scripts/config/syncAllTemplates.mjs"
// Only sync github workflow templates
"syncTemplates": "./node_modules/@aurodesignsystem/auro-library/scripts/config/syncAllTemplates.mjs --github"
// Only sync linter configuration templates
"syncTemplates": "./node_modules/@aurodesignsystem/auro-library/scripts/config/syncAllTemplates.mjs --linters"

Prep to build api.md

How to Run the generateWcaComponent.mjs Script

To run the generateWcaComponent.mjs script, you need to provide the file paths for the components you want to process with WCA. This script should be executed only once after adding a new component to the project. Upon running the script, .js files will be generated in the scripts/wca folder.

Example Calls

// Common case: 1 component in 1 project
"build:api:prepare": "node ./node_modules/@aurodesignsystem/auro-library/scripts/generateWcaComponent.mjs 'src/auro-flight.js'"
// multiple components in 1 project
"build:api:prepare": "node ./node_modules/@aurodesignsystem/auro-library/scripts/config/syncAllTemplates.mjs 'src/auro-flight*.js'"

Deprecation Prose to CEM Field Plugin

The deprecatedProseToFieldPlugin is a shared Custom Elements Manifest analyzer plugin. It promotes deprecation prose written on @event and @slot tags into the machine-readable deprecated field of the generated custom-elements.json, so editor tooling can strike deprecated events and slots through.

The CEM analyzer already emits a deprecated field for attributes and members declared with an explicit @deprecated JSDoc tag, but it does not do so for events and slots declared as inline class-level @event / @slot tags. This plugin fills that gap by scanning each declaration's events and slots and, where a description contains a deprecation marker ((Deprecated) …, **DEPRECATED** …, or a leading deprecated word):

  • sets deprecated to the guidance text that follows the marker and a separator (-, :, –, or —) — for example, "Use the \input` event instead."`, or
  • sets deprecated to true when the prose offers no replacement guidance.

Attributes and members are intentionally left untouched — the analyzer already flags those correctly. Entries that already carry a deprecated value are never overwritten.

Usage

Import the plugin into your component library's custom-elements-manifest.config.mjs and add it to the plugins array:

import { deprecatedProseToFieldPlugin } from '@aurodesignsystem/auro-library/scripts/build/deprecatedProseToFieldPlugin.mjs';

export default {
  globs: ['components/**/src/*.js'],
  litelement: true,
  plugins: [deprecatedProseToFieldPlugin()]
};

Regenerating your custom-elements.json will now mark deprecated events and slots with their guidance messages.

版本与发布记录

@aurodesignsystem/auro-library 共发布 114 个版本,首次发布于 2023/07/14;过去 12 个月发布了 25 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.14.4latest2026/10/0930 天前
5.14.32026/10/051 个月前
5.14.22026/09/101 个月前
5.14.12026/09/022 个月前
5.14.02026/08/302 个月前
5.13.32026/08/083 个月前

其他发布通道:beta → 4.4.0-beta.1。

关于 @aurodesignsystem/auro-library 的常见问题

@aurodesignsystem/auro-library 是什么?

This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.

如何安装 @aurodesignsystem/auro-library?

在项目目录运行 npm install @aurodesignsystem/auro-library,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 generateDocs,可以用 npx generateDocs 直接运行。

@aurodesignsystem/auro-library 支持 TypeScript 吗?

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

@aurodesignsystem/auro-library 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@aurodesignsystem/auro-library 需要什么版本的 Node.js?

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

@aurodesignsystem/auro-library 可以商用吗?

@aurodesignsystem/auro-library 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aurodesignsystem/auro-library 的下载量有多少?

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

@aurodesignsystem/auro-library 还在维护吗?

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