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

Package detail

@pattern-lab/core

pattern-lab15.4kMIT6.1.0

Create atomic design systems with Pattern Lab. This is the core API and orchestrator of the ecosystem.

Pattern Lab, Atomic Web Design, Node, Grunt, Gulp, Javascript

readme

Pattern Lab Logo

Continuous Integration CodeQL current release license Coverage Status code style: prettier node (scoped) Join the chat at Gitter

Pattern Lab Node Core

This is the core API and orchestrator of the Pattern Lab ecosystem.

Installation

Pattern Lab Node can be used different ways. Editions are example pairings of Pattern Lab code and do not always have an upgrade path or simple means to run as a dependency within a larger project. Users wishing to be most current and have the greatest flexibility are encouraged to consume patternlab-node directly. Users wanting to learn more about Pattern Lab and have a tailored default experience are encouraged to start with an Edition. Both methods still expect to interact with other elements of the Pattern Lab Ecosystem.

Direct Consumption

As of Pattern Lab Node 3.X, patternlab-node can run standalone, without the need for task runners like gulp or grunt.

npm install @pattern-lab/core

See Usage for more information.

Editions

For users wanting a more pre-packaged experience several editions are available.

Ecosystem

Pattern Lab Ecosystem

Core, and Editions, are part of the Pattern Lab Ecosystem. With this architecture, we encourage people to write and maintain their own Editions, Starterkits, and even PatternEngines.

Usage

@pattern-lab/core can be required within any Node environment, taking in a configuration file at instantiation.

const config = require('./patternlab-config.json');
const patternlab = require('@pattern-lab/core')(config);

// build, optionally watching or choosing incremental builds
patternlab.build({
  cleanPublic: true,
  watch: true,
});

// or build, watch, and then self-host
patternlab.serve({
  cleanPublic: true,
});

Events

Many events are emitted during Pattern Lab operations, originally built to support plugins. Below is a sample, allowing users to be informed of asset or pattern changes.

patternlab.serve(...);

patternlab.events.on('patternlab-asset-change', (data) => {
  console.log(data); // {file: 'path/to/file.css', dest: 'path/to/destination'}
});

patternlab.events.on('patternlab-pattern-change', (data) => {
  console.log(data); // {file: 'path/to/file.ext'}
});

patternlab.events.on('patternlab-global-change', (data) => {
  console.log(data); // {file: 'path/to/file.ext'}
});

Development Installation / Workflow

If you are interested in contributing to Pattern Lab, please do take some time to learn how we develop locally within the contribution guidelines.

Upgrading

If you find yourself here and are looking to upgrade, check out how to upgrade from version to version of Pattern Lab Node here: https://github.com/pattern-lab/patternlab-node/wiki/Upgrading

View the latest releases for comprehensive changelogs.

Contributing

If you'd like to contribute to Pattern Lab Node, please do so! There is always a lot of ground to cover and something for your wheelhouse.

Please read the contribution guidelines.

Core Team

Community

The Pattern Lab Node team uses our gitter.im channel, pattern-lab/node to keep in sync, share updates, and talk shop. Please stop by to say hello or as a first place to turn if stuck. Other channels in the Pattern Lab organization can be found on gitter too.

There is also a dedicated Pattern Lab channel on the design system slack run by @jina.

Ask or answer Pattern Lab questions on Stack Overflow: https://stackoverflow.com/questions/tagged/patternlab.io

License

MIT

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

6.1.0 (2023-12-21)

Note: Version bump only for package @pattern-lab/core

6.0.1 (2023-02-01)

Bug Fixes

  • twig engine: startup and running problems (#1478) (e5a1904)

6.0.0 (2023-01-31)

Note: Version bump only for package @pattern-lab/core

5.17.0 (2022-09-25)

Features

5.16.4 (2022-09-23)

Bug Fixes

5.16.2 (2022-02-07)

Bug Fixes

5.16.1 (2022-01-29)

Note: Version bump only for package @pattern-lab/core

5.16.0 (2022-01-29)

Note: Version bump only for package @pattern-lab/core

5.15.5 (2021-12-06)

Note: Version bump only for package @pattern-lab/core

5.15.4 (2021-12-06)

Note: Version bump only for package @pattern-lab/core

5.15.2 (2021-11-03)

Bug Fixes

5.15.1 (2021-10-16)

Bug Fixes

  • node16: prevent warning on installation process (#1352) (d58e4c6)

Features

Reverts

  • Revert "refactor: optimized engines directory retrieval (#1359)" (#1363) (a275d36), closes #1359 #1363

5.15.0 (2021-07-01)

Features

5.14.3 (2021-05-17)

Note: Version bump only for package @pattern-lab/core

5.14.2 (2021-03-28)

Bug Fixes

  • core: ReadDocumentation throw error on older node versions (#1295) (399d0e1)

5.14.1 (2021-02-19)

Note: Version bump only for package @pattern-lab/core

5.14.0 (2021-01-12)

Note: Version bump only for package @pattern-lab/core

5.13.3 (2020-12-17)

Note: Version bump only for package @pattern-lab/core

5.13.2 (2020-11-12)

Note: Version bump only for package @pattern-lab/core

5.13.1 (2020-09-06)

Note: Version bump only for package @pattern-lab/core

5.13.0 (2020-08-26)

Note: Version bump only for package @pattern-lab/core

5.12.0 (2020-08-09)

Note: Version bump only for package @pattern-lab/core

5.11.1 (2020-06-28)

Bug Fixes

  • enable partial build via option (8aaa533)

5.11.0 (2020-06-28)

Bug Fixes

  • enable partial build via option (8aaa533)

5.10.1 (2020-05-09)

Note: Version bump only for package @pattern-lab/core

5.10.0 (2020-05-09)

Bug Fixes

  • docs: resolving broken links in new docs site #1192 (cae9420)
  • docs: resolving broken links in new docs site #1192 (b4eb12e)

5.9.3 (2020-05-01)

Note: Version bump only for package @pattern-lab/core

5.9.0 (2020-04-24)

Bug Fixes

  • core: do not warn about uikit-polyfills (6bb68e7)

5.7.0 (2020-02-17)

Note: Version bump only for package @pattern-lab/core

5.4.0 (2019-11-26)

Bug Fixes

  • add a new method to check if PL is currently compiling + add new method to get the config PL is using (26e886c)

5.3.0 (2019-11-13)

Bug Fixes

  • core: re-add cleanPublic fix (c100bbc)

5.1.0 (2019-10-29)

Features

  • config: add new default pattern export options (a7487a0)
  • core: fix pattern export all conflicts (b210d82)

5.0.0 (2019-10-25)

Bug Fixes

  • add eslint fixes (00d7bbe)
  • correct typo in build logging (96d989f)
  • updates to address eslint / prettier issues (d945acc)
  • updates to fix eslint / prettier issues; update packages/core to reuse root .eslintrc.js file (5b7a057)
  • 1049: Treat folders like patterns only if they're subfolders of pattern groupings (4eb79ab)
  • core: allow plugin resolution to follow normal algorithm (3f6b83b)
  • core: find plugins from config only and with simpler args (fe7351c)
  • plugin: correct spelling error and function locations (d4abd88)

Features

  • core: invoke registered plugin hooks (a54d775)
  • plugin-tab, core: initial plugin hook exploration (2f3d39a)

BREAKING CHANGES

  • core: plugins now use async functions instead of events

3.0.2 (2019-08-23)

Bug Fixes

  • add eslint fixes (00d7bbe)
  • correct typo in build logging (96d989f)
  • updates to address eslint / prettier issues (d945acc)
  • updates to fix eslint / prettier issues; update packages/core to reuse root .eslintrc.js file (5b7a057)

3.0.1 (2019-05-16)

Note: Version bump only for package @pattern-lab/core

3.0.0-beta.2 (2019-02-09)

Bug Fixes

  • cli: pass watch options cleanly to core (8bf186b)
  • docs: regenerate API documentation (830c568)
  • patterns: find all patterns inlcuding pseudo patterns (d0672f6), closes #975
  • manually bump package.json versions of packages published in September but with mismatched package.json versions (98dfadf)

3.0.0-beta.0 (2018-09-07)

Bug Fixes

  • docs: update event info with tab example (0f227a3)
  • package: Allow .json extension on annotations file (issue #836) (b92e62b)
  • package: update tap dependency (2b70ff4)
  • plugins: support scoped packages (44f0f8e)

Features

  • API: remove reliance on patternlab object during plugin install (0850fd6)
  • core: remove plugin install / disable / enable logic (5a58824), closes #872

3.0.0-alpha.16 (2018-07-06)

Note: Version bump only for package @pattern-lab/core

3.0.0-alpha.15 (2018-07-06)

Features

  • package: add npmrc file (55f5bc2)
  • package: pin all dependencies (415698e)
  • package: remove package-lock.json files (5ab3995)

3.0.0-alpha.14 (2018-07-05)

Bug Fixes

  • core: rename serverModule import to avoid conflict with CLI (f3170e7)
  • server: remove setInterval hack (a76e4a2)
  • uikits: fix generation of view all pages within uikits (7d6bdce)
  • viewall: fix viewall generation (543558a)
  • watch: wire up serve and watch listeners correctly (04cd18e)

Features

  • events: add PATTERNLAB_BUILD_END event and rename BUILD_START (5b7bfa3)
  • help: remove help. API is now documented (2aef3a1)
  • server: beginning of refator (a3d65c3)
  • server: continue server refactor (8f6cd91)
  • watches: add additional assets to ignore (18e74c2)

3.0.0-alpha.13 (2018-05-04)

Features

  • api: expose getVersion statically (4683cd0)

3.0.0-alpha.12 (2018-05-04)

Bug Fixes

  • build: improve stability of changes causing a live-server reload (06c6123)
  • buildPatterns: move meta processing back into function for now (cea2c45)
  • pattern graph: move support and coverage of graph file to root (bb9ef3c)
  • pattern watch: Defensively add change listeners (cdbd11f)
  • test: fix the test please and thank you (cdc6c38)
  • test: sledgehammer a test (8b34be0)
  • tests: prevent dependency graph output file from being written (0d9c57e)
  • uikits: fix ui_builder_tests (e75f434)

Features

  • API: standardize v() and version() into a single call (6309e69)
  • uikits: add uikits to test config (43a2017)
  • uikits: additional test coverage (f5b60b2)
  • uikits: additional test coverage of the main API (fbcacfb)
  • uikits: clean each build directory if configured (8e11342)
  • uikits: copy pattern-specific javascript (3ac93dc)
  • uikits: create MVP output to disk (e1598d3)
  • uikits: filter out excluded pattern states from uikit output (87c9d0d)
  • uikits: load uikits before build (4565202)
  • uikits: output assets and annotations to each location (b0a84ca)
  • uikits: output pattern files to each location (5df87b0)
  • uikits: promote dependencyGraph.json output to root (dd3e708)
  • uikits: render header and footer data correctly (f2a6f23)
  • uikits: support incremental builds (6670364)
  • uikits: support watched-asset copying (4f05311)
  • uikits: uikits config to default (a393851)

BREAKING CHANGES

  • API: change version() to return a string representation of the version, removing v()

3.0.0-alpha.11 (2018-03-21)

Bug Fixes

  • changes_hunter: guard for incrementalRebuild while watching (c652b9c), closes #794 #802
  • data_loader: look for exact name of the file passed in (eb46be2)
  • get: add internal ability to omit missing pattern warning (e3dddc6), closes #786
  • lint: run code through prettier (ca52fde), closes #825
  • package: update LICENSE (337aa32)
  • tests: Revert annotations file back to expected legacy format (3618f27)

Features

  • package: standardize and hoist common devDependencies (7f4ce6f)

3.0.0-alpha.10 (2018-03-05)

Bug Fixes

  • config: Add npm registry to lerna config (1473cd5)
  • config: update patch to uikit files (5ccd0d2)
  • package: clarify description of package (c65611e)

Features

  • README: Update for brevity and consistency (aec7c50)

3.0.0-alpha.9 (2018-03-02)

Bug Fixes

  • core: Fix tests (31d67a7)
  • packages: Allow scoped publishing (58beeb6)

Features

  • core: Add tests for help command (62cd8fb)
  • package: Hoist up tap and test command. (6cacdb6)
  • packages: Update all package.json repo and bug links (5eb2c11)

3.0.0-alpha.8 (2018-02-22)

Bug Fixes

  • asset copy: Resolve paths correctly. Break apart files & asyncify (379419c)
  • event emission: Commit failing test (12ccbd7)
  • event emission: Only listen once to changes (ea6b7d3)
  • loadPattern: Check proper data file paths for modification (b7ba5b0)
  • package Update dependencies to reduce vulnerabilities (367d38f)
  • package: Update gitignore and npmignore with current files (581b3c4)
  • serve: Reference events by constants (9f5c143)
  • test configuration: Remove vestigial configuration entries (481fce9)
  • watchPatternLabFiles: Register and manager watchers (48f0190)

Features

  • docs: Add jsdoc output to public API and events (d45e7b9)
  • docs: Experiment with doc generation (8e1808b)
  • index: Make the cleaning of public/ an asynchronous adventure (bd485d2)
  • package: Communicate official node support (96ca87f)
  • pattern lab: Copy pattern-specific js (99bfc02)
  • pattern lab: Pass patternPartial as data to render (351ea5e)

3.0.0-alpha.7 (2018-01-19)

Bug Fixes

  • lint: Manually resolve final lint issues (7cad1f1)
  • README: Fix npm link instructions (ce3a7f0)
  • README: Update npm shield to point to scoped package (1f62617), closes #760
  • unit test: Fix path to fixture (b932f14)

Features

  • Contributing: Update contributing info with prettier (2a0ce52)
  • list_item_hunter: Re-work algorithm (1ac77a7)
  • package: Add prettier (b8e3e11)
  • package: Add prettier precommit hook (a0b85b5)
  • package: Add standard version (b2ba31c)
  • README: Add prettier badge (7c2787b)

Older releases found at https://github.com/pattern-lab/patternlab-node/wiki/ChangeLog