Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions core/lib/patternlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,10 @@ const patternlab_engine = function (config) {
/**
* build patterns, copy assets, and construct ui
*
* @param {function} callback a function invoked when build is complete
* @param {object} options an object used to control build behavior
* @returns {Promise} a promise fulfilled when build is complete
*/
build: function (callback, options) {
build: function (options) {
if (patternlab && patternlab.isBusy) {
logger.info('Pattern Lab is busy building a previous run - returning early.');
return Promise.resolve();
Expand All @@ -770,21 +769,20 @@ const patternlab_engine = function (config) {
this.events.on('patternlab-pattern-change', () => {
if (!patternlab.isBusy) {
options.cleanPublic = false;
return this.build(callback, options);
return this.build(options);
}
return Promise.resolve();
});

this.events.on('patternlab-global-change', () => {
if (!patternlab.isBusy) {
options.cleanPublic = true; //rebuild everything
return this.build(callback, options);
return this.build(options);
}
return Promise.resolve();
});

patternlab.isBusy = false;
callback();
});
},

Expand All @@ -800,19 +798,17 @@ const patternlab_engine = function (config) {
/**
* build patterns only, leaving existing public files intact
*
* @param {function} callback a function invoked when build is complete
* @param {object} options an object used to control build behavior
* @returns {Promise} a promise fulfilled when build is complete
*/
patternsonly: function (callback, options) {
patternsonly: function (options) {
if (patternlab && patternlab.isBusy) {
logger.info('Pattern Lab is busy building a previous run - returning early.');
return Promise.resolve();
}
patternlab.isBusy = true;
return buildPatterns(options.cleanPublic).then(() => {
patternlab.isBusy = false;
callback();
});
},

Expand Down Expand Up @@ -864,7 +860,7 @@ const patternlab_engine = function (config) {
*/
serve: function (options) {
options.watch = true;
return this.build(() => {}, options).then(function () {
return this.build(options).then(function () {
serve(patternlab);
});
},
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"version": "3.0.0-alpha.4",
"main": "./core/lib/patternlab.js",
"dependencies": {
"@pattern-lab/live-server": "^1.3.2",
"@pattern-lab/patternengine-node-mustache": "^2.0.0-alpha.1",
"async": "^2.1.2",
"chalk": "^1.1.3",
"chokidar": "^1.7.0",
Expand All @@ -15,7 +17,6 @@
"graphlib": "^2.1.1",
"js-beautify": "^1.6.3",
"js-yaml": "^3.6.1",
"@pattern-lab/live-server": "^1.3.2",
"lodash": "~4.13.1",
"markdown-it": "^6.0.1",
"node-fetch": "^1.6.0",
Expand Down
4 changes: 2 additions & 2 deletions test/patternlab_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ tap.test('buildPatterns - should replace data link even when pattern parameter p
var pl = new plEngineModule(config);

//act
pl.build(function() {
pl.build(true).then(() => {
test.end();
}, true);
});
});

tap.test('buildPatternData - can load json, yaml, and yml files', function(test) {
Expand Down