From 5d376a5cf2aaa903ea3c1be3aec901148ecbed8f Mon Sep 17 00:00:00 2001 From: Ringo De Smet Date: Wed, 2 Sep 2020 10:49:59 +0200 Subject: [PATCH 01/17] PatternLab loads the pattern engines from the config first, before fallback to scanning node_modules --- .../cli/test/fixtures/patternlab-config.json | 17 ++- packages/core/patternlab-config.json | 8 ++ packages/core/src/lib/pattern_engines.js | 103 ++++++++++++++---- .../core/test/util/patternlab-config.json | 15 +++ .../patternlab-config.json | 5 + .../patternlab-config.json | 14 +++ .../patternlab-config.json | 10 ++ .../docs/src/docs/advanced-config-options.md | 31 +++++- .../edition-node-gulp/patternlab-config.json | 8 ++ packages/edition-node/patternlab-config.json | 4 + packages/edition-twig/patternlab-config.json | 4 + .../patternlab-config.json | 4 + 12 files changed, 199 insertions(+), 24 deletions(-) diff --git a/packages/cli/test/fixtures/patternlab-config.json b/packages/cli/test/fixtures/patternlab-config.json index b59f39961..b1d33171a 100644 --- a/packages/cli/test/fixtures/patternlab-config.json +++ b/packages/cli/test/fixtures/patternlab-config.json @@ -83,5 +83,20 @@ "color": "dark", "density": "compact", "layout": "horizontal" - } + }, + "engines": { + "mustache": { + "package":"@pattern-lab/engine-mustache", + "fileExtensions": [ + "mustache" + ] + }, + "handlebars": { + "package": "@pattern-lab/engine-handlebars", + "fileExtensions": [ + "handlebars", + "hbs" + ] + } + }, } diff --git a/packages/core/patternlab-config.json b/packages/core/patternlab-config.json index 7a9a6fa47..8119021d3 100644 --- a/packages/core/patternlab-config.json +++ b/packages/core/patternlab-config.json @@ -88,6 +88,14 @@ "density": "compact", "layout": "horizontal" }, + "engines": { + "mustache": { + "package":"@pattern-lab/engine-mustache", + "fileExtensions": [ + "mustache" + ] + } + }, "uikits": [ { "name": "uikit-workshop", diff --git a/packages/core/src/lib/pattern_engines.js b/packages/core/src/lib/pattern_engines.js index cde010125..b41bd17a9 100644 --- a/packages/core/src/lib/pattern_engines.js +++ b/packages/core/src/lib/pattern_engines.js @@ -56,6 +56,19 @@ function findEngineModulesInDirectory(dir) { return foundEngines; } +function findEnginesInConfig(config) { + if ('engines' in config) { + return config.engines; + } + logger.warning( + "Scanning the 'node_modules' folder for pattern engines is deprecated and will be removed in v6." + ); + logger.warning( + 'To configure your engines in patternlab-config.json, see https://patternlab.io/docs/editing-the-configuration-options/#heading-engines' + ); + return null; +} + // // PatternEngines: the main export of this module // @@ -80,18 +93,14 @@ const PatternEngines = Object.create({ loadAllEngines: function(patternLabConfig) { const self = this; - // Try to load engines! We scan for engines at each path specified above. This - // function is kind of a big deal. - enginesDirectories.forEach(function(engineDirectory) { - const enginesInThisDir = findEngineModulesInDirectory( - engineDirectory.path - ); - - logger.debug(`Loading engines from ${engineDirectory.displayName}...`); + // Try to load engines! We load the engines configured in patternlab-config.json + const enginesInConfig = findEnginesInConfig(patternLabConfig); - // find all engine-named things in this directory and try to load them, - // unless it's already been loaded. - enginesInThisDir.forEach(function(engineDiscovery) { + if (enginesInConfig) { + // Try loading each of the configured pattern engines + // eslint-disable-next-line guard-for-in + for (const name in enginesInConfig) { + const engineConfig = enginesInConfig[name]; let errorMessage; const successMessage = 'good to go'; @@ -100,30 +109,80 @@ const PatternEngines = Object.create({ // of course. Also pass the pattern lab config object into // the engine's closure scope so it can know things about // things. - if (self[engineDiscovery.name]) { + if (self[name]) { throw new Error('already loaded, skipping.'); } - self[engineDiscovery.name] = require(engineDiscovery.modulePath); - if ( - typeof self[engineDiscovery.name].usePatternLabConfig === 'function' - ) { - self[engineDiscovery.name].usePatternLabConfig(patternLabConfig); - } - if (typeof self[engineDiscovery.name].spawnMeta === 'function') { - self[engineDiscovery.name].spawnMeta(patternLabConfig); + if ('package' in engineConfig) { + self[name] = require(engineConfig.package); + if (typeof self[name].usePatternLabConfig === 'function') { + self[name].usePatternLabConfig(patternLabConfig); + } + if (typeof self[name].spawnMeta === 'function') { + self[name].spawnMeta(patternLabConfig); + } + } else { + logger.warning( + `Engine ${name} not configured correctly. Please configure your engines in patternlab-config.json as documented in https://patternlab.io/docs/editing-the-configuration-options/#heading-engines` + ); } } catch (err) { errorMessage = err.message; } finally { // report on the status of the engine, one way or another! logger.info( - `Pattern Engine ${engineDiscovery.name}: ${ + `Pattern Engine ${engineConfig.extension}: ${ errorMessage ? errorMessage : successMessage }` ); } + } + } else { + // Try to load engines! We scan for engines at each path specified above. This + // function is kind of a big deal. + enginesDirectories.forEach(function(engineDirectory) { + const enginesInThisDir = findEngineModulesInDirectory( + engineDirectory.path + ); + + logger.debug(`Loading engines from ${engineDirectory.displayName}...`); + + // find all engine-named things in this directory and try to load them, + // unless it's already been loaded. + enginesInThisDir.forEach(function(engineDiscovery) { + let errorMessage; + const successMessage = 'good to go'; + + try { + // Give it a try! load 'er up. But not if we already have, + // of course. Also pass the pattern lab config object into + // the engine's closure scope so it can know things about + // things. + if (self[engineDiscovery.name]) { + throw new Error('already loaded, skipping.'); + } + self[engineDiscovery.name] = require(engineDiscovery.modulePath); + if ( + typeof self[engineDiscovery.name].usePatternLabConfig === + 'function' + ) { + self[engineDiscovery.name].usePatternLabConfig(patternLabConfig); + } + if (typeof self[engineDiscovery.name].spawnMeta === 'function') { + self[engineDiscovery.name].spawnMeta(patternLabConfig); + } + } catch (err) { + errorMessage = err.message; + } finally { + // report on the status of the engine, one way or another! + logger.info( + `Pattern Engine ${engineDiscovery.name}: ${ + errorMessage ? errorMessage : successMessage + }` + ); + } + }); }); - }); + } // Complain if for some reason we haven't loaded any engines. if (Object.keys(self).length === 0) { diff --git a/packages/core/test/util/patternlab-config.json b/packages/core/test/util/patternlab-config.json index 1d2e964f9..a793fded3 100644 --- a/packages/core/test/util/patternlab-config.json +++ b/packages/core/test/util/patternlab-config.json @@ -73,6 +73,21 @@ "density": "compact", "layout": "horizontal" }, + "engines": { + "mustache": { + "package":"@pattern-lab/engine-mustache", + "fileExtensions": [ + "mustache" + ] + }, + "handlebars": { + "package": "@pattern-lab/engine-handlebars", + "fileExtensions": [ + "handlebars", + "hbs" + ] + } + }, "uikits": [ { "name": "uikit-workshop", diff --git a/packages/development-edition-engine-handlebars/patternlab-config.json b/packages/development-edition-engine-handlebars/patternlab-config.json index 36546fb07..59957d9f9 100644 --- a/packages/development-edition-engine-handlebars/patternlab-config.json +++ b/packages/development-edition-engine-handlebars/patternlab-config.json @@ -95,6 +95,11 @@ ], "engines": { "handlebars": { + "package": "@pattern-lab/engine-handlebars", + "fileExtensions": [ + "handlebars", + "hbs" + ], "extend": "helpers/*.js" } }, diff --git a/packages/development-edition-engine-react/patternlab-config.json b/packages/development-edition-engine-react/patternlab-config.json index 106d0f983..42e1ffd91 100644 --- a/packages/development-edition-engine-react/patternlab-config.json +++ b/packages/development-edition-engine-react/patternlab-config.json @@ -87,5 +87,19 @@ "color": "dark", "density": "compact", "layout": "horizontal" + }, + "engines": { + "mustache": { + "package":"@pattern-lab/engine-mustache", + "fileExtensions": [ + "mustache" + ] + }, + "handlebars": { + "package": "@pattern-lab/engine-react", + "fileExtensions": [ + "jsx" + ] + } } } diff --git a/packages/development-edition-engine-twig/patternlab-config.json b/packages/development-edition-engine-twig/patternlab-config.json index 43761ce19..3e61d7025 100644 --- a/packages/development-edition-engine-twig/patternlab-config.json +++ b/packages/development-edition-engine-twig/patternlab-config.json @@ -103,7 +103,17 @@ } ], "engines": { + "mustache": { + "package":"@pattern-lab/engine-mustache", + "fileExtensions": [ + "mustache" + ] + }, "twig": { + "package": "@pattern-lab/engine-twig", + "fileExtensions": [ + "twig" + ], "namespaces": { "atoms": "source/_patterns/00-atoms/", "molecules": "source/_patterns/01-molecules/", diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index 7ae24fd00..26c451c37 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -164,6 +164,35 @@ Sets the panel name and language for the code tab on the styleguide. Since this **default**: `mustache` +### engines + +An engine is a wrapper around a templating library like Mustache, Handlebars, Twig or others. An engine package +is the bridge between PatternLab and the standalone NPM package supporting the templating language. + +`engines` accepts an map of Engine objects. The mandatory properties for each PatternLab engine are: + +- `package`: the NodeJS package name. Add the package of the engine as a dependency in `package.json` before you configure it here. +- `fileExtensions`: list of pattern file extensions which will be handled by this pattern engine. + +Other engine specific configuration options can be added and will be passed to the pattern engine at loading time. See the NPM package documentation for the properties each pattern engine supports. + +**default**: + +```javascript + "engines": { + "mustache": { + "package": "@pattern-lab/engine-mustache", + "extensions": [ + "mustache" + ], + ... + } + } +``` + +Configuring the engines in the config file was introduced in v5.14. The fallback lookup mode by scanning the +`node_modules` folder is **deprecated** will be removed in v6. + ### patternStateCascade See the [Pattern State Documentation](/docs/using-pattern-states/) @@ -336,7 +365,7 @@ Important details: - the [default `paths.source` object paths](https://github.com/pattern-lab/patternlab-node/pull/840/commits/a4961bd5d696a05fb516cdd951163b0f918d5e19) within `patternlab-config.json` are now relative to the current UIKit. See the [structure of uikit-workshop](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop) for more info - the [default `paths.public` object paths](https://github.com/pattern-lab/patternlab-node/pull/840/commits/812bab3659f504043e8b61b1dc1cdac71f248449) within `patternlab-config.json` are now relative to the current UIKit's `outputDir`. Absolute paths will no longer work. Someone could test putting an absolute path in a UIKit `outputDir` property and see what happens I suppose. - `dependencyGraph.json` has moved to the project root rather than `public/` as we should only retain one -- The lookup of the uikit by `name` is deprecated and the user will be notified of it. If the `package` property isn't defined, there is a default fallback lookup strategy where the value of `name` is tried as: +- The lookup of the uikit by `name` is **deprecated** and will be removed in v6. The user will be notified of it. If the `package` property isn't defined, there is a default fallback lookup strategy where the value of `name` is tried as: - `` - `uikit-` - `@pattern-lab/` diff --git a/packages/edition-node-gulp/patternlab-config.json b/packages/edition-node-gulp/patternlab-config.json index 616402756..499b513e7 100644 --- a/packages/edition-node-gulp/patternlab-config.json +++ b/packages/edition-node-gulp/patternlab-config.json @@ -87,6 +87,14 @@ "density": "compact", "layout": "horizontal" }, + "engines": { + "mustache": { + "package": "@pattern-lab/engine-mustache", + "fileExtensions": [ + "mustache" + ] + } + }, "uikits": [ { "name": "uikit-workshop", diff --git a/packages/edition-node/patternlab-config.json b/packages/edition-node/patternlab-config.json index d6df1cb46..86f7cf1d0 100644 --- a/packages/edition-node/patternlab-config.json +++ b/packages/edition-node/patternlab-config.json @@ -99,6 +99,10 @@ ], "engines": { "handlebars": { + "package": "@pattern-lab/engine-handlebars", + "fileExtensions": [ + "hbs" + ], "extend": "helpers/*.js" } } diff --git a/packages/edition-twig/patternlab-config.json b/packages/edition-twig/patternlab-config.json index 58d633830..746bd1990 100644 --- a/packages/edition-twig/patternlab-config.json +++ b/packages/edition-twig/patternlab-config.json @@ -1,6 +1,10 @@ { "engines": { "twig": { + "package": "@pattern-lab/engine-twig-php", + "fileExtensions": [ + "twig" + ], "namespaces": [ { "id": "uikit", diff --git a/packages/starterkit-twig-demo/patternlab-config.json b/packages/starterkit-twig-demo/patternlab-config.json index a64cf1040..7f05d86c1 100644 --- a/packages/starterkit-twig-demo/patternlab-config.json +++ b/packages/starterkit-twig-demo/patternlab-config.json @@ -1,6 +1,10 @@ { "engines": { "twig": { + "package": "@pattern-lab/engine-twig-php", + "fileExtensions": [ + "twig" + ], "namespaces": [ { "id": "atoms", From 06463735f595e1764b011fd18a7791dfe6639e21 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 14:42:13 +0100 Subject: [PATCH 02/17] chore: wording and headline structure --- packages/docs/src/docs/advanced-config-options.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index c12fdd4c0..b2942615f 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -180,12 +180,12 @@ Sets the panel name and language for the code tab on the styleguide. Since this **default**: `mustache` -### engines +## engines An engine is a wrapper around a templating library like Mustache, Handlebars, Twig or others. An engine package -is the bridge between PatternLab and the standalone NPM package supporting the templating language. +is the bridge between Pattern Lab and the standalone NPM package supporting the templating language. -`engines` accepts an map of Engine objects. The mandatory properties for each PatternLab engine are: +`engines` accepts an map of Engine objects. The mandatory properties for each Pattern Lab engine are: - `package`: the NodeJS package name. Add the package of the engine as a dependency in `package.json` before you configure it here. - `fileExtensions`: list of pattern file extensions which will be handled by this pattern engine. From 297d251e4aeba6a583381c224815d125733ed840 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 15:11:57 +0100 Subject: [PATCH 03/17] chore: wording --- packages/core/src/lib/pattern_engines.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/lib/pattern_engines.js b/packages/core/src/lib/pattern_engines.js index 0785291e2..53c6f1de3 100644 --- a/packages/core/src/lib/pattern_engines.js +++ b/packages/core/src/lib/pattern_engines.js @@ -112,7 +112,7 @@ const PatternEngines = Object.create({ try { // Give it a try! load 'er up. But not if we already have, - // of course. Also pass the pattern lab config object into + // of course. Also pass the Pattern Lab config object into // the engine's closure scope so it can know things about // things. if (self[name]) { @@ -160,7 +160,7 @@ const PatternEngines = Object.create({ try { // Give it a try! load 'er up. But not if we already have, - // of course. Also pass the pattern lab config object into + // of course. Also pass the Pattern Lab config object into // the engine's closure scope so it can know things about // things. if (self[engineDiscovery.name]) { From 092fd18a30505af263161605958ec55cf413800d Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 15:18:49 +0100 Subject: [PATCH 04/17] docs: further clarification through logging --- packages/core/src/lib/pattern_engines.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/lib/pattern_engines.js b/packages/core/src/lib/pattern_engines.js index 53c6f1de3..421e69dbb 100644 --- a/packages/core/src/lib/pattern_engines.js +++ b/packages/core/src/lib/pattern_engines.js @@ -136,7 +136,7 @@ const PatternEngines = Object.create({ } finally { // report on the status of the engine, one way or another! logger.info( - `Pattern Engine ${engineConfig.extension}: ${ + `Pattern Engine ${name} / package ${engineConfig.package}: ${ errorMessage ? errorMessage : successMessage }` ); @@ -181,7 +181,9 @@ const PatternEngines = Object.create({ } finally { // report on the status of the engine, one way or another! logger.info( - `Pattern Engine ${engineDiscovery.name}: ${ + `Pattern Engine ${ + engineDiscovery.name + } by discovery (deprecated): ${ errorMessage ? errorMessage : successMessage }` ); From 0bec8bdf67c87e0867c81c104daf5c60780f69ac Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 15:20:37 +0100 Subject: [PATCH 05/17] fix: configuration --- .../development-edition-engine-react/patternlab-config.json | 2 +- packages/edition-node/patternlab-config.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/development-edition-engine-react/patternlab-config.json b/packages/development-edition-engine-react/patternlab-config.json index 96f005fa6..01441ffa2 100644 --- a/packages/development-edition-engine-react/patternlab-config.json +++ b/packages/development-edition-engine-react/patternlab-config.json @@ -95,7 +95,7 @@ "mustache" ] }, - "handlebars": { + "react": { "package": "@pattern-lab/engine-react", "fileExtensions": [ "jsx" diff --git a/packages/edition-node/patternlab-config.json b/packages/edition-node/patternlab-config.json index c09a47ce6..1296ff103 100644 --- a/packages/edition-node/patternlab-config.json +++ b/packages/edition-node/patternlab-config.json @@ -101,6 +101,7 @@ "handlebars": { "package": "@pattern-lab/engine-handlebars", "fileExtensions": [ + "handlebars", "hbs" ], "extend": "helpers/*.js" From a13c2656832ba9fd8e4a2437dfa984fdb2121a84 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 15:30:39 +0100 Subject: [PATCH 06/17] docs: let's get rid of that old mustache engine --- packages/docs/src/docs/advanced-config-options.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index b2942615f..c545333cb 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -196,10 +196,11 @@ Other engine specific configuration options can be added and will be passed to t ```javascript "engines": { - "mustache": { - "package": "@pattern-lab/engine-mustache", + "handlebars": { + "package": "@pattern-lab/engine-handlebars", "extensions": [ - "mustache" + "handlebars", + "hbs" ], ... } From 99177b0c4da9368d252dfde53677d53fee157680 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 15:59:03 +0100 Subject: [PATCH 07/17] refactor: we should only include the outdated mustache engine interally, but not publicly facing any more --- packages/cli/test/fixtures/patternlab-config.json | 11 +++-------- packages/core/patternlab-config.json | 10 ++++++---- packages/core/src/lib/pattern_engines.js | 8 ++++++++ packages/core/test/util/patternlab-config.json | 9 ++------- .../patternlab-config.json | 6 ------ .../patternlab-config.json | 6 ------ packages/edition-node-gulp/patternlab-config.json | 9 +++++---- 7 files changed, 24 insertions(+), 35 deletions(-) diff --git a/packages/cli/test/fixtures/patternlab-config.json b/packages/cli/test/fixtures/patternlab-config.json index a290fe4e6..c08a26241 100644 --- a/packages/cli/test/fixtures/patternlab-config.json +++ b/packages/cli/test/fixtures/patternlab-config.json @@ -85,18 +85,13 @@ "layout": "horizontal" }, "engines": { - "mustache": { - "package":"@pattern-lab/engine-mustache", - "fileExtensions": [ - "mustache" - ] - }, "handlebars": { "package": "@pattern-lab/engine-handlebars", "fileExtensions": [ "handlebars", "hbs" - ] + ], + "extend": "helpers/*.js" } - }, + } } diff --git a/packages/core/patternlab-config.json b/packages/core/patternlab-config.json index 1720497ce..d3022f24b 100644 --- a/packages/core/patternlab-config.json +++ b/packages/core/patternlab-config.json @@ -89,11 +89,13 @@ "layout": "horizontal" }, "engines": { - "mustache": { - "package":"@pattern-lab/engine-mustache", + "handlebars": { + "package": "@pattern-lab/engine-handlebars", "fileExtensions": [ - "mustache" - ] + "handlebars", + "hbs" + ], + "extend": "helpers/*.js" } }, "uikits": [ diff --git a/packages/core/src/lib/pattern_engines.js b/packages/core/src/lib/pattern_engines.js index 421e69dbb..b3a26cb91 100644 --- a/packages/core/src/lib/pattern_engines.js +++ b/packages/core/src/lib/pattern_engines.js @@ -103,6 +103,14 @@ const PatternEngines = Object.create({ const enginesInConfig = findEnginesInConfig(patternLabConfig); if (enginesInConfig) { + // Quick fix until we've removed @pattern-lab/engine-mustache + // @TODO: Remove after removing @pattern-lab/engine-mustache dependency + enginesInConfig.mustache = enginesInConfig.mustache || {}; + enginesInConfig.mustache.package = + enginesInConfig.mustache.package || '@pattern-lab/engine-mustache'; + enginesInConfig.mustache.extensions = + enginesInConfig.mustache.extensions || 'mustache'; + // Try loading each of the configured pattern engines // eslint-disable-next-line guard-for-in for (const name in enginesInConfig) { diff --git a/packages/core/test/util/patternlab-config.json b/packages/core/test/util/patternlab-config.json index 6d4eb285a..e101b2ad4 100644 --- a/packages/core/test/util/patternlab-config.json +++ b/packages/core/test/util/patternlab-config.json @@ -74,18 +74,13 @@ "layout": "horizontal" }, "engines": { - "mustache": { - "package":"@pattern-lab/engine-mustache", - "fileExtensions": [ - "mustache" - ] - }, "handlebars": { "package": "@pattern-lab/engine-handlebars", "fileExtensions": [ "handlebars", "hbs" - ] + ], + "extend": "helpers/*.js" } }, "uikits": [ diff --git a/packages/development-edition-engine-react/patternlab-config.json b/packages/development-edition-engine-react/patternlab-config.json index 01441ffa2..23f8673e8 100644 --- a/packages/development-edition-engine-react/patternlab-config.json +++ b/packages/development-edition-engine-react/patternlab-config.json @@ -89,12 +89,6 @@ "layout": "horizontal" }, "engines": { - "mustache": { - "package":"@pattern-lab/engine-mustache", - "fileExtensions": [ - "mustache" - ] - }, "react": { "package": "@pattern-lab/engine-react", "fileExtensions": [ diff --git a/packages/development-edition-engine-twig/patternlab-config.json b/packages/development-edition-engine-twig/patternlab-config.json index 089ebee6d..8fba803bd 100644 --- a/packages/development-edition-engine-twig/patternlab-config.json +++ b/packages/development-edition-engine-twig/patternlab-config.json @@ -103,12 +103,6 @@ } ], "engines": { - "mustache": { - "package":"@pattern-lab/engine-mustache", - "fileExtensions": [ - "mustache" - ] - }, "twig": { "package": "@pattern-lab/engine-twig", "fileExtensions": [ diff --git a/packages/edition-node-gulp/patternlab-config.json b/packages/edition-node-gulp/patternlab-config.json index 4f6426b54..b6effe071 100644 --- a/packages/edition-node-gulp/patternlab-config.json +++ b/packages/edition-node-gulp/patternlab-config.json @@ -88,11 +88,12 @@ "layout": "horizontal" }, "engines": { - "mustache": { - "package": "@pattern-lab/engine-mustache", + "handlebars": { + "package": "@pattern-lab/engine-handlebars", "fileExtensions": [ - "mustache" - ] + "handlebars" + ], + "extend": "helpers/*.js" } }, "uikits": [ From 2f44441c07b2b54658c03fca4a3e544f54066ab8 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 15:59:18 +0100 Subject: [PATCH 08/17] chore: adapted that entry from the other places --- packages/docs/src/docs/advanced-config-options.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index c545333cb..2c75b841c 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -202,6 +202,7 @@ Other engine specific configuration options can be added and will be passed to t "handlebars", "hbs" ], + "extend": "helpers/*.js" ... } } From b8014f9902777cab53faa08af5daada02c094edf Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 16:02:06 +0100 Subject: [PATCH 09/17] chore: let's not mention mustache any more --- packages/docs/src/docs/advanced-config-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index 2c75b841c..e99d601d4 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -182,7 +182,7 @@ Sets the panel name and language for the code tab on the styleguide. Since this ## engines -An engine is a wrapper around a templating library like Mustache, Handlebars, Twig or others. An engine package +An engine is a wrapper around a templating library like Handlebars, Twig or others. An engine package is the bridge between Pattern Lab and the standalone NPM package supporting the templating language. `engines` accepts an map of Engine objects. The mandatory properties for each Pattern Lab engine are: From b06ff5760f3e8d56718af6dcd3ba338589730be7 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 16:02:57 +0100 Subject: [PATCH 10/17] docs: wording --- packages/docs/src/docs/advanced-config-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index e99d601d4..8c3f81947 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -209,7 +209,7 @@ Other engine specific configuration options can be added and will be passed to t ``` Configuring the engines in the config file was introduced in v5.14. The fallback lookup mode by scanning the -`node_modules` folder is **deprecated** will be removed in v6. +`node_modules` folder is **deprecated** and will be removed in Pattern Lab v6. ## patternStateCascade From 1b8f263e4001fd9c4728f52a759d044461f4b14e Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 16:10:37 +0100 Subject: [PATCH 11/17] docs: added a link --- packages/docs/src/docs/advanced-config-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index 8c3f81947..988831820 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -182,7 +182,7 @@ Sets the panel name and language for the code tab on the styleguide. Since this ## engines -An engine is a wrapper around a templating library like Handlebars, Twig or others. An engine package +An engine is a wrapper around a templating library like Handlebars, Twig or others. An [engine package](docs/template-language-and-patternengines/) is the bridge between Pattern Lab and the standalone NPM package supporting the templating language. `engines` accepts an map of Engine objects. The mandatory properties for each Pattern Lab engine are: From 1799481c04849d81568a91fa391f8bbbf737570e Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Sat, 24 Dec 2022 16:12:46 +0100 Subject: [PATCH 12/17] chore: added relevant comment --- packages/core/src/lib/pattern_engines.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/lib/pattern_engines.js b/packages/core/src/lib/pattern_engines.js index b3a26cb91..c5b1bcfcb 100644 --- a/packages/core/src/lib/pattern_engines.js +++ b/packages/core/src/lib/pattern_engines.js @@ -103,7 +103,7 @@ const PatternEngines = Object.create({ const enginesInConfig = findEnginesInConfig(patternLabConfig); if (enginesInConfig) { - // Quick fix until we've removed @pattern-lab/engine-mustache + // Quick fix until we've removed @pattern-lab/engine-mustache, starting with https://github.com/pattern-lab/patternlab-node/issues/1239 // @TODO: Remove after removing @pattern-lab/engine-mustache dependency enginesInConfig.mustache = enginesInConfig.mustache || {}; enginesInConfig.mustache.package = From a6d50ebde3359dad18a69897cc643f566064a741 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Wed, 28 Dec 2022 07:06:57 +0100 Subject: [PATCH 13/17] Update patternlab-config.json --- packages/edition-node-gulp/patternlab-config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/edition-node-gulp/patternlab-config.json b/packages/edition-node-gulp/patternlab-config.json index b6effe071..7a6e89dd8 100644 --- a/packages/edition-node-gulp/patternlab-config.json +++ b/packages/edition-node-gulp/patternlab-config.json @@ -91,7 +91,8 @@ "handlebars": { "package": "@pattern-lab/engine-handlebars", "fileExtensions": [ - "handlebars" + "handlebars", + "hbs" ], "extend": "helpers/*.js" } From 02a60958aa0f13d49c38653a4916918ec5d06d9d Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Wed, 28 Dec 2022 07:57:29 +0100 Subject: [PATCH 14/17] Restore packages/core/test/files/_handlebars-test-patterns/atoms/global/helloworld-withdata.hbs --- .../atoms/global/helloworld-withdata.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/test/files/_handlebars-test-patterns/atoms/global/helloworld-withdata.hbs b/packages/core/test/files/_handlebars-test-patterns/atoms/global/helloworld-withdata.hbs index 81bc7229a..30c6ff45a 100644 --- a/packages/core/test/files/_handlebars-test-patterns/atoms/global/helloworld-withdata.hbs +++ b/packages/core/test/files/_handlebars-test-patterns/atoms/global/helloworld-withdata.hbs @@ -1,2 +1,2 @@ Hello world! -{{subtitle}} \ No newline at end of file +{{subtitle}} From a9246db6de5ffd88c97094d0372081f0ff2fb4f4 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Thu, 29 Dec 2022 20:40:06 +0100 Subject: [PATCH 15/17] Update advanced-config-options.md --- packages/docs/src/docs/advanced-config-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index 988831820..b0c51dc7b 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -209,7 +209,7 @@ Other engine specific configuration options can be added and will be passed to t ``` Configuring the engines in the config file was introduced in v5.14. The fallback lookup mode by scanning the -`node_modules` folder is **deprecated** and will be removed in Pattern Lab v6. +`node_modules` folder is **deprecated** and will be removed in Pattern Lab v7. ## patternStateCascade From 16ab16026dc8d7fdab89c6080e37d6a8bc7b3f23 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Fri, 30 Dec 2022 01:28:51 +0100 Subject: [PATCH 16/17] Update pattern_engines.js --- packages/core/src/lib/pattern_engines.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/lib/pattern_engines.js b/packages/core/src/lib/pattern_engines.js index c5b1bcfcb..a719d5f22 100644 --- a/packages/core/src/lib/pattern_engines.js +++ b/packages/core/src/lib/pattern_engines.js @@ -103,7 +103,7 @@ const PatternEngines = Object.create({ const enginesInConfig = findEnginesInConfig(patternLabConfig); if (enginesInConfig) { - // Quick fix until we've removed @pattern-lab/engine-mustache, starting with https://github.com/pattern-lab/patternlab-node/issues/1239 + // Quick fix until we've removed @pattern-lab/engine-mustache, starting with https://github.com/pattern-lab/patternlab-node/issues/1239 & https://github.com/pattern-lab/patternlab-node/pull/1455 // @TODO: Remove after removing @pattern-lab/engine-mustache dependency enginesInConfig.mustache = enginesInConfig.mustache || {}; enginesInConfig.mustache.package = From d328a407d9980c9ef77950b809c525c35f24eb0e Mon Sep 17 00:00:00 2001 From: Josef Bredreck <13408112+JosefBredereck@users.noreply.github.com> Date: Fri, 30 Dec 2022 17:53:53 +0100 Subject: [PATCH 17/17] Update packages/docs/src/docs/advanced-config-options.md --- packages/docs/src/docs/advanced-config-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/docs/advanced-config-options.md b/packages/docs/src/docs/advanced-config-options.md index b0c51dc7b..4665c35ca 100644 --- a/packages/docs/src/docs/advanced-config-options.md +++ b/packages/docs/src/docs/advanced-config-options.md @@ -433,7 +433,7 @@ Important details: - the [default `paths.source` object paths](https://github.com/pattern-lab/patternlab-node/pull/840/commits/a4961bd5d696a05fb516cdd951163b0f918d5e19) within `patternlab-config.json` are now relative to the current UIKit. See the [structure of uikit-workshop](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop) for more info - the [default `paths.public` object paths](https://github.com/pattern-lab/patternlab-node/pull/840/commits/812bab3659f504043e8b61b1dc1cdac71f248449) within `patternlab-config.json` are now relative to the current UIKit's `outputDir`. Absolute paths will no longer work. Someone could test putting an absolute path in a UIKit `outputDir` property and see what happens I suppose. - `dependencyGraph.json` has moved to the project root rather than `public/` as we should only retain one -- The lookup of the uikit by `name` is **deprecated** and will be removed in v6. The user will be notified of it. If the `package` property isn't defined, there is a default fallback lookup strategy where the value of `name` is tried as: +- The lookup of the uikit by `name` is **deprecated** and will be removed in v7. The user will be notified of it. If the `package` property isn't defined, there is a default fallback lookup strategy where the value of `name` is tried as: - `` - `uikit-` - `@pattern-lab/`