generator-white-label 3.2.0 → 5.0.0

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 (253) hide show
  1. package/README.md +140 -81
  2. package/app/README.md +19 -0
  3. package/app/assets/font/opensans/stylesheet.css +20 -60
  4. package/app/assets/image/demo/fallback.avif +0 -0
  5. package/app/assets/image/demo/fallback.jpg +0 -0
  6. package/app/assets/image/demo/fallback.webp +0 -0
  7. package/app/assets/image/demo/large.avif +0 -0
  8. package/app/assets/image/demo/large.webp +0 -0
  9. package/app/assets/image/demo/small.avif +0 -0
  10. package/app/assets/image/demo/small.webp +0 -0
  11. package/app/assets/markup/element/iframe.hbs +4 -1
  12. package/app/assets/markup/element/img.hbs +16 -1
  13. package/app/assets/markup/element/picture.hbs +30 -0
  14. package/app/assets/markup/modal/modal-example-1.handlebars +1 -1
  15. package/app/assets/script/api/{facebook.js → facebook.ts} +17 -12
  16. package/app/assets/script/api/youtube.ts +22 -0
  17. package/app/assets/script/index.ts +2 -0
  18. package/app/assets/script/mediator/global.ts +4 -0
  19. package/app/assets/script/model/singletons/countries.ts +5 -0
  20. package/app/assets/script/model/singletons/global.ts +5 -0
  21. package/app/assets/script/model/singletons/states.ts +5 -0
  22. package/app/assets/script/model/user.ts +4 -0
  23. package/app/assets/script/toolkit.ts +11 -0
  24. package/app/assets/script/types.d.ts +16 -0
  25. package/app/assets/script/utility/ajax.ts +15 -0
  26. package/app/assets/script/utility/form.ts +119 -0
  27. package/app/assets/script/utility/{regex.js → regex.ts} +15 -6
  28. package/app/assets/script/utility/share.ts +77 -0
  29. package/app/assets/script/utility/string.ts +148 -0
  30. package/app/assets/script/view/default.tsx +14 -0
  31. package/app/assets/script/view/toolkit/youtube-player-1.ts +31 -0
  32. package/app/assets/style/base/_toolkit.scss +25 -25
  33. package/app/assets/style/base/components/_modal-1.scss +8 -3
  34. package/app/assets/style/base/components/_tabpanel-1.scss +21 -16
  35. package/app/assets/style/base/components/_tabpanel-2.scss +11 -6
  36. package/app/assets/style/base/components/_youtube-player-1.scss +3 -2
  37. package/app/assets/style/base/elements/_anchors.scss +2 -0
  38. package/app/assets/style/base/elements/_buttons.scss +7 -3
  39. package/app/assets/style/base/elements/_fieldsets.scss +2 -0
  40. package/app/assets/style/base/elements/_inputs.scss +6 -2
  41. package/app/assets/style/base/elements/_labels.scss +2 -0
  42. package/app/assets/style/base/elements/_legends.scss +2 -0
  43. package/app/assets/style/base/elements/_lists.scss +2 -0
  44. package/app/assets/style/base/elements/_tables.scss +10 -6
  45. package/app/assets/style/base/layouts/_staggered-1.scss +4 -1
  46. package/app/assets/style/base/type/_fonts.scss +4 -1
  47. package/app/assets/style/base/type/_headings.scss +3 -0
  48. package/app/assets/style/base/type/_text.scss +2 -0
  49. package/app/assets/style/base/utilities/_accessibility.scss +5 -2
  50. package/app/assets/style/base/utilities/_functions.scss +62 -9
  51. package/app/assets/style/global.scss +4 -11
  52. package/app/assets/style/print.scss +1 -4
  53. package/app/assets/style/toolkit.scss +37 -37
  54. package/app/package.json +1 -0
  55. package/app/toolkit/colors.hbs +11 -11
  56. package/app/toolkit/components.hbs +16 -16
  57. package/app/toolkit/elements.hbs +52 -43
  58. package/app/toolkit/grids.hbs +111 -111
  59. package/app/toolkit/icons.hbs +2 -2
  60. package/app/toolkit/index.hbs +6 -6
  61. package/app/toolkit/type.hbs +4 -4
  62. package/dist/app/assets/data/coutries.json +992 -0
  63. package/dist/app/assets/data/states.json +204 -0
  64. package/dist/app/assets/script/api/facebook.d.ts +8 -0
  65. package/dist/app/assets/script/api/facebook.js +42 -0
  66. package/dist/app/assets/script/api/facebook.js.map +1 -0
  67. package/dist/app/assets/script/api/youtube.d.ts +8 -0
  68. package/dist/app/assets/script/api/youtube.js +22 -0
  69. package/dist/app/assets/script/api/youtube.js.map +1 -0
  70. package/dist/app/assets/script/index.d.ts +2 -0
  71. package/dist/app/assets/script/index.js +2 -0
  72. package/dist/app/assets/script/index.js.map +1 -0
  73. package/dist/app/assets/script/mediator/global.d.ts +4 -0
  74. package/dist/app/assets/script/mediator/global.js +4 -0
  75. package/dist/app/assets/script/mediator/global.js.map +1 -0
  76. package/dist/app/assets/script/model/singletons/countries.d.ts +20 -0
  77. package/dist/app/assets/script/model/singletons/countries.js +5 -0
  78. package/dist/app/assets/script/model/singletons/countries.js.map +1 -0
  79. package/dist/app/assets/script/model/singletons/global.d.ts +20 -0
  80. package/dist/app/assets/script/model/singletons/global.js +5 -0
  81. package/dist/app/assets/script/model/singletons/global.js.map +1 -0
  82. package/dist/app/assets/script/model/singletons/states.d.ts +20 -0
  83. package/dist/app/assets/script/model/singletons/states.js +5 -0
  84. package/dist/app/assets/script/model/singletons/states.js.map +1 -0
  85. package/dist/app/assets/script/model/user.d.ts +4 -0
  86. package/dist/app/assets/script/model/user.js +6 -0
  87. package/dist/app/assets/script/model/user.js.map +1 -0
  88. package/dist/app/assets/script/toolkit.d.ts +1 -0
  89. package/dist/app/assets/script/toolkit.js +7 -0
  90. package/dist/app/assets/script/toolkit.js.map +1 -0
  91. package/dist/app/assets/script/utility/ajax.d.ts +8 -0
  92. package/dist/app/assets/script/utility/ajax.js +17 -0
  93. package/dist/app/assets/script/utility/ajax.js.map +1 -0
  94. package/dist/app/assets/script/utility/form.d.ts +64 -0
  95. package/dist/app/assets/script/utility/form.js +111 -0
  96. package/dist/app/assets/script/utility/form.js.map +1 -0
  97. package/dist/app/assets/script/utility/regex.d.ts +14 -0
  98. package/dist/app/assets/script/utility/regex.js +27 -0
  99. package/dist/app/assets/script/utility/regex.js.map +1 -0
  100. package/dist/app/assets/script/utility/share.d.ts +68 -0
  101. package/dist/app/assets/script/utility/share.js +81 -0
  102. package/dist/app/assets/script/utility/share.js.map +1 -0
  103. package/dist/app/assets/script/utility/string.d.ts +64 -0
  104. package/dist/app/assets/script/utility/string.js +135 -0
  105. package/dist/app/assets/script/utility/string.js.map +1 -0
  106. package/dist/app/assets/script/view/default.d.ts +11 -0
  107. package/dist/app/assets/script/view/default.js +15 -0
  108. package/dist/app/assets/script/view/default.js.map +1 -0
  109. package/dist/app/assets/script/view/toolkit/youtube-player-1.d.ts +23 -0
  110. package/dist/app/assets/script/view/toolkit/youtube-player-1.js +32 -0
  111. package/dist/app/assets/script/view/toolkit/youtube-player-1.js.map +1 -0
  112. package/dist/generators/app/index.d.ts +18 -0
  113. package/dist/generators/app/index.js +59 -0
  114. package/dist/generators/app/index.js.map +1 -0
  115. package/dist/scripts/build.d.ts +22 -0
  116. package/dist/scripts/build.js +158 -0
  117. package/dist/scripts/build.js.map +1 -0
  118. package/generators/app/index.js +2 -43
  119. package/generators/app/index.ts +61 -0
  120. package/package.json +79 -129
  121. package/scripts/build.ts +175 -0
  122. package/tsconfig.site.json +26 -0
  123. package/.babelrc +0 -14
  124. package/.editorconfig +0 -13
  125. package/.eslintrc +0 -64
  126. package/.htmllintrc +0 -6
  127. package/.sass-lint.yml +0 -16
  128. package/.travis.yml +0 -18
  129. package/app/assets/font/opensans/generator_config.txt +0 -5
  130. package/app/assets/font/opensans/opensans-bold-webfont.eot +0 -0
  131. package/app/assets/font/opensans/opensans-bold-webfont.svg +0 -1824
  132. package/app/assets/font/opensans/opensans-bold-webfont.ttf +0 -0
  133. package/app/assets/font/opensans/opensans-bold-webfont.woff +0 -0
  134. package/app/assets/font/opensans/opensans-bolditalic-webfont.eot +0 -0
  135. package/app/assets/font/opensans/opensans-bolditalic-webfont.svg +0 -1824
  136. package/app/assets/font/opensans/opensans-bolditalic-webfont.ttf +0 -0
  137. package/app/assets/font/opensans/opensans-bolditalic-webfont.woff +0 -0
  138. package/app/assets/font/opensans/opensans-extrabold-webfont.eot +0 -0
  139. package/app/assets/font/opensans/opensans-extrabold-webfont.svg +0 -1824
  140. package/app/assets/font/opensans/opensans-extrabold-webfont.ttf +0 -0
  141. package/app/assets/font/opensans/opensans-extrabold-webfont.woff +0 -0
  142. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.eot +0 -0
  143. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.svg +0 -1824
  144. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.ttf +0 -0
  145. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.woff +0 -0
  146. package/app/assets/font/opensans/opensans-italic-webfont.eot +0 -0
  147. package/app/assets/font/opensans/opensans-italic-webfont.svg +0 -1824
  148. package/app/assets/font/opensans/opensans-italic-webfont.ttf +0 -0
  149. package/app/assets/font/opensans/opensans-italic-webfont.woff +0 -0
  150. package/app/assets/font/opensans/opensans-light-webfont.eot +0 -0
  151. package/app/assets/font/opensans/opensans-light-webfont.svg +0 -1824
  152. package/app/assets/font/opensans/opensans-light-webfont.ttf +0 -0
  153. package/app/assets/font/opensans/opensans-light-webfont.woff +0 -0
  154. package/app/assets/font/opensans/opensans-lightitalic-webfont.eot +0 -0
  155. package/app/assets/font/opensans/opensans-lightitalic-webfont.svg +0 -1824
  156. package/app/assets/font/opensans/opensans-lightitalic-webfont.ttf +0 -0
  157. package/app/assets/font/opensans/opensans-lightitalic-webfont.woff +0 -0
  158. package/app/assets/font/opensans/opensans-regular-webfont.eot +0 -0
  159. package/app/assets/font/opensans/opensans-regular-webfont.svg +0 -1824
  160. package/app/assets/font/opensans/opensans-regular-webfont.ttf +0 -0
  161. package/app/assets/font/opensans/opensans-regular-webfont.woff +0 -0
  162. package/app/assets/font/opensans/opensans-semibold-webfont.eot +0 -0
  163. package/app/assets/font/opensans/opensans-semibold-webfont.svg +0 -1824
  164. package/app/assets/font/opensans/opensans-semibold-webfont.ttf +0 -0
  165. package/app/assets/font/opensans/opensans-semibold-webfont.woff +0 -0
  166. package/app/assets/font/opensans/opensans-semibolditalic-webfont.eot +0 -0
  167. package/app/assets/font/opensans/opensans-semibolditalic-webfont.svg +0 -1824
  168. package/app/assets/font/opensans/opensans-semibolditalic-webfont.ttf +0 -0
  169. package/app/assets/font/opensans/opensans-semibolditalic-webfont.woff +0 -0
  170. package/app/assets/font/opensans/specimen_files/grid_12-825-55-15.css +0 -129
  171. package/app/assets/font/opensans/specimen_files/specimen_stylesheet.css +0 -396
  172. package/app/assets/image/demo/large.jpg +0 -0
  173. package/app/assets/image/demo/medium.jpg +0 -0
  174. package/app/assets/image/demo/small.jpg +0 -0
  175. package/app/assets/image/demo/xlarge.jpg +0 -0
  176. package/app/assets/image/demo/xxlarge.jpg +0 -0
  177. package/app/assets/script/api/youtube.js +0 -18
  178. package/app/assets/script/index.js +0 -6
  179. package/app/assets/script/mediator/global.js +0 -5
  180. package/app/assets/script/model/singletons/countries.js +0 -6
  181. package/app/assets/script/model/singletons/global.js +0 -6
  182. package/app/assets/script/model/singletons/states.js +0 -6
  183. package/app/assets/script/model/user.js +0 -5
  184. package/app/assets/script/toolkit.js +0 -12
  185. package/app/assets/script/utility/ajax.js +0 -11
  186. package/app/assets/script/utility/form.js +0 -86
  187. package/app/assets/script/utility/share.js +0 -52
  188. package/app/assets/script/utility/string.js +0 -70
  189. package/app/assets/script/view/default.js +0 -11
  190. package/app/assets/script/view/toolkit/youtube-player-1.js +0 -17
  191. package/app/assets/style/base/vendor/_foundation.scss +0 -2
  192. package/app/assets/test/spec/shareSpec.js +0 -137
  193. package/app/index.html +0 -40
  194. package/app/report/istanbul/base.css +0 -213
  195. package/app/report/istanbul/prettify.css +0 -1
  196. package/app/report/istanbul/prettify.js +0 -1
  197. package/app/report/istanbul/sort-arrow-sprite.png +0 -0
  198. package/app/report/istanbul/sorter.js +0 -158
  199. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.eot +0 -0
  200. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.svg +0 -288
  201. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.ttf +0 -0
  202. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.woff +0 -0
  203. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.woff2 +0 -0
  204. package/app/report/jsdoc/img/glyphicons-halflings-white.png +0 -0
  205. package/app/report/jsdoc/img/glyphicons-halflings.png +0 -0
  206. package/app/report/jsdoc/scripts/docstrap.lib.js +0 -11
  207. package/app/report/jsdoc/scripts/fulltext-search-ui.js +0 -89
  208. package/app/report/jsdoc/scripts/fulltext-search.js +0 -36
  209. package/app/report/jsdoc/scripts/lunr.min.js +0 -6
  210. package/app/report/jsdoc/scripts/prettify/Apache-License-2.0.txt +0 -202
  211. package/app/report/jsdoc/scripts/prettify/jquery.min.js +0 -6
  212. package/app/report/jsdoc/scripts/prettify/lang-css.js +0 -21
  213. package/app/report/jsdoc/scripts/prettify/prettify.js +0 -496
  214. package/app/report/jsdoc/scripts/sunlight.js +0 -1157
  215. package/app/report/jsdoc/scripts/toc.js +0 -203
  216. package/app/report/jsdoc/styles/darkstrap.css +0 -960
  217. package/app/report/jsdoc/styles/prettify-tomorrow.css +0 -132
  218. package/app/report/jsdoc/styles/site.cerulean.css +0 -7008
  219. package/app/report/jsdoc/styles/site.cosmo.css +0 -7061
  220. package/app/report/jsdoc/styles/site.cyborg.css +0 -7048
  221. package/app/report/jsdoc/styles/site.darkly.css +0 -7171
  222. package/app/report/jsdoc/styles/site.darkstrap.css +0 -5638
  223. package/app/report/jsdoc/styles/site.dibs-bootstrap.css +0 -5899
  224. package/app/report/jsdoc/styles/site.flatly.css +0 -7147
  225. package/app/report/jsdoc/styles/site.journal.css +0 -6973
  226. package/app/report/jsdoc/styles/site.lumen.css +0 -7298
  227. package/app/report/jsdoc/styles/site.paper.css +0 -7623
  228. package/app/report/jsdoc/styles/site.readable.css +0 -6997
  229. package/app/report/jsdoc/styles/site.sandstone.css +0 -7035
  230. package/app/report/jsdoc/styles/site.simplex.css +0 -7023
  231. package/app/report/jsdoc/styles/site.slate.css +0 -7343
  232. package/app/report/jsdoc/styles/site.spacelab.css +0 -7055
  233. package/app/report/jsdoc/styles/site.superhero.css +0 -7131
  234. package/app/report/jsdoc/styles/site.united.css +0 -6895
  235. package/app/report/jsdoc/styles/site.yeti.css +0 -7195
  236. package/app/report/jsdoc/styles/sunlight.dark.css +0 -345
  237. package/app/report/jsdoc/styles/sunlight.default.css +0 -344
  238. package/gulp/config.js +0 -224
  239. package/gulp/tasks/accessibility.js +0 -34
  240. package/gulp/tasks/build.js +0 -19
  241. package/gulp/tasks/clean.js +0 -34
  242. package/gulp/tasks/data.js +0 -22
  243. package/gulp/tasks/default.js +0 -9
  244. package/gulp/tasks/deploy.js +0 -225
  245. package/gulp/tasks/documentation.js +0 -25
  246. package/gulp/tasks/markup.js +0 -121
  247. package/gulp/tasks/script.js +0 -92
  248. package/gulp/tasks/style.js +0 -42
  249. package/gulp/tasks/unit.js +0 -38
  250. package/gulp/tasks/watch.js +0 -83
  251. package/gulpfile.js +0 -8
  252. package/jsdoc.json +0 -23
  253. package/karma.conf.js +0 -58
@@ -0,0 +1,175 @@
1
+ /** Values injected into page templates and the generated config file. */
2
+ export interface BuildConfig {cdn: string; production: boolean; service: string; version: string; www: string}
3
+ import fs from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import {fileURLToPath} from 'node:url';
6
+ import {build as buildJavaScript} from 'esbuild';
7
+ import Handlebars from 'handlebars';
8
+ import * as sass from 'sass';
9
+
10
+ const defaultProjectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
11
+
12
+ /**
13
+ * Read deployment flags and reject version strings that contain path separators.
14
+ * @param argumentsList - Command-line arguments excluding the Node executable and script.
15
+ * @returns Deployment configuration with defaults for omitted flags.
16
+ * @throws When input does not satisfy the documented contract.
17
+ */
18
+ export function parseArguments(argumentsList: string[]): BuildConfig {
19
+ const values = Object.fromEntries(argumentsList.map((argument) => {
20
+ const [key, ...value] = argument.replace(/^--/, '').split('=');
21
+ return [key, value.join('=')];
22
+ }));
23
+ const version = values.version || String(Math.floor(Date.now() / 1000));
24
+ if (!/^[A-Za-z0-9._-]+$/.test(version)) {
25
+ throw new Error('Version may contain only letters, numbers, dots, underscores, and hyphens');
26
+ }
27
+ return {
28
+ cdn: values.cdn || '/',
29
+ production: values.production === 'true',
30
+ service: values.service || '/service-endpoint',
31
+ version,
32
+ www: values.www || '/'
33
+ };
34
+ }
35
+
36
+ /**
37
+ * Recursively collect files below a directory, propagating filesystem failures.
38
+ * @param directory - Directory to traverse recursively.
39
+ * @returns A promise resolving to all descendant file paths.
40
+ */
41
+ async function filesUnder(directory: string): Promise<string[]> {
42
+ const entries = await fs.readdir(directory, {withFileTypes: true});
43
+ const files = await Promise.all(entries.map(async (entry) => {
44
+ const location = path.join(directory, entry.name);
45
+ return entry.isDirectory() ? filesUnder(location) : [location];
46
+ }));
47
+ return files.flat();
48
+ }
49
+
50
+ /**
51
+ * Register partials and render pages using global, page-specific, and deployment data.
52
+ * @param config - Validated deployment or database configuration.
53
+ * @param outputRoot - Destination for rendered pages.
54
+ * @param projectRoot - Project containing app sources and installed dependencies.
55
+ * @returns A promise resolving after all pages have been written.
56
+ */
57
+ async function renderMarkup(config: BuildConfig, outputRoot: string, projectRoot: string) {
58
+ const markupRoot = path.join(projectRoot, 'app/assets/markup');
59
+ for (const partialPath of await filesUnder(markupRoot)) {
60
+ if (/\.(hbs|handlebars)$/.test(partialPath)) {
61
+ const name = path.relative(markupRoot, partialPath).replace(/\\/g, '/').replace(/\.(hbs|handlebars)$/, '');
62
+ Handlebars.registerPartial(name, await fs.readFile(partialPath, 'utf8'));
63
+ }
64
+ }
65
+
66
+ const globalData = JSON.parse(await fs.readFile(
67
+ path.join(projectRoot, 'app/assets/data/view/global.json'), 'utf8'
68
+ ));
69
+ const pages = (await filesUnder(path.join(projectRoot, 'app')))
70
+ .filter((file) => file.endsWith('.hbs') && !file.includes(`${path.sep}assets${path.sep}`));
71
+
72
+ await Promise.all(pages.map(async (page) => {
73
+ const relative = path.relative(path.join(projectRoot, 'app'), page);
74
+ const pageDataPath = path.join(
75
+ projectRoot, 'app/assets/data/view', relative.replace(/\.hbs$/, '.json')
76
+ );
77
+ let pageData = {};
78
+ try {
79
+ pageData = JSON.parse(await fs.readFile(pageDataPath, 'utf8'));
80
+ } catch (error) {
81
+ if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) {
82
+ throw error;
83
+ }
84
+ }
85
+ const template = Handlebars.compile(await fs.readFile(page, 'utf8'));
86
+ const destination = path.join(outputRoot, relative.replace(/\.hbs$/, '.html'));
87
+ await fs.mkdir(path.dirname(destination), {recursive: true});
88
+ await fs.writeFile(destination, template({...globalData, ...pageData, ...config}));
89
+ }));
90
+ }
91
+
92
+ /**
93
+ * Compile project Sass and include the full published Bootstrap stylesheet.
94
+ * @param outputAssets - Destination for compiled asset directories.
95
+ * @param production - Enable compressed output and omit development source maps.
96
+ * @param projectRoot - Project containing app sources and installed dependencies.
97
+ * @returns A promise resolving after all stylesheets have been written.
98
+ */
99
+ async function compileStyles(outputAssets: string, production: boolean, projectRoot: string) {
100
+ const styleRoot = path.join(projectRoot, 'app/assets/style');
101
+ await Promise.all(['global', 'print', 'toolkit'].map(async (name) => {
102
+ const result = sass.compile(path.join(styleRoot, `${name}.scss`), {
103
+ loadPaths: [path.join(projectRoot, 'node_modules')],
104
+ style: production ? 'compressed' : 'expanded'
105
+ });
106
+ const destination = path.join(outputAssets, 'style', `${name}.css`);
107
+ await fs.mkdir(path.dirname(destination), {recursive: true});
108
+ // Bootstrap publishes compiled CSS, so consuming it avoids recompiling third-party
109
+ // Sass and keeps dependency deprecation warnings out of project builds.
110
+ const bootstrapSource = name === 'global'
111
+ ? (await fs.readFile(
112
+ path.join(projectRoot, 'node_modules/bootstrap/dist/css/bootstrap.css'), 'utf8'
113
+ )).replace(/\/\*# sourceMappingURL=bootstrap\.css\.map \*\//, '')
114
+ : '';
115
+ const bootstrapCss = production && bootstrapSource
116
+ ? sass.compileString(bootstrapSource, {style: 'compressed', syntax: 'css'}).css
117
+ : bootstrapSource;
118
+ await fs.writeFile(destination, `${bootstrapCss}${bootstrapCss ? '\n' : ''}${result.css}`);
119
+ }));
120
+ }
121
+
122
+ /**
123
+ * Bundle TypeScript entry points for browsers, excluding declaration-only files.
124
+ * @param outputAssets - Destination for compiled asset directories.
125
+ * @param production - Enable compressed output and omit development source maps.
126
+ * @param projectRoot - Project containing app sources and installed dependencies.
127
+ * @returns A promise resolving after all script bundles have been written.
128
+ */
129
+ async function compileScripts(outputAssets: string, production: boolean, projectRoot: string) {
130
+ const scriptRoot = path.join(projectRoot, 'app/assets/script');
131
+ const entries = (await fs.readdir(scriptRoot, {withFileTypes: true}))
132
+ .filter((entry) => entry.isFile() && !entry.name.endsWith('.d.ts') && /\.tsx?$/.test(entry.name))
133
+ .map((entry) => path.join(scriptRoot, entry.name));
134
+ await fs.mkdir(path.join(outputAssets, 'script'), {recursive: true});
135
+ await buildJavaScript({
136
+ bundle: true,
137
+ entryNames: '[name].compiled',
138
+ entryPoints: entries,
139
+ format: 'iife',
140
+ loader: {'.ts': 'ts', '.tsx': 'tsx'},
141
+ minify: production,
142
+ outdir: path.join(outputAssets, 'script'),
143
+ sourcemap: !production,
144
+ target: ['es2018']
145
+ });
146
+ await fs.writeFile(path.join(outputAssets, 'script/global.compiled.js'), '');
147
+ }
148
+
149
+ /**
150
+ * Replace the project deployment directory with compiled pages, scripts, styles, and static assets.
151
+ * @param config - Validated deployment or database configuration.
152
+ * @param projectRoot - Project containing app sources and installed dependencies.
153
+ * @returns A promise resolving after the deployment directory has been rebuilt.
154
+ */
155
+ export async function build(config = parseArguments(process.argv.slice(2)), projectRoot = defaultProjectRoot) {
156
+ const outputRoot = path.join(projectRoot, '_deploy');
157
+ const outputAssets = path.join(outputRoot, 'release', config.version, 'assets');
158
+ await fs.rm(outputRoot, {recursive: true, force: true});
159
+ await fs.mkdir(outputAssets, {recursive: true});
160
+
161
+ await Promise.all([
162
+ fs.cp(path.join(projectRoot, 'app/assets/data'), path.join(outputAssets, 'data'), {recursive: true}),
163
+ fs.cp(path.join(projectRoot, 'app/assets/font'), path.join(outputAssets, 'font'), {recursive: true}),
164
+ fs.cp(path.join(projectRoot, 'app/assets/image'), path.join(outputAssets, 'image'), {recursive: true})
165
+ ]);
166
+ await fs.writeFile(path.join(outputAssets, 'data/config.json'), JSON.stringify(config));
167
+ await renderMarkup(config, outputRoot, projectRoot);
168
+ await compileStyles(outputAssets, config.production, projectRoot);
169
+ await compileScripts(outputAssets, config.production, projectRoot);
170
+ await fs.copyFile(path.join(projectRoot, 'app/robots.txt'), path.join(outputRoot, 'robots.txt'));
171
+ }
172
+
173
+ if (path.resolve(process.argv[1] || '') === fileURLToPath(import.meta.url)) {
174
+ await build();
175
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "declaration": true,
9
+ "sourceMap": true,
10
+ "inlineSources": true,
11
+ "outDir": "dist",
12
+ "rootDir": ".",
13
+ "jsx": "react-jsx",
14
+ "resolveJsonModule": true,
15
+ "types": [
16
+ "node",
17
+ "react"
18
+ ],
19
+ "noEmitOnError": true
20
+ },
21
+ "include": [
22
+ "scripts/**/*.ts",
23
+ "app/assets/script/**/*.ts",
24
+ "app/assets/script/**/*.tsx"
25
+ ]
26
+ }
package/.babelrc DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "presets": [
3
- "react",
4
- ["env", {
5
- "targets": {
6
- "browsers": ["last 2 versions", "Firefox ESR", "Explorer 11"]
7
- }
8
- }]
9
- ],
10
- "plugins": [
11
- "transform-es2015-modules-umd",
12
- "transform-es2015-modules-commonjs"
13
- ]
14
- }
package/.editorconfig DELETED
@@ -1,13 +0,0 @@
1
- # EditorConfig is awesome: http://EditorConfig.org
2
-
3
- root = true
4
-
5
- [*]
6
- end_of_line = lf
7
- insert_final_newline = true
8
- charset = utf-8
9
- indent_style = space
10
- indent_size = 4
11
- max_line_length = 120
12
- quote_type = single
13
- indent_brace_style = K&R
package/.eslintrc DELETED
@@ -1,64 +0,0 @@
1
- {
2
- "env":{
3
- "node":true,
4
- "browser":true,
5
- "jasmine":true,
6
- "amd":true,
7
- "es6":true
8
- },
9
- "extends":"eslint:recommended",
10
- "globals":{
11
- },
12
- "plugins":[
13
- "react"
14
- ],
15
- "parserOptions":{
16
- "sourceType":"module",
17
- "ecmaFeatures":{
18
- "jsx": true
19
- }
20
- },
21
- "rules":{
22
- "no-console":1,
23
- "curly":2,
24
- "comma-dangle":[
25
- 2,
26
- "never"
27
- ],
28
- "strict":[
29
- 0,
30
- "function"
31
- ],
32
- "camelcase":[
33
- 2,
34
- {
35
- "properties":"always"
36
- }
37
- ],
38
- "quotes":[
39
- 2,
40
- "single"
41
- ],
42
- "no-multiple-empty-lines":2,
43
- "space-before-function-paren":[
44
- 2,
45
- "never"
46
- ],
47
- "indent":[
48
- 2,
49
- 4
50
- ],
51
- "max-len":[
52
- 2,
53
- 120,
54
- 4
55
- ],
56
- "max-params":[
57
- 2,
58
- 3
59
- ],
60
- "no-unused-vars":[
61
- 0
62
- ]
63
- }
64
- }
package/.htmllintrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "id-class-style": false,
3
- "attr-name-style": false,
4
- "attr-req-value": false,
5
- "tag-close": false
6
- }
package/.sass-lint.yml DELETED
@@ -1,16 +0,0 @@
1
- # Linter Options
2
- options:
3
- merge-default-rules: true
4
-
5
- # Rule Configuration
6
- rules:
7
- force-attribute-nesting: 0
8
- force-pseudo-nesting: 0
9
- property-sort-order: 2
10
- quotes: 2
11
- indentation:
12
- - 2
13
- - size: 4
14
- nesting-depth:
15
- - 1
16
- - max-depth: 5
package/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- language: node_js
2
- env:
3
- - CXX=g++-4.8
4
- addons:
5
- apt:
6
- sources:
7
- - ubuntu-toolchain-r-test
8
- packages:
9
- - g++-4.8
10
- node_js:
11
- - 7
12
- - 6
13
- - 5
14
- - 4
15
- before_script:
16
- - npm install -g gulp-cli
17
- script:
18
- - npm test
@@ -1,5 +0,0 @@
1
- # Font Squirrel Font-face Generator Configuration File
2
- # Upload this file to the generator to recreate the settings
3
- # you used to create these fonts.
4
-
5
- {"mode":"optimal","formats":["ttf","woff","woff2","eotz"],"tt_instructor":"default","fix_gasp":"xy","fix_vertical_metrics":"Y","metrics_ascent":"","metrics_descent":"","metrics_linegap":"","add_spaces":"Y","add_hyphens":"Y","fallback":"none","fallback_custom":"100","options_subset":"basic","subset_custom":"","subset_custom_range":"","subset_ot_features_list":"","css_stylesheet":"stylesheet.css","filename_suffix":"-webfont","emsquare":"2048","spacing_adjustment":"0"}