Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@prismicio/mock

prismicio2kApache-2.00.6.0TypeScript support: included

Generate mock Prismic documents, fields, Slices, and models for development and testing environments

typescript, prismic, mock, test, testing

readme

@prismicio/mock

npm version npm downloads Github Actions CI Codecov Conventional Commits License

⚠ This project is in an experimental state and therefore primarily meant to be used by Prismic kits. Use it at your own risks or stay tuned for the official release!

Generate mock Prismic data for development and testing environments.

  • 🏭 Generate mock Custom Type and Shared Slice models
  • 🧸 Generate mock documents and individual field values from a model

Install

npm install @prismicio/mock @prismicio/client

Documentation

⚠ Official documentation on the Prismic site is not yet available while the project is developed. Check the integrated TSDoc for API documentation.

To discover what's new on this package check out the changelog. For full documentation, visit the official Prismic documentation.

Contributing

Whether you're helping us fix bugs, improve the docs, or spread the word, we'd love to have you as part of the Prismic developer community!

Asking a question: Open a new topic on our community forum explaining what you want to achieve / your question. Our support team will get back to you shortly.

Reporting a bug: Open an issue explaining your application's setup and the bug you're encountering.

Suggesting an improvement: Open an issue explaining your improvement or feature so we can discuss and learn more.

Submitting code changes: For small fixes, feel free to open a pull request with a description of your changes. For large changes, please first open an issue so we can discuss if and how the changes should be implemented.

For more clarity on this project, check out the detailed CONTRIBUTING.md document.

License

Copyright 2013-2024 Prismic <contact@prismic.io> (https://prismic.io)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

0.6.0 (2024-12-17)

⚠ BREAKING CHANGES

  • change to ESM (#29)

Features

0.6.0-alpha.1 (2024-12-16)

Features

Refactor

  • remove change-case dependency (10fb86b)

Chore

  • update version to latest alpha (ba3fdc6)

0.5.0 (2024-12-05)

0.5.0-alpha.1 (2024-11-28)

0.5.0-alpha.0 (2024-11-11)

0.4.0 (2024-09-26)

0.3.8-alpha.1 (2024-08-29)

Features

  • add text to content relationship value (a50ac3d)
  • add text to link model (649b6af)
  • add text to link to media model (6d730f3)
  • add text to link to media value (73bcab4)
  • add text to link value (253515f)
  • text to content relationship model (82f9b29)

Bug Fixes

Refactor

  • simplify the new script (01f7cb0)
  • update with review suggestions (7fcafdc)

Chore

0.3.9 (2024-09-06)

Bug Fixes

0.3.8 (2024-09-04)

Bug Fixes

  • add new missing properties mocks (id, is_master) (#24) (162a348)

Documentation

0.3.7 (2024-06-20)

Features

Documentation

0.3.7-alpha.1 (2024-06-05)

Bug Fixes

  • update buildMockGroupFieldMap to return nested group fields (4830095)

0.3.7-alpha.0 (2024-06-05)

Features

  • support groups in groups (42b0811)

Bug Fixes

Chore

0.3.6 (2024-04-26)

Bug Fixes

  • treat a custom type model's label property as non-nullable (#20) (4f7fddd)

0.3.5 (2024-04-18)

Features

0.3.4 (2024-04-13)

Bug Fixes

0.3.3 (2024-04-12)

Bug Fixes

  • prevent erroneous d.ts files (b150d95)

0.3.2 (2024-04-12)

Features

  • support format option in custom type models (#16) (3b72c7f)

Chore

0.3.1 (2023-06-13)

Bug Fixes

0.3.0 (2023-06-01)

⚠ BREAKING CHANGES

  • replace @prismicio/types with @prismicio/client (#14)

Features

  • replace @prismicio/types with @prismicio/client (#14) (72340a7)

Chore

  • update package-lock.json (18e4054)

0.2.0 (2022-12-19)

⚠ BREAKING CHANGES

  • use built-in PRNG (#13)

Features

0.1.1 (2022-07-26)

Bug Fixes

  • use Image field thumbnail names from model in higher-level value types (#11) (c0fdbb2)
  • use Rich Text field type for Rich Text and Title field values (#12) (c13751c)

0.1.0 (2022-07-08)

⚠ BREAKING CHANGES

  • factory API (#9)

Features

Bug Fixes

  • return correct Integration Fields value data (21b882c)
  • type and bundle order bugs (#10) (0f389e0)
  • use corrected IntegrationFields value (36dda0e)

Chore

  • deps: upgrade dependencies (a8ddb6b)

0.0.10 (2022-04-15)

Chore

  • do not declare package as an ES Module (cd19441)

0.0.9 (2022-03-21)

Features

  • replace faker with custom fake data generator (#8) (bd60c5c)

Bug Fixes

  • type in SliceZone value generator (75b21ca)

Chore

  • add Size Limit support (7a734d2)
  • ci: fix ci workflow branch (fbeaabe)
  • deps: upgrade dependencies (fcffc72)

0.0.8 (2022-02-22)

Features

  • customize Integration Fields field model with a specific catalog (b349ee6)
  • support empty Group, Slice Zone, and Title fields (82d02ff)

Bug Fixes

  • type issue with SliceZone slice_type field (b8b490b)

0.0.7 (2022-02-19)

Features

  • more customizable and deterministic generated models and values (#7) (274f5ca)

Bug Fixes

  • support boolean for isFilled link value option (ee4e473)

Documentation

Chore

  • add esbuild as dev dependency (ac6ff21)
  • config: update config to latest standards (6b85471)
  • deps: update dependencies with npm update (028c5f2)
  • downgrade to AVA 3 (fccbbec)
  • replace esbuild-register with ts-eager (791bd74)
  • update dependencies (eba4a05)
  • update dependencies (1fdfe6e)
  • update dependencies (except faker) (dd59fad)

0.0.6 (2021-08-28)

Features

  • rename slices config to sliceZone (50c1c9f)
  • return alternative language documents for mock documents (4444df2)
  • use given variations in a Shared Slice model (c5b7afd)

Bug Fixes

  • generate image thumbnail names without spaces (25b26b6)
  • use Custom Type tab names with more variety (f2c905c)

Refactor

0.0.5 (2021-08-23)

Features

  • mock a Slice Zone with given choice models (a565ebc)
  • support string seed (3616cb8)

Bug Fixes

  • filter UID field from document's data field (5e17ec9)
  • generate mock sliceZone choices if none are given (c421c46)

0.0.4 (2021-08-20)

Features

0.0.3 (2021-08-19)

Features

  • support integration fields and linked documents (921ce13)

Bug Fixes

  • types (3fe946e)
  • use deterministic timestamp for integration fields (e3112d9)

Documentation

  • add missing documentation disclaimer (9dca75f)

0.0.2 (2021-08-11)

Features

  • allow explicit blank target for link values (93c87cf)
  • use mock URLs for url fields (414f35e)

0.0.1 (2021-08-11)

Features

  • add document generator (edd7787)
  • add group and slice value generators (2804d36)
  • add model generators (ad95cd2)
  • add non-group-based value generators (5561ea1)
  • add remaining field model generators (66b5ee5)
  • add rich text value generators (f8bc705)
  • add subset of value generators (50bcf16)
  • enable deterministic generation (7332eac)
  • export model and value modules from index (1a56262)
  • init (4e24f1c)

Bug Fixes

  • don't set labels when using Shared Slices (4725b5e)
  • prioritize specific seeds over general ones (27b795f)
  • use enum for Rich Text block type (2689a52)

Documentation

  • add experimental notice (f20e12c)
  • add README content (7450b75)
  • use more general package description (e6edd0f)

Refactor

  • rename getRandomXData to getMockXData (b92ed9a)

Chore