js-build-tools 6.2.2 → 6.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +180 -9
  2. package/dist/build.js +66 -66
  3. package/dist/bundle.js +1 -1
  4. package/dist/docs.js +11 -11
  5. package/dist/partials/jsdocDocsFor.js +133 -113
  6. package/dist/partials/loadPlaywright.js +34 -0
  7. package/dist/partials/neostandardLint.js +5 -3
  8. package/dist/partials/resolveDocsMethod.js +12 -12
  9. package/dist/partials/serveStatic.js +57 -0
  10. package/dist/partials/tsFor.js +2 -2
  11. package/dist/partials/typeDocsFor.js +28 -22
  12. package/dist/partials.js +169 -149
  13. package/dist/partials.min.js +1 -1
  14. package/dist/test-helpers/setUp.js +6 -0
  15. package/dist/utilities/convertMjsFilesForDocs.js +1 -0
  16. package/dist/utilities/dotGet.js +1 -0
  17. package/dist/utilities/dotNotate.js +5 -0
  18. package/dist/utilities/dotSet.js +1 -0
  19. package/dist/utilities/esmNamedExportsToCjs.js +1 -0
  20. package/dist/utilities/getBundleConfigs.js +1 -0
  21. package/dist/utilities/isObject.js +1 -0
  22. package/dist/utilities/strAfter.js +1 -0
  23. package/dist/utilities/strBefore.js +1 -0
  24. package/functions/bundle.mjs +1 -1
  25. package/functions/jsdocEsmExports.test.mjs +24 -0
  26. package/functions/partials/jsdocDocsFor.mjs +33 -13
  27. package/functions/partials/jsdocDocsFor.test.mjs +51 -0
  28. package/functions/partials/loadPlaywright.mjs +23 -0
  29. package/functions/partials/loadPlaywright.test.mjs +71 -0
  30. package/functions/partials/neostandardLint.mjs +5 -3
  31. package/functions/partials/serveStatic.mjs +47 -0
  32. package/functions/partials/serveStatic.test.mjs +71 -0
  33. package/functions/partials/tsFor.mjs +2 -2
  34. package/functions/partials/typeDocsFor.mjs +24 -20
  35. package/functions/partials/typeDocsFor.test.mjs +23 -0
  36. package/functions/partials.mjs +2 -0
  37. package/functions/partials.test.mjs +1 -1
  38. package/functions/test-helpers/setUp.mjs +6 -0
  39. package/functions/utilities/convertMjsFilesForDocs.mjs +1 -0
  40. package/functions/utilities/dotGet.mjs +1 -0
  41. package/functions/utilities/dotNotate.mjs +5 -0
  42. package/functions/utilities/dotSet.mjs +1 -0
  43. package/functions/utilities/esmNamedExportsToCjs.mjs +1 -0
  44. package/functions/utilities/getBundleConfigs.mjs +1 -0
  45. package/functions/utilities/isObject.mjs +1 -0
  46. package/functions/utilities/strAfter.mjs +1 -0
  47. package/functions/utilities/strBefore.mjs +1 -0
  48. package/gulp.config.mjs +2 -2
  49. package/gulpfile.base.mjs +1 -3
  50. package/jsdoc.base.js +9 -3
  51. package/jsdoc.esmExports.js +17 -0
  52. package/package.json +16 -10
package/README.md CHANGED
@@ -546,7 +546,7 @@ documentation straight from your source, with either engine:
546
546
  are not needed. `typedoc` is an optional peer dependency (like `typescript`), install it in your project with
547
547
  `npm install --save-dev typedoc` (this needs a `typescript` version it supports).
548
548
  * **jsdoc** (for a plain JavaScript project, where TypeDoc has no real types to read) - scans your source
549
- recursively with jsdoc itself, rendered with a modern theme (`clean-jsdoc-theme` by default, used instead of
549
+ (`.js`, `.mjs` and `.cjs` files, leaving out tests and minified `.min.js` copies) recursively with jsdoc itself, rendered with a modern theme (`clean-jsdoc-theme` by default, used instead of
550
550
  jsdoc's own classic default template) instead of the manual `.jsdoc.conf.js` setup described further below.
551
551
  `jsdoc` and whichever theme you configure are optional peer dependencies, install them with
552
552
  `npm install --save-dev jsdoc clean-jsdoc-theme` (or your own chosen theme package).
@@ -558,7 +558,8 @@ Add the following to the exports in your `build-tools.config.json`:
558
558
  "docs": {
559
559
  // Generate the documentation from the source
560
560
  "enabled": true,
561
- // The directory holding the source, each folder in it becomes a module (TypeDoc) or is scanned recursively (jsdoc)
561
+ // The directory holding the source, each folder in it becomes a module (TypeDoc) or is scanned recursively (jsdoc).
562
+ // jsdoc also takes a list of directories and files, for example ["functions", "gulpfile.base.mjs"]
562
563
  "from": "src",
563
564
  // The markdown file used as the front page of the documentation (a short overview of your project)
564
565
  "index": "MAIN.md",
@@ -569,6 +570,8 @@ Add the following to the exports in your `build-tools.config.json`:
569
570
  // Only meaningful when method is (or resolves to) 'jsdoc' - the theme package to render with. TypeDoc
570
571
  // always keeps its own default regardless of this setting.
571
572
  "theme": "clean-jsdoc-theme",
573
+ // The name of the documentation (TypeDoc's title, the theme's title for jsdoc), defaults to the package name
574
+ "title": "",
572
575
  // Where the HTML is generated (the directory is cleared first)
573
576
  "to": "docs"
574
577
  }
@@ -579,6 +582,35 @@ While `docs.enabled` is on, `gulp build` generates the documentation instead of
579
582
  hand-written (a short overview which links to the documentation). If you also export `docs` from your gulpfile you can
580
583
  run it on its own with `gulp docs`, and can then add the script `"docs": "gulp docs"`.
581
584
 
585
+ ### Browser automation (optional)
586
+
587
+ Unlike the rest of this file, this isn't a `build-tools.config.json`-driven feature with its own task - it's a pair
588
+ of plain functions (`partials.loadPlaywright`/`partials.launchBrowser` and `partials.serveStatic`) for whatever your
589
+ own script needs a real browser for: verifying a page that only works correctly in a real browser (for example one
590
+ using `<script type="module">`, which no DOM-simulation library executes at all), or taking a real screenshot.
591
+
592
+ `playwright` is an optional peer dependency, install it in your project with `npm install --save-dev playwright`,
593
+ then fetch a real browser binary once per machine (not per project) with `npx playwright install chromium` - if
594
+ that fails with "Playwright does not support chromium on <your distro>", your OS is too old for the current
595
+ release; either upgrade it or pin an older `playwright` version known to still support it (confirmed: `1.48.0`
596
+ still installs and runs real headless Chromium on Ubuntu 20.04, which the current release has dropped).
597
+
598
+ ```js
599
+ const { launchBrowser, serveStatic } = require('js-build-tools').partials
600
+
601
+ const { server, url } = await serveStatic('browser') // serves ./browser/ over a real local HTTP server
602
+ const browser = await launchBrowser()
603
+ const page = await browser.newPage()
604
+ await page.goto(`${url}/index.html`)
605
+ await page.screenshot({ path: 'homepage.png' }) // a real screenshot, to actually look at
606
+ await browser.close()
607
+ server.close()
608
+ ```
609
+
610
+ `serveStatic` exists because a page loaded directly from a `file://` path resolves any root-relative asset path
611
+ (`/browser/...`) against the filesystem root instead of the page's own directory - serving it over real HTTP avoids
612
+ that entirely, and is also the right fix for the exact same problem in a jsdom-based test.
613
+
582
614
  ### Configure lint rule overrides (optional)
583
615
 
584
616
  `sourceLint` lints your real source directly (not the compiled dist/browser output) with
@@ -613,7 +645,6 @@ In your `package.json` file, add the following scripts:
613
645
  "build": "gulp build",
614
646
  "dev": "gulp",
615
647
  "docs": "gulp docs",
616
- "htmldocs": "jsdoc -R MAIN.md -c ./.jsdoc.conf.js -d docs",
617
648
  "publish:bundle": "gulp copyFiles",
618
649
  "readme": "gulp readme",
619
650
  "sass": "gulp sass",
@@ -629,8 +660,6 @@ In your `package.json` file, add the following scripts:
629
660
 
630
661
  Run any of the above commands with `gulp` or `npm run`.
631
662
 
632
- # Available functions documentation
633
-
634
663
  ## Modules
635
664
 
636
665
  <dl>
@@ -649,6 +678,146 @@ Export these functions to your own project to customize your build pipeline.
649
678
 
650
679
  **Version**: 3.0.0
651
680
  **Author**: Joshua Heagle <joshuaheagle@gmail.com>
681
+
682
+ * [js-build-tools](#module_js-build-tools)
683
+ * [.typeScript](#module_js-build-tools.typeScript) ⇒ <code>function</code>
684
+ * [.typeDocs](#module_js-build-tools.typeDocs) ⇒ <code>function</code>
685
+ * [.jsdocDocs](#module_js-build-tools.jsdocDocs) ⇒ <code>function</code>
686
+ * [.compileReadme](#module_js-build-tools.compileReadme) ⇒ <code>stream.Stream</code>
687
+ * [.watchTest()](#module_js-build-tools.watchTest) ⇒ <code>\*</code>
688
+ * [.watchFull()](#module_js-build-tools.watchFull) ⇒ <code>FSWatcher</code>
689
+ * [.testQuick()](#module_js-build-tools.testQuick) ⇒ <code>Promise.&lt;\*&gt;</code>
690
+ * [.testFull()](#module_js-build-tools.testFull) ⇒ <code>Promise.&lt;\*&gt;</code>
691
+ * [.sourceLint()](#module_js-build-tools.sourceLint) ⇒ <code>\*</code>
692
+ * [.images()](#module_js-build-tools.images) ⇒ <code>stream.Stream</code>
693
+ * [.docs([done])](#module_js-build-tools.docs) ⇒ <code>\*</code>
694
+ * [.distMinify()](#module_js-build-tools.distMinify) ⇒ <code>\*</code>
695
+ * [.dist()](#module_js-build-tools.dist) ⇒ <code>\*</code>
696
+ * [.defaultCmd([done])](#module_js-build-tools.defaultCmd) ⇒ <code>stream.Stream</code>
697
+ * [.copyFonts()](#module_js-build-tools.copyFonts) ⇒ <code>stream.Stream</code>
698
+ * [.copyFiles()](#module_js-build-tools.copyFiles) ⇒ <code>Promise.&lt;void&gt;</code>
699
+ * [.bundleMinify()](#module_js-build-tools.bundleMinify) ⇒ <code>\*</code>
700
+ * [.bundle()](#module_js-build-tools.bundle) ⇒ <code>stream.Stream</code>
701
+ * [.build()](#module_js-build-tools.build) ⇒ <code>stream.Stream</code>
702
+
703
+ <a name="module_js-build-tools.typeScript"></a>
704
+
705
+ ### js-build-tools.typeScript ⇒ <code>function</code>
706
+ Simplified typescript task using tsFor.
707
+
708
+ **Kind**: static constant of [<code>js-build-tools</code>](#module_js-build-tools)
709
+ <a name="module_js-build-tools.typeDocs"></a>
710
+
711
+ ### js-build-tools.typeDocs ⇒ <code>function</code>
712
+ Generate the HTML documentation of a TypeScript project from its source, with the modules mirroring the source
713
+
714
+ **Kind**: static constant of [<code>js-build-tools</code>](#module_js-build-tools)
715
+ <a name="module_js-build-tools.jsdocDocs"></a>
716
+
717
+ ### js-build-tools.jsdocDocs ⇒ <code>function</code>
718
+ Generate the HTML documentation of a plain-JavaScript project from its source, with a modern jsdoc theme
719
+
720
+ **Kind**: static constant of [<code>js-build-tools</code>](#module_js-build-tools)
721
+ <a name="module_js-build-tools.compileReadme"></a>
722
+
723
+ ### js-build-tools.compileReadme ⇒ <code>stream.Stream</code>
724
+ Generate the README.md file based off of the template, then append the generated documentation.
725
+
726
+ **Kind**: static constant of [<code>js-build-tools</code>](#module_js-build-tools)
727
+ <a name="module_js-build-tools.watchTest"></a>
728
+
729
+ ### js-build-tools.watchTest() ⇒ <code>\*</code>
730
+ Watch for changes and run the tests.
731
+
732
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
733
+ <a name="module_js-build-tools.watchFull"></a>
734
+
735
+ ### js-build-tools.watchFull() ⇒ <code>FSWatcher</code>
736
+ Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
737
+
738
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
739
+ <a name="module_js-build-tools.testQuick"></a>
740
+
741
+ ### js-build-tools.testQuick() ⇒ <code>Promise.&lt;\*&gt;</code>
742
+ Run the Jest tests for files which have been modified (based on git status).
743
+
744
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
745
+ <a name="module_js-build-tools.testFull"></a>
746
+
747
+ ### js-build-tools.testFull() ⇒ <code>Promise.&lt;\*&gt;</code>
748
+ Run all tests with jest.
749
+
750
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
751
+ <a name="module_js-build-tools.sourceLint"></a>
752
+
753
+ ### js-build-tools.sourceLint() ⇒ <code>\*</code>
754
+ Applies neostandard linting (js-build-tools' chosen style) to the real, hand-written source - not the compiled
755
+
756
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
757
+ <a name="module_js-build-tools.images"></a>
758
+
759
+ ### js-build-tools.images() ⇒ <code>stream.Stream</code>
760
+ Move and optimize the images into the browser folder using configured settings.
761
+
762
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
763
+ <a name="module_js-build-tools.docs"></a>
764
+
765
+ ### js-build-tools.docs([done]) ⇒ <code>\*</code>
766
+ Generate the HTML documentation with whichever engine docs.method (or its typescript.enabled-based default)
767
+
768
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
769
+
770
+ | Param | Type | Default |
771
+ | --- | --- | --- |
772
+ | [done] | <code>function</code> | <code></code> |
773
+
774
+ <a name="module_js-build-tools.distMinify"></a>
775
+
776
+ ### js-build-tools.distMinify() ⇒ <code>\*</code>
777
+ Creates minified versions of the dist files.
778
+
779
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
780
+ <a name="module_js-build-tools.dist"></a>
781
+
782
+ ### js-build-tools.dist() ⇒ <code>\*</code>
783
+ Simplified distribution tasks which will use arguments from distFor.
784
+
785
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
786
+ <a name="module_js-build-tools.defaultCmd"></a>
787
+
788
+ ### js-build-tools.defaultCmd([done]) ⇒ <code>stream.Stream</code>
789
+ Recommended as the default task, runs the simple dist and bundle tasks.
790
+
791
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
792
+
793
+ | Param | Type | Default |
794
+ | --- | --- | --- |
795
+ | [done] | <code>function</code> | <code></code> |
796
+
797
+ <a name="module_js-build-tools.copyFonts"></a>
798
+
799
+ ### js-build-tools.copyFonts() ⇒ <code>stream.Stream</code>
800
+ Move the font files into the browser directory.
801
+
802
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
803
+ <a name="module_js-build-tools.copyFiles"></a>
804
+
805
+ ### js-build-tools.copyFiles() ⇒ <code>Promise.&lt;void&gt;</code>
806
+ Copy files from one place to another - any number of { from, to, base? } entries, configured via copyFiles.
807
+
808
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
809
+ <a name="module_js-build-tools.bundleMinify"></a>
810
+
811
+ ### js-build-tools.bundleMinify() ⇒ <code>\*</code>
812
+ Creates the minified file for every bundle (the primary bundle, plus any additional ones from
813
+
814
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
815
+ <a name="module_js-build-tools.bundle"></a>
816
+
817
+ ### js-build-tools.bundle() ⇒ <code>stream.Stream</code>
818
+ Starting at each bundle's own entry point (dist.main for the primary bundle, or its own
819
+
820
+ **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
652
821
  <a name="module_js-build-tools.build"></a>
653
822
 
654
823
  ### js-build-tools.build() ⇒ <code>stream.Stream</code>
@@ -804,7 +973,8 @@ Configurations for building the browser files.
804
973
  <a name="module_gulpConfig..AdditionalBundleConfig"></a>
805
974
 
806
975
  ### gulpConfig~AdditionalBundleConfig : <code>Object.&lt;string, Setting&gt;</code>
807
- One additional bundle - everything but `name` falls back to the primary bundle's own value when omitted, so an
976
+ One additional bundle - everything but `name` falls back to the primary bundle's own value when omitted, so an
977
+ additional bundle only has to specify what's actually different about it.
808
978
 
809
979
  **Kind**: inner typedef of [<code>gulpConfig</code>](#module_gulpConfig)
810
980
  **Properties**
@@ -861,7 +1031,7 @@ Configurations to minify and copy the images.
861
1031
  <a name="module_gulpConfig..LintConfig"></a>
862
1032
 
863
1033
  ### gulpConfig~LintConfig : <code>Object.&lt;string, Setting&gt;</code>
864
- Configurations for linting (see [module:partials.neostandardLint](module:partials.neostandardLint)).
1034
+ Configurations for linting (see [neostandardLint](#module_partials.neostandardLint)).
865
1035
 
866
1036
  **Kind**: inner typedef of [<code>gulpConfig</code>](#module_gulpConfig)
867
1037
  **Properties**
@@ -890,7 +1060,8 @@ Configurations to compile and generate the Readme file.
890
1060
  <a name="module_gulpConfig..DocsConfig"></a>
891
1061
 
892
1062
  ### gulpConfig~DocsConfig : <code>Object.&lt;string, Setting&gt;</code>
893
- Configurations for generating the HTML documentation of a project's own source, with either TypeDoc (real
1063
+ Configurations for generating the HTML documentation of a project's own source, with either TypeDoc (real
1064
+ TypeScript types) or jsdoc (a modern theme over jsdoc's own classic default) - see docs.method.
894
1065
 
895
1066
  **Kind**: inner typedef of [<code>gulpConfig</code>](#module_gulpConfig)
896
1067
  **Properties**
@@ -898,7 +1069,7 @@ Configurations for generating the HTML documentation of a project's own source,
898
1069
  | Name | Type | Description |
899
1070
  | --- | --- | --- |
900
1071
  | enabled | <code>BooleanSetting</code> | Toggle generating the documentation from the source. When it is on the build does this instead of generating the readme from the jsdoc comments of the compiled files. |
901
- | from | <code>StringSetting</code> | The directory holding the source, each folder in it becomes a module (TypeDoc) or is scanned recursively (jsdoc). |
1072
+ | from | <code>ArrayableSetting</code> | The directory holding the source, each folder in it becomes a module (TypeDoc) or is scanned recursively (jsdoc). jsdoc also takes a list of directories and files. |
902
1073
  | index | <code>StringSetting</code> | The markdown file used as the front page of the documentation. |
903
1074
  | logLevel | <code>StringSetting</code> | How much TypeDoc reports: Verbose, Info, Warn, Error or None. Not used by jsdoc. |
904
1075
  | method | <code>FlagStringSetting</code> | 'typedoc' or 'jsdoc'. False (the default) infers it from typescript.enabled - 'typedoc' when on, 'jsdoc' when off - so an existing TypeScript project's config needs no change to keep working exactly as it already does; set this explicitly to override that inference either way. |
package/dist/build.js CHANGED
@@ -1,73 +1,73 @@
1
- "use strict";
2
-
3
- require("core-js/modules/esnext.weak-map.delete-all.js");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.build = void 0;
8
- var _bundle = require("./bundle.js");
9
- var _bundleMinify = require("./bundleMinify.js");
10
- var _partials = require("./partials.js");
11
- var _compileReadme = require("./compileReadme.js");
12
- var _typeDocs = require("./typeDocs.js");
13
- var _jsdocDocs = require("./jsdocDocs.js");
14
- var _distMinify = require("./distMinify.js");
15
- var _sourceLint = require("./sourceLint.js");
16
- var _gulp = require("gulp");
17
- var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
18
- var _copyFonts = require("./copyFonts.js");
19
- var _images = require("./images.js");
20
- var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
21
- var _sass = require("./sass.js");
22
- var _testFull = require("./testFull.js");
23
- var cache;
24
- function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
1
+ "use strict";
2
+
3
+ require("core-js/modules/esnext.weak-map.delete-all.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.build = void 0;
8
+ var _bundle = require("./bundle.js");
9
+ var _bundleMinify = require("./bundleMinify.js");
10
+ var _partials = require("./partials.js");
11
+ var _compileReadme = require("./compileReadme.js");
12
+ var _typeDocs = require("./typeDocs.js");
13
+ var _jsdocDocs = require("./jsdocDocs.js");
14
+ var _distMinify = require("./distMinify.js");
15
+ var _sourceLint = require("./sourceLint.js");
16
+ var _gulp = require("gulp");
17
+ var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
18
+ var _copyFonts = require("./copyFonts.js");
19
+ var _images = require("./images.js");
20
+ var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
21
+ var _sass = require("./sass.js");
22
+ var _testFull = require("./testFull.js");
23
+ var cache;
24
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
25
25
  /**
26
26
  * Runs several processes to build and validate the project.
27
27
  * Cleans and lints the source, distributes and minifies, bundles and minifies, creates the readme, then runs the
28
28
  * tests.
29
29
  * @memberOf module:js-build-tools
30
30
  * @returns {stream.Stream}
31
- */
32
- const build = (done = null) => {
33
- const buildActions = [(0, _partials.distSeries)(), _distMinify.distMinify];
34
- const generateDocs = gulpConfig.get('docs.enabled');
35
- const docsMethod = (0, _resolveDocsMethod.resolveDocsMethod)();
36
- if (generateDocs) {
37
- // The documentation is generated from the source itself, the readme is written by hand
38
- buildActions.push(docsMethod === 'jsdoc' ? _jsdocDocs.jsdocDocs : _typeDocs.typeDocs);
39
- } else if (gulpConfig.get('typescript.enabled')) {
40
- // For ts usage, we need to run the readme on the dist directly since that is where the .js files are located
41
- buildActions.push(_compileReadme.compileReadme);
42
- }
43
- if (gulpConfig.get('browser.enabled')) {
44
- // If not 'nodeOnly' then we also want to bundle for browser after we complete the dist directory
45
- buildActions.push(_bundle.bundle);
46
- buildActions.push(_bundleMinify.bundleMinify);
47
- }
48
- const runActions = [(0, _gulp.series)(...buildActions)];
49
- if (!generateDocs && !gulpConfig.get('typescript.enabled')) {
50
- // Since we didn't run this in series after dist because of typescript, we need to run it now. Potentially faster here.
51
- runActions.push(_compileReadme.compileReadme);
52
- }
53
- runActions.push(_testFull.testFull);
54
- if (gulpConfig.get('fonts.enabled')) {
55
- // Conditionally add Fonts process
56
- runActions.push(_copyFonts.copyFonts);
57
- }
58
- if (gulpConfig.get('images.enabled')) {
59
- // Conditionally add Images process
60
- runActions.push(_images.images);
61
- }
62
- if (gulpConfig.get('sass.enabled')) {
63
- // Conditionally add SASS process
64
- runActions.push(_sass.sass);
65
- }
66
- // clean has to finish before anything writes into the output folders - images, fonts and sass all write into
67
- // browser/, so running clean in parallel with them races (ENOTEMPTY errors from clean, or output deleted mid-write).
68
- // sourceLint fixes the real source in place before anything compiles from it (distSeries, tsFor inside it), so a
69
- // build never reads a mix of pre- and post-fix content; clean only touches dist/browser output, so the two can
70
- // run alongside each other.
71
- return (0, _gulp.series)((0, _gulp.parallel)(_partials.clean, _sourceLint.sourceLint), (0, _gulp.parallel)(...runActions))(done);
72
- };
31
+ */
32
+ const build = (done = null) => {
33
+ const buildActions = [(0, _partials.distSeries)(), _distMinify.distMinify];
34
+ const generateDocs = gulpConfig.get('docs.enabled');
35
+ const docsMethod = (0, _resolveDocsMethod.resolveDocsMethod)();
36
+ if (generateDocs) {
37
+ // The documentation is generated from the source itself, the readme is written by hand
38
+ buildActions.push(docsMethod === 'jsdoc' ? _jsdocDocs.jsdocDocs : _typeDocs.typeDocs);
39
+ } else if (gulpConfig.get('typescript.enabled')) {
40
+ // For ts usage, we need to run the readme on the dist directly since that is where the .js files are located
41
+ buildActions.push(_compileReadme.compileReadme);
42
+ }
43
+ if (gulpConfig.get('browser.enabled')) {
44
+ // If not 'nodeOnly' then we also want to bundle for browser after we complete the dist directory
45
+ buildActions.push(_bundle.bundle);
46
+ buildActions.push(_bundleMinify.bundleMinify);
47
+ }
48
+ const runActions = [(0, _gulp.series)(...buildActions)];
49
+ if (!generateDocs && !gulpConfig.get('typescript.enabled')) {
50
+ // Since we didn't run this in series after dist because of typescript, we need to run it now. Potentially faster here.
51
+ runActions.push(_compileReadme.compileReadme);
52
+ }
53
+ runActions.push(_testFull.testFull);
54
+ if (gulpConfig.get('fonts.enabled')) {
55
+ // Conditionally add Fonts process
56
+ runActions.push(_copyFonts.copyFonts);
57
+ }
58
+ if (gulpConfig.get('images.enabled')) {
59
+ // Conditionally add Images process
60
+ runActions.push(_images.images);
61
+ }
62
+ if (gulpConfig.get('sass.enabled')) {
63
+ // Conditionally add SASS process
64
+ runActions.push(_sass.sass);
65
+ }
66
+ // clean has to finish before anything writes into the output folders - images, fonts and sass all write into
67
+ // browser/, so running clean in parallel with them races (ENOTEMPTY errors from clean, or output deleted mid-write).
68
+ // sourceLint fixes the real source in place before anything compiles from it (distSeries, tsFor inside it), so a
69
+ // build never reads a mix of pre- and post-fix content; clean only touches dist/browser output, so the two can
70
+ // run alongside each other.
71
+ return (0, _gulp.series)((0, _gulp.parallel)(_partials.clean, _sourceLint.sourceLint), (0, _gulp.parallel)(...runActions))(done);
72
+ };
73
73
  exports.build = build;
package/dist/bundle.js CHANGED
@@ -25,7 +25,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
25
25
  *
26
26
  * A bundle's name does double duty: it names the output file (name.js) and, via browserify's
27
27
  * `standalone` option, is also the name its exports are exposed under - as a global when loaded
28
- * with a bare <script> tag, or as the module when required via CommonJS/AMD. Without this, a
28
+ * with a bare `<script>` tag, or as the module when required via CommonJS/AMD. Without this, a
29
29
  * bundle built from a real entry point (one that actually exports something) builds successfully
30
30
  * but exposes nothing a consumer can reach.
31
31
  *
package/dist/docs.js CHANGED
@@ -1,12 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.docs = void 0;
7
- var _jsdocDocs = require("./jsdocDocs.js");
8
- var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
9
- var _typeDocs = require("./typeDocs.js");
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.docs = void 0;
7
+ var _jsdocDocs = require("./jsdocDocs.js");
8
+ var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
9
+ var _typeDocs = require("./typeDocs.js");
10
10
  /**
11
11
  * Generate the HTML documentation with whichever engine docs.method (or its typescript.enabled-based default)
12
12
  * resolves to - see {@link module:partials.resolveDocsMethod}. The standalone counterpart to build's own
@@ -14,6 +14,6 @@ var _typeDocs = require("./typeDocs.js");
14
14
  * @memberOf module:js-build-tools
15
15
  * @param {Function} [done]
16
16
  * @returns {*}
17
- */
18
- const docs = (done = null) => ((0, _resolveDocsMethod.resolveDocsMethod)() === 'jsdoc' ? _jsdocDocs.jsdocDocs : _typeDocs.typeDocs)(done);
17
+ */
18
+ const docs = (done = null) => ((0, _resolveDocsMethod.resolveDocsMethod)() === 'jsdoc' ? _jsdocDocs.jsdocDocs : _typeDocs.typeDocs)(done);
19
19
  exports.docs = docs;