@@ -656,12 +656,31 @@ const patternlab_engine = function (config) {
656
656
}
657
657
658
658
return {
659
+ /**
660
+ * logs current version
661
+ *
662
+ * @returns {void } current patternlab-node version as defined in package.json, as console output
663
+ */
659
664
version : function ( ) {
660
665
return logVersion ( ) ;
661
666
} ,
667
+
668
+ /**
669
+ * return current version
670
+ *
671
+ * @returns {string } current patternlab-node version as defined in package.json, as string
672
+ */
662
673
v : function ( ) {
663
674
return getVersion ( ) ;
664
675
} ,
676
+
677
+ /**
678
+ * build patterns, copy assets, and construct ui
679
+ *
680
+ * @param {function } callback a function invoked when build is complete
681
+ * @param {object } options an object used to control build behavior
682
+ * @returns {Promise } a promise fulfilled when build is complete
683
+ */
665
684
build : function ( callback , options ) {
666
685
if ( patternlab && patternlab . isBusy ) {
667
686
console . log ( 'Pattern Lab is busy building a previous run - returning early.' ) ;
@@ -694,9 +713,23 @@ const patternlab_engine = function (config) {
694
713
callback ( ) ;
695
714
} ) ;
696
715
} ,
716
+
717
+ /**
718
+ * logs usage
719
+ *
720
+ * @returns {void } pattern lab API usage, as console output
721
+ */
697
722
help : function ( ) {
698
723
help ( ) ;
699
724
} ,
725
+
726
+ /**
727
+ * build patterns only, leaving existing public files intact
728
+ *
729
+ * @param {function } callback a function invoked when build is complete
730
+ * @param {object } options an object used to control build behavior
731
+ * @returns {Promise } a promise fulfilled when build is complete
732
+ */
700
733
patternsonly : function ( callback , options ) {
701
734
if ( patternlab && patternlab . isBusy ) {
702
735
console . log ( 'Pattern Lab is busy building a previous run - returning early.' ) ;
@@ -709,18 +742,53 @@ const patternlab_engine = function (config) {
709
742
callback ( ) ;
710
743
} ) ;
711
744
} ,
745
+
746
+ /**
747
+ * fetches starterkit repos from pattern-lab github org that contain 'starterkit' in their name
748
+ *
749
+ * @returns {Promise } Returns an Array<{name,url}> for the starterkit repos
750
+ */
712
751
liststarterkits : function ( ) {
713
752
return listStarterkits ( ) ;
714
753
} ,
754
+
755
+ /**
756
+ * load starterkit already available via `node_modules/`
757
+ *
758
+ * @param {string } starterkitName name of starterkit
759
+ * @param {boolean } clean whether or not to delete contents of source/ before load
760
+ * @returns {void }
761
+ */
715
762
loadstarterkit : function ( starterkitName , clean ) {
716
763
loadStarterKit ( starterkitName , clean ) ;
717
764
} ,
765
+
766
+
767
+ /**
768
+ * install plugin already available via `node_modules/`
769
+ *
770
+ * @param {string } pluginName name of plugin
771
+ * @returns {void }
772
+ */
718
773
installplugin : function ( pluginName ) {
719
774
installPlugin ( pluginName ) ;
720
775
} ,
776
+
777
+ /**
778
+ * returns all file extensions supported by installed PatternEngines
779
+ *
780
+ * @returns {Array<string> } all supported file extensions
781
+ */
721
782
getSupportedTemplateExtensions : function ( ) {
722
783
return getSupportedTemplateExtensions ( ) ;
723
784
} ,
785
+
786
+ /**
787
+ * build patterns, copy assets, and construct ui, watch source files, and serve locally
788
+ *
789
+ * @param {object } options an object used to control build, copy, and serve behavior
790
+ * @returns {Promise } TODO: validate
791
+ */
724
792
serve : function ( options ) {
725
793
options . watch = true ;
726
794
return this . build ( ( ) => { } , options ) . then ( function ( ) {
0 commit comments