@coveo/quantic

中文文档
3.45.7发布于 2026/11/09Apache-2.0CommonJS构建来源已验证近 30 天下载 5053

A Salesforce Lightning Web Component (LWC) library for building modern UIs interfacing with the Coveo platform

原始使用文档
文档目录17 节
  1. Using the Library
  2. Contributing
  3. Create a Salesforce Developer Organization
  4. Setup SFDX CLI
  5. Update SFDX CLI Plugins
  6. Install VSCode Extension
  7. Enable Dev Hub in Your Salesforce Organization
  8. Authorize Your Dev Hub
  9. Single Command Run
  10. Playground Components and Solution Examples
  11. Testing
  12. Deploy the Quantic Examples Communities
  13. Run Playwright for Quantic Components
  14. Run LWC unit tests for Quantic Components
  15. Use Quantic From Source
  16. Other Useful Commands
  17. Learn About LWC

Coveo Quantic

Using the Library

How to use the Coveo Quantic Library

Install Coveo Quantic as a Salesforce unlocked package

Contributing

Create a Salesforce Developer Organization

  • Sign up
  • Use your @coveo.com email account. The username can be anything.

Setup SFDX CLI

Salesforce cli

Update SFDX CLI Plugins

  • Run sf plugins update

Install VSCode Extension

Optionally install the VSCode Salesforce Extension Pack if you do not want use the equivalent Salesforce cli commands to setup.

Note Make sure you open the quantic project at the root (/packages/quantic/) in vscode in order for the extension to work properly.

Enable Dev Hub in Your Salesforce Organization

  • Connect to your salesforce developer organization login
  • From Setup, enter Dev Hub in the Quick Find box and select Dev Hub.
  • To enable Dev Hub, click Enable

Authorize Your Dev Hub

  • In VS Code, press Command + Shift P, enter sfdx, and select SFDX: Authorize a Dev Hub.
  • You can also run this command from the command line. sf org login web --set-default-dev-hub --alias LWC-Hub
  • Running this command opens a browser to the Salesforce login page. Enter your Salesforce username and password. Authorize only once, not every time you work on your project.

Single Command Run

  • Make sure you are at the root of packages/quantic.

  • Run pnpm run setup:examples.

This command will create two scratch orgs for you:

  • One with Lightning Web Security (LWS) enabled. (Alias: Quantic__LWS_enabled)

  • One with LWS disabled, Locker Service enabled. (Alias: Quantic__LWS_disabled)

Each scratch org will include:

  • All Quantic components
  • The example components
  • An example Quantic community featuring:
    • 🧪 Component playgrounds
    • 💡 Solution examples

To access the links to the created communities, check the generated .env file after the script completes.

Or you can run the individual commands below.

Playground Components and Solution Examples

Quantic has two separate folders for example components, each serving a different purpose, use the following rules when adding an example component:

  • force-app/playgroundComponents contains the components used to build the Quantic Examples community playground and to support Playwright end-to-end tests. Add a component here when it demonstrates an individual Quantic component, exposes its configurable properties for experimentation, or provides test coverage for the component.
  • force-app/solutionExamples contains real-world reference implementations that demonstrate how to combine Quantic components to solve a broader Salesforce use case. Examples include exampleInsightPanel, exampleRelevantGenerativeAnswering, examplePageViewTracker and more. Add a component here when it demonstrates an integration or reusable solution pattern rather than an individual component playground.

Both folders are deployed by pnpm run deploy:examples.

Create a Default Scratch Org

  • Make sure you are in the packages/quantic root folder.
  • Run this command to create the default scratch org. pnpm run scratch:create.
  • In VS Code, press Command + Shift P, enter sfdx, and select SFDX: Create a Default Scratch Org.
  • You can also run this command from the command line. sf org create scratch --set-default --definition-file config/lws-enabled-scratch-def.json --alias Quantic__LWS_enabled
  • Quantic__LWS_enabled is an alias for the scratch org that you can use in other Salesforce CLI commands. You can create any alias that you like.

Deploy the Quantic code

  • Run this command from the command line. sf project deploy start --source-dir force-app/main.

Testing

Deploy the Quantic Examples Communities

Example components are available as Salesforce communities (Digital Experiences), allowing you to experiment with Quantic components in two separate environments: one with Lightning Web Security (LWS) enabled and one with LWS disabled.

To set up both communities in scratch orgs, run:

pnpm run setup:examples

This script creates, configures, and deploys everything required to have fully working examples in two scratch orgs:

  • An org with LWS enabled.
  • An org with LWS disabled.

At the end of the script, the URLs for the two communities are provided, as in the following example:


The 'Quantic Examples' community (LWS enabled) is ready, you can access it at the following URL:
https://your-salesforce-lws-enabled-scratch-org-instance.force.com/examples

The 'Quantic Examples' community (LWS disabled) is ready, you can access it at the following URL:
https://your-salesforce-lws-disabled-scratch-org-instance.force.com/examples

Once the community has been deployed, you can deploy the main or example components to a specific org only when needed by running the corresponding commands:

pnpm run deploy:main Quantic__LWS_enabled
pnpm run deploy:examples Quantic__LWS_enabled

You can replace Quantic__LWS_enabled with your target org alias. For example:

pnpm run deploy:main MyCustomOrg
pnpm run deploy:examples MyCustomOrg

Run Playwright for Quantic Components

Note Before attempting to run Playwright tests, make sure the Quantic Examples community is deployed as described in the previous section in both orgs, the one where LWS is enabled and the one where it is disabled.

Note For more information on how to add tests, please refer to our Quantic Testing Strategy, which provides detailed guidelines on testing Quantic components.

To run Playwright tests, run:

pnpm run e2e:pre-provisioned

To run Playwright tests only for the scratch org where LWS is enabled, run:

pnpm run e2e:pre-provisioned:lws-enabled

To run Playwright tests only for the scratch org where LWS is disabled, run:

pnpm run e2e:pre-provisioned:lws-disabled

Run LWC unit tests for Quantic Components

To run LWC unit tests directly in your console, run:

pnpm run test:unit

To run specific file/components LWC unit tests directly in your console, run:

pnpm run test:unit -p force-app/main/default/lwc/nameOfComponent/

Use Quantic From Source

After you have cloned the repository and have run pnpm install, run the following commands:

  • pnpm run build
  • sf project deploy start --source-dir force-app/main/default

Other Useful Commands

  • sf project deploy start --metadata LightningComponentBundle
  • --metadata LightningComponentBundle can be changed for different types of "resources". To know which name, check the related meta.xml file for each type of resource.
  • Create new web components. In VS Code, press Command + Shift P, enter sfdx, and select SFDX: Create Lightning Web Component.

Learn About LWC

  • lwc.dev
  • Components reference. Make sure you stay in the "Lightning web components section". Aura does not apply. Aura is the older UI library that is being deprecated by Salesforce.
  • Lightning design system. Reference for styling, CSS utilities, icons, and more.

版本与发布记录

@coveo/quantic 共发布 3,654 个版本,首次发布于 2022/06/14;过去 12 个月发布了 58 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.45.7latest2026/11/091 天前
3.45.62026/11/038 天前
3.45.52026/10/2022 天前
3.45.42026/10/1428 天前
3.45.32026/10/061 个月前
3.45.22026/09/301 个月前

其他发布通道:v2-latest → 2.57.9。

关于 @coveo/quantic 的常见问题

@coveo/quantic 是什么?

A Salesforce Lightning Web Component (LWC) library for building modern UIs interfacing with the Coveo platform

如何安装 @coveo/quantic?

在项目目录运行 npm install @coveo/quantic,或使用 pnpm add / yarn add / bun add。

@coveo/quantic 支持 TypeScript 吗?

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

@coveo/quantic 支持 ESM 还是 CommonJS?

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

@coveo/quantic 需要什么版本的 Node.js?

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

@coveo/quantic 可以商用吗?

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

@coveo/quantic 的下载量有多少?

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

@coveo/quantic 还在维护吗?

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