Skip to content

Commit

Permalink
fix(asset copy): Resolve paths correctly. Break apart files & asyncify
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuenzenmeyer committed Feb 6, 2018
1 parent e0f061d commit 379419c
Show file tree
Hide file tree
Showing 10 changed files with 382 additions and 277 deletions.
46 changes: 22 additions & 24 deletions core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const defaultConfig = require('../patternlab-config.json');

let fs = require('fs-extra'); // eslint-disable-line
let ui_builder = require('./lib/ui_builder'); // eslint-disable-line
let assetCopier = require('./lib/asset_copy'); // eslint-disable-line
let copier = require('./lib/copier'); // eslint-disable-line
let pattern_exporter = new pe(); // eslint-disable-line
let serve = require('./lib/serve'); // eslint-disable-line

Expand Down Expand Up @@ -369,29 +369,27 @@ const patternlab_module = function(config) {
patternlab.isBusy = true;
return buildPatterns(options.cleanPublic, options.data).then(() => {
return new ui_builder().buildFrontend(patternlab).then(() => {
assetCopier().copyAssets(
patternlab.config.paths,
patternlab,
options
);

this.events.on('patternlab-pattern-change', () => {
if (!patternlab.isBusy) {
return this.build(options);
}
return Promise.resolve();
});

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

patternlab.isBusy = false;
copier()
.copyAndWatch(patternlab.config.paths, patternlab, options)
.then(() => {
this.events.on('patternlab-pattern-change', () => {
if (!patternlab.isBusy) {
return this.build(options);
}
return Promise.resolve();
});

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

patternlab.isBusy = false;
});
});
});
},
Expand Down
245 changes: 0 additions & 245 deletions core/lib/asset_copy.js

This file was deleted.

Loading

0 comments on commit 379419c

Please sign in to comment.