decoupled-drupal-mock-umami

中文文档
1.0.0-alpha.1发布于 2026/11/03GPL-2.0-or-laterTypeScriptES Module零依赖

Drupal's Umami demo site as decoupled-drupal-mock fixtures, built from a real Drupal 11 install.

原始使用文档
文档目录3 节
  1. Accounts and OAuth clients
  2. A site with more
  3. Published files and evidence

decoupled-drupal-mock-umami

Drupal's Umami demo site as fixtures for decoupled-drupal-mock, in English and Spanish. It was recorded from a Drupal 11 install of the demo_umami profile, with Decoupled Router, JSON:API Menu Items, JSON:API Views and Decoupled Settings.

The site also has the Druxt examples recipe from druxt.js applied, so it differs from a plain Umami install. The recipe enables the Druxt module, Simple OAuth and Decoupled Settings, and grants visitors access druxt resources and read decoupled settings, so a visitor can read configuration such as displays. It also turns off JSON:API's read-only mode, adds body to Basic pages and adds image styles. Core's menu linksets are not turned on, so the mock answers them 404, as this site did.

import { createDrupal } from 'decoupled-drupal-mock';
import umami from 'decoupled-drupal-mock-umami';

const drupal = createDrupal(umami(), { baseUrl: 'https://drupal.test' });
const index = await drupal.fetch('https://drupal.test/jsonapi');

The baseline is the site as released modules answer it, and dump/manifest.json names each module's version.

Accounts and OAuth clients

The build added these to the site, and the mock signs them in. Each password, and each client's secret, is the same as its name.

AccountRole
adminAdministrator, from the install. It has no password here and no OAuth client, so only tokenFor('admin') signs it in
editorEditor
authorAuthor
readerNone beyond authenticated
OAuth clientGrantsActs as
decoupled-drupal-mockClient credentials, refresh tokeneditor
decoupled-drupal-mock-authorClient credentialsauthor
decoupled-drupal-mock-readerClient credentialsreader
decoupled-drupal-mock-publicAuthorization code with PKCE, refresh token. No secret, and it redirects to http://127.0.0.1:3000/callbackThe user who signs in

The password grant is installed too. In a test, tokenFor('editor') returns a token for an account directly, without going through a grant.

A site with more

The preset is the stock site only. A site with a contrib module or a patch the preset lacks records the difference as an overlay of its own, from a build of that site: see Overlays. examples/overlays/ holds three made that way, Druxt's language routing patches among them, which the engine's tests replay. None is published with the preset.

Published files and evidence

dump/ is what the mock loads, and what this package publishes. dump/manifest.json names the Drupal core version the build came from, the hash of every file, and the hash of every recording the tests replay. A manifest with no format is format 1, which this engine reads.

The rest is evidence, kept in the repository and not published. oracle.txt and writes.json list the requests the build sends to a real Drupal. oracle/ stores Drupal's answers, and the engine's tests check against them.

Built for Druxt.

版本与发布记录

decoupled-drupal-mock-umami 共发布 2 个版本,首次发布于 2026/11/03;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.0.0-alpha.1latest2026/11/03今天
0.0.0-stage2026/11/03今天

关于 decoupled-drupal-mock-umami 的常见问题

decoupled-drupal-mock-umami 是什么?

Drupal的Umami演示站点作为解耦的Drupal模拟装置,从真正的Drupal 11安装中构建。

如何安装 decoupled-drupal-mock-umami?

在项目目录运行 npm install decoupled-drupal-mock-umami,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:decoupled-drupal-mock(^1.0.0-alpha.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

decoupled-drupal-mock-umami 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

decoupled-drupal-mock-umami 支持 ESM 还是 CommonJS?

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

decoupled-drupal-mock-umami 可以商用吗?

decoupled-drupal-mock-umami 使用 GPL-2.0-or-later 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以兼容的 GPL 许可开源。仅在内部使用、不对外分发时不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

decoupled-drupal-mock-umami 还在维护吗?

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