|
| 1 | +/****************************************************** |
| 2 | + * PATTERN LAB NODE |
| 3 | + * EDITION-NODE-GULP |
| 4 | + * The gulp wrapper around patternlab-node core, providing tasks to interact with the core library. |
| 5 | +******************************************************/ |
| 6 | +const gulp = require('gulp'); |
| 7 | +const argv = require('minimist')(process.argv.slice(2)); |
| 8 | + |
| 9 | +/****************************************************** |
| 10 | + * PATTERN LAB NODE WRAPPER TASKS with core library |
| 11 | +******************************************************/ |
| 12 | +const config = require('./patternlab-config.json'); |
| 13 | +const patternlab = require('@pattern-lab/core')(config); |
| 14 | + |
| 15 | +function build() { |
| 16 | + return patternlab |
| 17 | + .build({ |
| 18 | + watch: argv.watch, |
| 19 | + cleanPublic: config.cleanPublic, |
| 20 | + }) |
| 21 | + .then(() => { |
| 22 | + // do something else when this promise resolves |
| 23 | + }); |
| 24 | +} |
| 25 | + |
| 26 | +function serve() { |
| 27 | + return patternlab |
| 28 | + .serve({ |
| 29 | + cleanPublic: config.cleanPublic, |
| 30 | + }) |
| 31 | + .then(() => { |
| 32 | + // do something else when this promise resolves |
| 33 | + }); |
| 34 | +} |
| 35 | + |
| 36 | +gulp.task('patternlab:version', function() { |
| 37 | + patternlab.version(); |
| 38 | +}); |
| 39 | + |
| 40 | +gulp.task('patternlab:help', function() { |
| 41 | + patternlab.help(); |
| 42 | +}); |
| 43 | + |
| 44 | +gulp.task('patternlab:patternsonly', function() { |
| 45 | + patternlab.patternsonly(config.cleanPublic); |
| 46 | +}); |
| 47 | + |
| 48 | +gulp.task('patternlab:liststarterkits', function() { |
| 49 | + patternlab.liststarterkits(); |
| 50 | +}); |
| 51 | + |
| 52 | +gulp.task('patternlab:loadstarterkit', function() { |
| 53 | + patternlab.loadstarterkit(argv.kit, argv.clean); |
| 54 | +}); |
| 55 | + |
| 56 | +gulp.task('patternlab:build', function() { |
| 57 | + build().then(() => { |
| 58 | + // do something else when this promise resolves |
| 59 | + }); |
| 60 | +}); |
| 61 | + |
| 62 | +gulp.task('patternlab:serve', function() { |
| 63 | + serve().then(() => { |
| 64 | + // do something else when this promise resolves |
| 65 | + }); |
| 66 | +}); |
| 67 | + |
| 68 | +gulp.task('patternlab:installplugin', function() { |
| 69 | + patternlab.installplugin(argv.plugin); |
| 70 | +}); |
| 71 | + |
| 72 | +gulp.task('default', ['patternlab:help']); |
0 commit comments