From f061aad583d73769ceb79a58366f115302209a32 Mon Sep 17 00:00:00 2001 From: Dan White Date: Wed, 29 Aug 2018 14:23:55 -0700 Subject: [PATCH 1/8] Set noCache = true on Nunjucks env, so restarts are not needed so often --- packages/engine-nunjucks/lib/engine_nunjucks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/engine-nunjucks/lib/engine_nunjucks.js b/packages/engine-nunjucks/lib/engine_nunjucks.js index 92f5acb7e..5cfc4f803 100644 --- a/packages/engine-nunjucks/lib/engine_nunjucks.js +++ b/packages/engine-nunjucks/lib/engine_nunjucks.js @@ -39,6 +39,7 @@ PatternLoader.prototype.getSource = function(name) { return { src: fs.readFileSync(fullPath, 'utf-8'), path: fullPath, + noCache: true }; }; From 454095d0f8d9ec08a674eade8594485c78003288 Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 07:33:45 -0500 Subject: [PATCH 2/8] feat(package): add handlebars development edition --- .../.gitignore | 9 ++ .../.npmrc | 2 + .../README.md | 12 +++ .../package.json | 32 +++++++ .../patternlab-config.json | 89 ++++++++++++++++++ .../source/_annotations/annotations.json | 3 + .../source/_data/data.json | 34 +++++++ .../source/_data/listitems.json | 6 ++ .../source/_meta/README.md | 5 + .../source/_meta/_00-head.hbs | 19 ++++ .../source/_meta/_00-head.mustache | 17 ++++ .../source/_meta/_01-foot.hbs | 6 ++ .../source/_meta/_01-foot.mustache | 6 ++ .../_patterns/atoms/swatches/swatch.hbs | 5 + .../_patterns/atoms/swatches/swatch.json | 7 ++ .../source/_patterns/atoms/swatches/swatch.md | 1 + .../source/_patterns/atoms/type.md | 1 + .../_patterns/atoms/type/annotation.hbs | 1 + .../source/_patterns/molecules/variants.md | 1 + .../_patterns/molecules/variants/swatches.hbs | 8 ++ .../_patterns/molecules/variants/swatches.md | 1 + .../source/css/pattern-scaffolding.css | 52 ++++++++++ .../source/css/style.css | 3 + .../source/favicon.ico | Bin 0 -> 32988 bytes 24 files changed, 320 insertions(+) create mode 100644 packages/development-edition-engine-handlebars/.gitignore create mode 100644 packages/development-edition-engine-handlebars/.npmrc create mode 100644 packages/development-edition-engine-handlebars/README.md create mode 100644 packages/development-edition-engine-handlebars/package.json create mode 100644 packages/development-edition-engine-handlebars/patternlab-config.json create mode 100644 packages/development-edition-engine-handlebars/source/_annotations/annotations.json create mode 100644 packages/development-edition-engine-handlebars/source/_data/data.json create mode 100644 packages/development-edition-engine-handlebars/source/_data/listitems.json create mode 100644 packages/development-edition-engine-handlebars/source/_meta/README.md create mode 100644 packages/development-edition-engine-handlebars/source/_meta/_00-head.hbs create mode 100644 packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache create mode 100644 packages/development-edition-engine-handlebars/source/_meta/_01-foot.hbs create mode 100644 packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.hbs create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.json create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.md create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/atoms/type.md create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/atoms/type/annotation.hbs create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/molecules/variants.md create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.hbs create mode 100644 packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.md create mode 100644 packages/development-edition-engine-handlebars/source/css/pattern-scaffolding.css create mode 100644 packages/development-edition-engine-handlebars/source/css/style.css create mode 100644 packages/development-edition-engine-handlebars/source/favicon.ico diff --git a/packages/development-edition-engine-handlebars/.gitignore b/packages/development-edition-engine-handlebars/.gitignore new file mode 100644 index 000000000..0679bd2b5 --- /dev/null +++ b/packages/development-edition-engine-handlebars/.gitignore @@ -0,0 +1,9 @@ +node_modules/ +.DS_Store +patternlab.json +.sass-cache/* +/sass-cache +Thumbs.db +.idea/ +public +dependencyGraph.json diff --git a/packages/development-edition-engine-handlebars/.npmrc b/packages/development-edition-engine-handlebars/.npmrc new file mode 100644 index 000000000..ce73f58bf --- /dev/null +++ b/packages/development-edition-engine-handlebars/.npmrc @@ -0,0 +1,2 @@ +package-lock=false +save-exact=true diff --git a/packages/development-edition-engine-handlebars/README.md b/packages/development-edition-engine-handlebars/README.md new file mode 100644 index 000000000..722416c2a --- /dev/null +++ b/packages/development-edition-engine-handlebars/README.md @@ -0,0 +1,12 @@ +![Pattern Lab Logo](/patternlab.png "Pattern Lab Logo") + +# Pattern Lab Node - Development Edition Engine Handlebars + +_here be dragons_ + +This Development Edition is a variant of [Edition Node](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node) for convience purposes only, loaded with the Handlebars Engine. The goals of this Development Edition are two-fold: + +* Develop the [Handlebars Engine](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars) +* Build and test against Handlebars pattern tree + +> Development Editions of Pattern Lab provide the ability to work on and commit changes to select packages within the overall Pattern Lab [ecosystem](http://patternlab.io/docs/advanced-ecosystem-overview.html). This Edition is NOT stable. diff --git a/packages/development-edition-engine-handlebars/package.json b/packages/development-edition-engine-handlebars/package.json new file mode 100644 index 000000000..5b9ba1312 --- /dev/null +++ b/packages/development-edition-engine-handlebars/package.json @@ -0,0 +1,32 @@ +{ + "name": "@pattern-lab/development-edition-engine-handlebars", + "private": true, + "version": "0.0.0", + "description": "The tree of components we use to test, develop and validate the Handlebars engine", + "scripts": { + "pl:build": "patternlab build --config ./patternlab-config.json", + "pl:help": "patternlab --help", + "pl:install": "patternlab install --config ./patternlab-config.json", + "pl:serve": "patternlab serve --config ./patternlab-config.json", + "pl:version": "patternlab --version" + }, + "keywords": ["Pattern Lab", + "Atomic Web Design", + "Node", + "Handlebars", + "Edition"], + "author": "Brian Muenzenmeye", + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/pattern-lab/patternlab-node.git" + }, + "dependencies": { + "@pattern-lab/cli": "^0.0.1-beta.0", + "@pattern-lab/core": "^3.0.0-beta.0", + "@pattern-lab/engine-handlebars": "^2.0.0-beta.0", + "@pattern-lab/engine-mustache": "^2.0.0-beta.0", + "@pattern-lab/starterkit-mustache-demo": "^5.0.0", + "@pattern-lab/uikit-workshop": "^1.0.0-beta.0" + } +} diff --git a/packages/development-edition-engine-handlebars/patternlab-config.json b/packages/development-edition-engine-handlebars/patternlab-config.json new file mode 100644 index 000000000..dae655991 --- /dev/null +++ b/packages/development-edition-engine-handlebars/patternlab-config.json @@ -0,0 +1,89 @@ +{ + "cacheBust": true, + "cleanPublic": true, + "defaultPattern": "all", + "defaultShowPatternInfo": false, + "ishControlsHide": { + "s": true, + "m": true, + "l": true, + "full": false, + "random": true, + "disco": true, + "hay": true, + "mqs": true, + "find": true, + "views-all": false, + "views-annotations": false, + "views-code": false, + "views-new": false, + "tools-all": false, + "tools-docs": false + }, + "ishViewportRange": { + "s": [240, 500], + "m": [500, 800], + "l": [800, 2600] + }, + "logLevel": "info", + "outputFileSuffixes": { + "rendered": ".rendered", + "rawTemplate": "", + "markupOnly": ".markup-only" + }, + "paths": { + "source": { + "root": "source/", + "patterns": "source/_patterns/", + "data": "source/_data/", + "meta": "source/_meta/", + "annotations": "source/_annotations/", + "styleguide": "dist/", + "patternlabFiles": { + "general-header": "views/partials/general-header.mustache", + "general-footer": "views/partials/general-footer.mustache", + "patternSection": "views/partials/patternSection.mustache", + "patternSectionSubtype": "views/partials/patternSectionSubtype.mustache", + "viewall": "views/viewall.mustache" + }, + "js": "source/js", + "images": "source/images", + "fonts": "source/fonts", + "css": "source/css" + }, + "public": { + "root": "public/", + "patterns": "public/patterns/", + "data": "public/styleguide/data/", + "annotations": "public/annotations/", + "styleguide": "public/styleguide/", + "js": "public/js", + "images": "public/images", + "fonts": "public/fonts", + "css": "public/css" + } + }, + "patternExtension": "hbs", + "patternStateCascade": ["inprogress", "inreview", "complete"], + "patternExportDirectory": "pattern_exports", + "patternExportPatternPartials": [], + "serverOptions": { + "wait": 1000 + }, + "starterkitSubDir": "dist", + "styleGuideExcludes": [], + "theme": { + "color": "dark", + "density": "compact", + "layout": "horizontal" + }, + "uikits": [ + { + "name": "uikit-workshop", + "outputDir": "", + "enabled": true, + "excludedPatternStates": [], + "excludedTags": [] + } + ] +} diff --git a/packages/development-edition-engine-handlebars/source/_annotations/annotations.json b/packages/development-edition-engine-handlebars/source/_annotations/annotations.json new file mode 100644 index 000000000..a0d0268f8 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_annotations/annotations.json @@ -0,0 +1,3 @@ +{ + "comments": [] +} diff --git a/packages/development-edition-engine-handlebars/source/_data/data.json b/packages/development-edition-engine-handlebars/source/_data/data.json new file mode 100644 index 000000000..250376db0 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_data/data.json @@ -0,0 +1,34 @@ +{ + "version": "2", + "swatches": [ + { + "color": { + "hex": "#031636", + "cmyk": "94 59 0 79" + }, + "label": "dark blue" + }, + { + "color": { + "hex": "#0D80F0", + "cmyk": "95 47 0 6" + }, + "label": "light blue" + }, + { + "color": { + "hex": "#4c4c4c", + "cmyk": "0 0 0 70" + }, + "label": "dark grey" + }, + { + "color": { + "hex": "#b2b2b2", + "cmyk": "0 0 0 30" + }, + "label": "light grey", + "inverted": true + } + ] +} diff --git a/packages/development-edition-engine-handlebars/source/_data/listitems.json b/packages/development-edition-engine-handlebars/source/_data/listitems.json new file mode 100644 index 000000000..c35d1076d --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_data/listitems.json @@ -0,0 +1,6 @@ +{ + "1": {}, + "2": {}, + "3": {}, + "4": {} +} diff --git a/packages/development-edition-engine-handlebars/source/_meta/README.md b/packages/development-edition-engine-handlebars/source/_meta/README.md new file mode 100644 index 000000000..c6c8c3b8e --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_meta/README.md @@ -0,0 +1,5 @@ +This is the default location to place meta files, otherwise known a pattern's header and footer. + +Pattern Lab builds each pattern while prepending and appending the header and footer. Read more about [pattern headers and footers](http://patternlab.io/docs/pattern-header-footer.html). + +If you wish to rename this directory, make sure you update the `paths.source.meta` property within `patternlab-config.json`. diff --git a/packages/development-edition-engine-handlebars/source/_meta/_00-head.hbs b/packages/development-edition-engine-handlebars/source/_meta/_00-head.hbs new file mode 100644 index 000000000..9058b6521 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_meta/_00-head.hbs @@ -0,0 +1,19 @@ + + + + + {{ title }} + + + + + + + + + {{{ patternLabHead }}} + + + + + diff --git a/packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache b/packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache new file mode 100644 index 000000000..45ce3bb7d --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache @@ -0,0 +1,17 @@ + + + + {{ title }} + + + + + + + + {{{ patternLabHead }}} + + + + + diff --git a/packages/development-edition-engine-handlebars/source/_meta/_01-foot.hbs b/packages/development-edition-engine-handlebars/source/_meta/_01-foot.hbs new file mode 100644 index 000000000..797d9418d --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_meta/_01-foot.hbs @@ -0,0 +1,6 @@ + + +{{{ patternLabFoot }}} + + + diff --git a/packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache b/packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache new file mode 100644 index 000000000..797d9418d --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache @@ -0,0 +1,6 @@ + + +{{{ patternLabFoot }}} + + + diff --git a/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.hbs b/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.hbs new file mode 100644 index 000000000..804dcbfe5 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.hbs @@ -0,0 +1,5 @@ +
+ {{label}} + hex: {{color.hex}} + cmyk: {{color.cmyk}} +
diff --git a/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.json b/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.json new file mode 100644 index 000000000..15d3872ba --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.json @@ -0,0 +1,7 @@ +{ + "color": { + "hex": "#031636", + "cmyk": "94 59 0 79" + }, + "label": "dark blue" +} diff --git a/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.md b/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.md new file mode 100644 index 000000000..3f2d7ea0f --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/atoms/swatches/swatch.md @@ -0,0 +1 @@ +Pattern Lab Tip: Note the use of the [built-in handlebars helper, `if`](https://handlebarsjs.com/builtin_helpers.html) and the ability to address data using dot notation [paths](https://handlebarsjs.com/#paths). diff --git a/packages/development-edition-engine-handlebars/source/_patterns/atoms/type.md b/packages/development-edition-engine-handlebars/source/_patterns/atoms/type.md new file mode 100644 index 000000000..245bc9dcd --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/atoms/type.md @@ -0,0 +1 @@ +Type diff --git a/packages/development-edition-engine-handlebars/source/_patterns/atoms/type/annotation.hbs b/packages/development-edition-engine-handlebars/source/_patterns/atoms/type/annotation.hbs new file mode 100644 index 000000000..7d556dbab --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/atoms/type/annotation.hbs @@ -0,0 +1 @@ +{{#if annotation}}{{annotation}}{{else}}v{{version}}{{/if}} diff --git a/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants.md b/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants.md new file mode 100644 index 000000000..345e6aef7 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants.md @@ -0,0 +1 @@ +Test diff --git a/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.hbs b/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.hbs new file mode 100644 index 000000000..9cb654819 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.hbs @@ -0,0 +1,8 @@ + diff --git a/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.md b/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.md new file mode 100644 index 000000000..131286757 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/_patterns/molecules/variants/swatches.md @@ -0,0 +1 @@ +Pattern Lab Tip: Note the use of the [built-in handlebars helper, `each`](https://handlebarsjs.com/builtin_helpers.html). diff --git a/packages/development-edition-engine-handlebars/source/css/pattern-scaffolding.css b/packages/development-edition-engine-handlebars/source/css/pattern-scaffolding.css new file mode 100644 index 000000000..f6c2da29d --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/css/pattern-scaffolding.css @@ -0,0 +1,52 @@ +/** + * This stylesheet is for styles you want to include only when displaying demo + * styles for grids, animations, color swatches, etc. + * These styles will not be your production CSS. + */ + +#sg-patterns { + -webkit-box-sizing: border-box !important; + box-sizing: border-box !important; + max-width: 100%; + padding: 0 0.5em; +} + +.sg-colors { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + list-style: none !important; + padding: 0 !important; + margin: 0 !important; +} +.sg-colors li { + -webkit-box-flex: 1; + -ms-flex: auto; + flex: auto; + margin: 0 0 0.5em 0.5em; + width: 14em; +} + +.sg-swatch { + display: flex; + flex-direction: column; + height: 6em; + margin-bottom: 0.3em; + padding: 0.5rem; +} + +.sg-label { + font-size: 90%; + line-height: 1; + color: white; +} + +.sg-label__inverted { + color: black; +} + +.sg-label__top { + margin-bottom: auto; +} diff --git a/packages/development-edition-engine-handlebars/source/css/style.css b/packages/development-edition-engine-handlebars/source/css/style.css new file mode 100644 index 000000000..7f25a7fe6 --- /dev/null +++ b/packages/development-edition-engine-handlebars/source/css/style.css @@ -0,0 +1,3 @@ +.annotation { + color: #b2b2b2; +} diff --git a/packages/development-edition-engine-handlebars/source/favicon.ico b/packages/development-edition-engine-handlebars/source/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..eee4aa78fdf0366fc7278096cdafb710d2dbb49c GIT binary patch literal 32988 zcmeI4d7Ks1mB$}%=>-rF*HI_aXpBUS+qg`-L^KTIhPYsm%(%u(!Vu%QfR1R|eKe>E z5tNUK$lCp0Z*(`^(9O~W0fE6dIvAaxQHcpkR1)K^@aFrgs{5#}uB!K5Z}E@!KA-BU zy7%0(-FweD_uN|@iS&!aBO^vcxR*tSa~~CnM9RvX_aTwUb(HPDzw=%iiOd`ui439K zf{#ZcD=&*ghSLVHNClV5za+mXd<+^mFtTrHY2-k2>0RYqu`daqJ;Da^9aLN#JEx>1 zerHKZVgb)<5{cNBqN3P4#l`UtxjyFlNbi)t!hIcZmB8N(?3mKh(y#OgBYlXZq$F~1 zadF~DMMd!?$nhTXrMq$cC6S1?(f-Eb;^MFMp%{6SLe`NbC9z8S?a$qiH%wO_fVUR> z=jP2^FE&8#GvTYHmt^+U2V-IddN`*S#mb6WMBUGH39bO*1-q8$YUvEIFM z`LaZ!-^woVxP$q+lJRmM_VM!4()cNi*{{NleEv|beRw~F@^bv&zW{eP@XNU8?K^1y zOmT7KknTy^xi$P9T2vH$ArINVfd8e;lWR&!O3FH8%wB@;N8gFdq1nXsS+2D0IHKst z>=bf?z|NJ$~}?#xM0-z`kcL6tFS3gyEv@L&nFMx!`ic)Yqqusi{fbP*+zo z51H3jRaL!OU0wNRDrMa_)YjH6sIE>Z&hVTAI^Kmb9dsni|s$4U5u?7S&sKy{ml5 zlIC*{JHTe`YB6?zG-xp}d5F(%d}lgTqYr~_Z|jZcK}&zyZUsPVvo1NRBD zr_{ZjYd(f?KB>OG_5<~4E;9S+MD3)9MT_b_VO~rL;@e$L9t{~1fwlm_%tOsqAD;O_J<(_>VboU6B09vXlDb-5BuqlS1HGt49uY!+W3c zXG59uugTUKetYBI*w`TaZ#6Vj9^mD{^S(cFD#z@bKcnteH$1+hDhQVH7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2hf(8m2C}^Odfr17K8YpO>pn-x03L5zGY2g0>D_A%) literal 0 HcmV?d00001 From 64311a155f82ddd86806087ad165b9ed880118f3 Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 10:03:44 -0500 Subject: [PATCH 3/8] fix(cli): remove copy-source-files closes #833 --- packages/cli/bin/cli-actions/build.js | 2 -- packages/cli/bin/copy-source-files.js | 27 --------------------------- 2 files changed, 29 deletions(-) delete mode 100644 packages/cli/bin/copy-source-files.js diff --git a/packages/cli/bin/cli-actions/build.js b/packages/cli/bin/cli-actions/build.js index d6cf99c51..c6a34434a 100644 --- a/packages/cli/bin/cli-actions/build.js +++ b/packages/cli/bin/cli-actions/build.js @@ -1,6 +1,5 @@ 'use strict'; const buildPatterns = require('../build'); -const copyFiles = require('../copy-source-files'); const resolveConfig = require('../resolve-config'); const { error, info, wrapAsync } = require('../utils'); @@ -8,7 +7,6 @@ const build = options => wrapAsync(function*() { try { const config = yield resolveConfig(options.parent.config); - yield copyFiles(config.paths); yield buildPatterns(config, options); info(`build: Yay, your Pattern Lab project was successfully built ☺`); } catch (err) { diff --git a/packages/cli/bin/copy-source-files.js b/packages/cli/bin/copy-source-files.js deleted file mode 100644 index 509e17862..000000000 --- a/packages/cli/bin/copy-source-files.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; -const copy = require('./utils').copyWithPattern; -const debug = require('./utils').debug; -const wrapAsync = require('./utils').wrapAsync; - -/** - * @func copyFilesFromSourceToPublic - * @desc Copies files from the source path to the public path. - * @param {object} paths - The passed Pattern Lab config paths member. - * @return {Array} - */ -const copyFilesFromSourceToPublic = paths => - wrapAsync(function*() { - // Copy files over - const copiedFiles = [ - copy(paths.source.styleguide, '*', paths.public.root), - copy(paths.source.js, '**/*.js', paths.public.js), - copy(paths.source.css, '*.css', paths.public.css), - copy(paths.source.images, '*', paths.public.images), - copy(paths.source.fonts, '*', paths.public.fonts), - copy(paths.source.root, 'favicon.ico', paths.public.root), - ]; - debug(`build: Your files were copied over to ${paths.public.root}`); - return yield Promise.all(copiedFiles); - }); - -module.exports = copyFilesFromSourceToPublic; From 663d8e185efd951ae67a37e3ec97f76d6cec0d5e Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 10:22:43 -0500 Subject: [PATCH 4/8] fix(cli): do not call build before serve serve calls build. with both of these running, they both setup watches and conflict with each other fixes #917 --- packages/cli/bin/cli-actions/serve.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/cli/bin/cli-actions/serve.js b/packages/cli/bin/cli-actions/serve.js index 2ee267194..fd1785d12 100644 --- a/packages/cli/bin/cli-actions/serve.js +++ b/packages/cli/bin/cli-actions/serve.js @@ -1,13 +1,12 @@ 'use strict'; const resolveConfig = require('../resolve-config'); -const build = require('./build'); const servePatterns = require('../serve'); const wrapAsync = require('../utils').wrapAsync; const serve = options => wrapAsync(function*() { const config = yield resolveConfig(options.parent.config); - yield build(options); + servePatterns(config, options); servePatterns(config, options.watch); }); From 8bf186b8e2ea2ea5ddcd2d6242b670275b65567f Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 10:23:36 -0500 Subject: [PATCH 5/8] fix(cli): pass watch options cleanly to core --- packages/cli/bin/cli-actions/serve.js | 1 - packages/cli/bin/patternlab.js | 3 ++- packages/cli/bin/serve.js | 5 +++-- packages/core/src/index.js | 5 ++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cli/bin/cli-actions/serve.js b/packages/cli/bin/cli-actions/serve.js index fd1785d12..6e2cc8fd2 100644 --- a/packages/cli/bin/cli-actions/serve.js +++ b/packages/cli/bin/cli-actions/serve.js @@ -7,7 +7,6 @@ const serve = options => wrapAsync(function*() { const config = yield resolveConfig(options.parent.config); servePatterns(config, options); - servePatterns(config, options.watch); }); module.exports = serve; diff --git a/packages/cli/bin/patternlab.js b/packages/cli/bin/patternlab.js index 8800dd2fd..0e7eeed22 100755 --- a/packages/cli/bin/patternlab.js +++ b/packages/cli/bin/patternlab.js @@ -57,6 +57,7 @@ cli .alias('compile') .description('Build Pattern Lab. Optionally (re-)build only the patterns') .option('-p, --patterns-only', 'Whether to only build patterns') + .option('--no-watch', 'Start watching for changes') .action(build); /** @@ -130,7 +131,7 @@ cli .command('serve') .alias('browse') .description('Starts a server to inspect files in browser') - .option('-w, --watch', 'Start watching for changes') + .option('--no-watch', 'Start watching for changes') .action(serve); // Show additional help diff --git a/packages/cli/bin/serve.js b/packages/cli/bin/serve.js index e473a4390..a7502b65f 100644 --- a/packages/cli/bin/serve.js +++ b/packages/cli/bin/serve.js @@ -9,8 +9,9 @@ const { error, info } = require('./utils'); * @func serve * @desc Start a browser-sync server in the Pattern Lab public dir * @param {object} config - The passed Pattern Lab config + * @param {object} options - The passed options at invocation time */ -function serve(config) { +function serve(config, options) { if (!isValidConfig) { throw new TypeError( 'serve: Expects config not to be empty and of type object.' @@ -37,7 +38,7 @@ function serve(config) { try { info(`serve: Serving your files …`); const pl = patternlab(config); - pl.server.serve({}); + pl.server.serve(options); } catch (err) { error(err); } diff --git a/packages/core/src/index.js b/packages/core/src/index.js index eb20f4af0..f79c1ba36 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -266,13 +266,12 @@ const patternlab_module = function(config) { * @param {object} options an object used to control build behavior * @param {bool} options.cleanPublic whether or not to delete the configured output location (usually `public/`) before build * @param {object} options.data additional data to be merged with global data prior to build - * @param {bool} options.watch **ALWAYS OVERRIDDEN to `true`** whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild + * @param {bool} [true] options.watch whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild * @returns {Promise} a promise fulfilled when build is complete */ serve: options => { - const _options = Object.assign({}, options, { watch: true }); return _api - .build(_options) + .build(options) .then(() => server.serve()) .catch(e => logger.error(`error inside core index.js server serve: ${e}`) From 830c568dae28e743917a9d19860a5ec13641c8d8 Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 10:30:28 -0500 Subject: [PATCH 6/8] fix(docs): regenerate API documentation --- packages/core/docs/README.md | 34 +++++++++++++++++----------------- packages/core/docs/events.md | 2 +- packages/core/src/index.js | 18 +++++++++--------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/core/docs/README.md b/packages/core/docs/README.md index 9eaf02714..7317083f6 100644 --- a/packages/core/docs/README.md +++ b/packages/core/docs/README.md @@ -63,12 +63,12 @@ Builds patterns, copies assets, and constructs user interface **Emits**: event:PATTERNLAB_BUILD_START, event:PATTERNLAB_BUILD_END **See**: [all events](./events.md) -| Param | Type | Description | -| --- | --- | --- | -| options | object | an object used to control build behavior | -| options.cleanPublic | bool | whether or not to delete the configured output location (usually `public/`) before build | -| options.data | object | additional data to be merged with global data prior to build | -| options.watch | bool | whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| options | object | | an object used to control build behavior | +| [options.cleanPublic] | bool | true | whether or not to delete the configured output location (usually `public/`) before build | +| [options.data] | object | {} | additional data to be merged with global data prior to build | +| [options.watch] | bool | true | whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild | @@ -122,11 +122,11 @@ Builds patterns only, leaving existing user interface files intact **Kind**: instance property of [patternlab](#patternlab) **Returns**: Promise - a promise fulfilled when build is complete -| Param | Type | Description | -| --- | --- | --- | -| options | object | an object used to control build behavior | -| options.cleanPublic | bool | whether or not to delete the configured output location (usually `public/`) before build | -| options.data | object | additional data to be merged with global data prior to build | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [options.cleanPublic] | bool | true | whether or not to delete the configured output location (usually `public/`) before build | +| [options.data] | object | {} | additional data to be merged with global data prior to build | +| [options.watch] | bool | true | whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild | @@ -162,12 +162,12 @@ Build patterns, copies assets, and constructs user interface. Watches configured **Kind**: static method of [server](#patternlab.server) **Returns**: Promise - a promise fulfilled when build is complete -| Param | Type | Description | -| --- | --- | --- | -| options | object | an object used to control build behavior | -| options.cleanPublic | bool | whether or not to delete the configured output location (usually `public/`) before build | -| options.data | object | additional data to be merged with global data prior to build | -| options.watch | bool | **ALWAYS OVERRIDDEN to `true`** whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| options | object | | an object used to control build behavior | +| [options.cleanPublic] | bool | true | whether or not to delete the configured output location (usually `public/`) before build | +| [options.data] | object | {} | additional data to be merged with global data prior to build | +| [options.watch] | bool | true | whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild | diff --git a/packages/core/docs/events.md b/packages/core/docs/events.md index 6b01e90d7..2df8191d1 100644 --- a/packages/core/docs/events.md +++ b/packages/core/docs/events.md @@ -5,7 +5,7 @@ Pattern Lab emits numerous events during the [build](../docs/) process. Some uses of events: * Core uses `patternlab-pattern-change` events when watching for changes in order to trigger another build -* Plugins such as [plugin-node-tab](https://github.com/pattern-lab/plugin-node-tab) can use an event like `patternlab-pattern-write-end` to define additional code tabs to the pattern viewer / modal +* Plugins such as [plugin-tab](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab) can use an event like `patternlab-pattern-write-end` to define additional code tabs to the pattern viewer / modal Learn more about [Creating Plugins](https://github.com/pattern-lab/patternlab-node/wiki/Creating-Plugins). diff --git a/packages/core/src/index.js b/packages/core/src/index.js index f79c1ba36..653a9f731 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -84,9 +84,9 @@ const patternlab_module = function(config) { * @name build * @instance * @param {object} options an object used to control build behavior - * @param {bool} options.cleanPublic whether or not to delete the configured output location (usually `public/`) before build - * @param {object} options.data additional data to be merged with global data prior to build - * @param {bool} options.watch whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild + * @param {bool} [options.cleanPublic=true] whether or not to delete the configured output location (usually `public/`) before build + * @param {object} [options.data={}] additional data to be merged with global data prior to build + * @param {bool} [options.watch=true] whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild * @emits PATTERNLAB_BUILD_START * @emits PATTERNLAB_BUILD_END * @see {@link ./events.md|all events} @@ -231,9 +231,9 @@ const patternlab_module = function(config) { * @memberof patternlab * @name patternsonly * @instance - * @param {object} options an object used to control build behavior - * @param {bool} options.cleanPublic whether or not to delete the configured output location (usually `public/`) before build - * @param {object} options.data additional data to be merged with global data prior to build + * @param {bool} [options.cleanPublic=true] whether or not to delete the configured output location (usually `public/`) before build + * @param {object} [options.data={}] additional data to be merged with global data prior to build + * @param {bool} [options.watch=true] whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild * @returns {Promise} a promise fulfilled when build is complete */ patternsonly: function(options) { @@ -264,9 +264,9 @@ const patternlab_module = function(config) { * @method serve * @memberof patternlab.server * @param {object} options an object used to control build behavior - * @param {bool} options.cleanPublic whether or not to delete the configured output location (usually `public/`) before build - * @param {object} options.data additional data to be merged with global data prior to build - * @param {bool} [true] options.watch whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild + * @param {bool} [options.cleanPublic=true] whether or not to delete the configured output location (usually `public/`) before build + * @param {object} [options.data={}] additional data to be merged with global data prior to build + * @param {bool} [options.watch=true] whether or not Pattern Lab should watch configured `source/` directories for changes to rebuild * @returns {Promise} a promise fulfilled when build is complete */ serve: options => { From 12a94b0ee141d8df9b39b179e86940e082ece54a Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 11:48:22 -0500 Subject: [PATCH 7/8] chore(README): remove backer --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 73d0fe020..dd81d9dce 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,6 @@ Pattern Lab / Node wouldn't be what it is today without the support of the commu * **[Brad Frost](http://bradfrost.com/)** * [Marcos Peebles](https://twitter.com/marcospeebles) * [Susan Simkins](https://twitter.com/susanmsimkins) -* [Wilfred Nas](https://twitter.com/wnas) ## Contributing From ceec673b1a9b473949534a444b4334c48bcdf5cd Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 11:49:14 -0500 Subject: [PATCH 8/8] feat(README): simplify README and add CLI configuration instructions --- README.md | 31 ++++-------------------------- packages/cli/readme.md | 43 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index dd81d9dce..07ff5607d 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,7 @@ Refer to the [core usage guidelines](https://github.com/pattern-lab/patternlab-n As of Pattern Lab Node 3.0.0, installation of [Editions](http://patternlab.io/docs/advanced-ecosystem-overview.html) is accomplished via the command line interface. -_0 to 60mph_ - -The below assume a new directory and project is required. +The below assumes a new directory and project is required. This is likely what you want to do if starting from scratch. You could also run this within an existing project. The CLI will ask you for the installation location. 1. Open a terminal window and following along below: ```bash @@ -36,31 +34,10 @@ The below assume a new directory and project is required. ``` > If you get an error stating that `npx` is not installed, ensure you are on `npm 5.2.0` or later by running `npm -v` or install it globally with `npm install -g npx`. [Learn more about npx.](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) 1. Follow the on-screen prompts to choose your Edition and a Starterkit should you want one. -1. Run `npm install` one last time to ensure any transient packages from the CLI are installed. -1. Open `package.json` and add the following to your `scripts` object - ```diff - "scripts": { - + "patternlab": "patternlab" - }, - ``` - This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI. -1. In your terminal, run `npm run patternlab `, where `` is a documented method on the CLI, such as `build`, `serve`, or `help`. - - -_Established npm projects_ + - If you chose `edition-node`, new commands in the "scripts" will be added in your `package.json`. + - If you chose `edition-node-gulp`, a `gulpfile.js` will be added to your project. -1. Run the following command from a terminal: - ```bash - npm install @pattern-lab/cli --save-dev - ``` -1. Open `package.json` and add the following to your `scripts` object - ```diff - "scripts": { - + "patternlab": "patternlab" - }, - ``` - This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI. -1. In your terminal, run `npm run patternlab init`. Follow the on-screen prompts to choose your Edition and a Starterkit should you want one. + > Notice that `@pattern-lab/cli` was installed as a depdendency. Learn how to further [use the cli in your own project](https://github.com/pattern-lab/patternlab-node/blob/dev/packages/cli/readme.md#configuring-your-project-to-use-the-cli). ## Ecosystem diff --git a/packages/cli/readme.md b/packages/cli/readme.md index 921f4ccad..e5a9ae95e 100644 --- a/packages/cli/readme.md +++ b/packages/cli/readme.md @@ -14,11 +14,44 @@ #### Via Yarn `yarn add @pattern-lab/cli --dev` -## Getting Started -1. In order to use Pattern Lab you need to initialize a Pattern Lab project with `patternlab init`. The CLI will ask you some setup question and scaffold your project based on it. -2. Build your patterns use `patternlab build`. The Pattern Lab CLI will assume that the `patternlab-config.json` is in the project root. Othewise specify a custom path to config with `patternlab build --config path/to/config` -3. To view your patterns in the browser preview `patternlab serve` or again specify a custom config location `patternlab serve --config path/to/config` -4. To export your patterns in the browser preview `patternlab export` or again specify a custom config location `patternlab export --config path/to/config` +## Configuring Your Project to Use the CLI + +If the CLI is installed globally, you may call commands directly, such as `patternlab --version`. + +If the CLI is not installed globally, you need to tell `npm` where to find the executable when invoking commands. + +Open `package.json` and add the following to your `scripts` object: + +```diff +"scripts": { ++ "patternlab": "patternlab" +}, +``` +This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI. + +Subcommands and options can then be forwarded to the CLI like this: + +```bash +npm run patternlab -- serve +``` + +Installing [`edition-node`](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node) will add the following CLI commands for convenience: + +```diff + "scripts": { ++ "pl:build": "patternlab build --config ./patternlab-config.json", ++ "pl:help": "patternlab --help", ++ "pl:install": "patternlab install --config ./patternlab-config.json", ++ "pl:serve": "patternlab serve --config ./patternlab-config.json", ++ "pl:version": "patternlab --version" + }, +``` + +Then you can invoke any of these like this: + +``` +npm run pl:serve +``` ## API & Usage ### General usage