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.
- package/README.md +140 -81
- package/app/README.md +19 -0
- package/app/assets/font/opensans/stylesheet.css +20 -60
- package/app/assets/image/demo/fallback.avif +0 -0
- package/app/assets/image/demo/fallback.jpg +0 -0
- package/app/assets/image/demo/fallback.webp +0 -0
- package/app/assets/image/demo/large.avif +0 -0
- package/app/assets/image/demo/large.webp +0 -0
- package/app/assets/image/demo/small.avif +0 -0
- package/app/assets/image/demo/small.webp +0 -0
- package/app/assets/markup/element/iframe.hbs +4 -1
- package/app/assets/markup/element/img.hbs +16 -1
- package/app/assets/markup/element/picture.hbs +30 -0
- package/app/assets/markup/modal/modal-example-1.handlebars +1 -1
- package/app/assets/script/api/{facebook.js → facebook.ts} +17 -12
- package/app/assets/script/api/youtube.ts +22 -0
- package/app/assets/script/index.ts +2 -0
- package/app/assets/script/mediator/global.ts +4 -0
- package/app/assets/script/model/singletons/countries.ts +5 -0
- package/app/assets/script/model/singletons/global.ts +5 -0
- package/app/assets/script/model/singletons/states.ts +5 -0
- package/app/assets/script/model/user.ts +4 -0
- package/app/assets/script/toolkit.ts +11 -0
- package/app/assets/script/types.d.ts +16 -0
- package/app/assets/script/utility/ajax.ts +15 -0
- package/app/assets/script/utility/form.ts +119 -0
- package/app/assets/script/utility/{regex.js → regex.ts} +15 -6
- package/app/assets/script/utility/share.ts +77 -0
- package/app/assets/script/utility/string.ts +148 -0
- package/app/assets/script/view/default.tsx +14 -0
- package/app/assets/script/view/toolkit/youtube-player-1.ts +31 -0
- package/app/assets/style/base/_toolkit.scss +25 -25
- package/app/assets/style/base/components/_modal-1.scss +8 -3
- package/app/assets/style/base/components/_tabpanel-1.scss +21 -16
- package/app/assets/style/base/components/_tabpanel-2.scss +11 -6
- package/app/assets/style/base/components/_youtube-player-1.scss +3 -2
- package/app/assets/style/base/elements/_anchors.scss +2 -0
- package/app/assets/style/base/elements/_buttons.scss +7 -3
- package/app/assets/style/base/elements/_fieldsets.scss +2 -0
- package/app/assets/style/base/elements/_inputs.scss +6 -2
- package/app/assets/style/base/elements/_labels.scss +2 -0
- package/app/assets/style/base/elements/_legends.scss +2 -0
- package/app/assets/style/base/elements/_lists.scss +2 -0
- package/app/assets/style/base/elements/_tables.scss +10 -6
- package/app/assets/style/base/layouts/_staggered-1.scss +4 -1
- package/app/assets/style/base/type/_fonts.scss +4 -1
- package/app/assets/style/base/type/_headings.scss +3 -0
- package/app/assets/style/base/type/_text.scss +2 -0
- package/app/assets/style/base/utilities/_accessibility.scss +5 -2
- package/app/assets/style/base/utilities/_functions.scss +62 -9
- package/app/assets/style/global.scss +4 -11
- package/app/assets/style/print.scss +1 -4
- package/app/assets/style/toolkit.scss +37 -37
- package/app/package.json +1 -0
- package/app/toolkit/colors.hbs +11 -11
- package/app/toolkit/components.hbs +16 -16
- package/app/toolkit/elements.hbs +52 -43
- package/app/toolkit/grids.hbs +111 -111
- package/app/toolkit/icons.hbs +2 -2
- package/app/toolkit/index.hbs +6 -6
- package/app/toolkit/type.hbs +4 -4
- package/dist/app/assets/data/coutries.json +992 -0
- package/dist/app/assets/data/states.json +204 -0
- package/dist/app/assets/script/api/facebook.d.ts +8 -0
- package/dist/app/assets/script/api/facebook.js +42 -0
- package/dist/app/assets/script/api/facebook.js.map +1 -0
- package/dist/app/assets/script/api/youtube.d.ts +8 -0
- package/dist/app/assets/script/api/youtube.js +22 -0
- package/dist/app/assets/script/api/youtube.js.map +1 -0
- package/dist/app/assets/script/index.d.ts +2 -0
- package/dist/app/assets/script/index.js +2 -0
- package/dist/app/assets/script/index.js.map +1 -0
- package/dist/app/assets/script/mediator/global.d.ts +4 -0
- package/dist/app/assets/script/mediator/global.js +4 -0
- package/dist/app/assets/script/mediator/global.js.map +1 -0
- package/dist/app/assets/script/model/singletons/countries.d.ts +20 -0
- package/dist/app/assets/script/model/singletons/countries.js +5 -0
- package/dist/app/assets/script/model/singletons/countries.js.map +1 -0
- package/dist/app/assets/script/model/singletons/global.d.ts +20 -0
- package/dist/app/assets/script/model/singletons/global.js +5 -0
- package/dist/app/assets/script/model/singletons/global.js.map +1 -0
- package/dist/app/assets/script/model/singletons/states.d.ts +20 -0
- package/dist/app/assets/script/model/singletons/states.js +5 -0
- package/dist/app/assets/script/model/singletons/states.js.map +1 -0
- package/dist/app/assets/script/model/user.d.ts +4 -0
- package/dist/app/assets/script/model/user.js +6 -0
- package/dist/app/assets/script/model/user.js.map +1 -0
- package/dist/app/assets/script/toolkit.d.ts +1 -0
- package/dist/app/assets/script/toolkit.js +7 -0
- package/dist/app/assets/script/toolkit.js.map +1 -0
- package/dist/app/assets/script/utility/ajax.d.ts +8 -0
- package/dist/app/assets/script/utility/ajax.js +17 -0
- package/dist/app/assets/script/utility/ajax.js.map +1 -0
- package/dist/app/assets/script/utility/form.d.ts +64 -0
- package/dist/app/assets/script/utility/form.js +111 -0
- package/dist/app/assets/script/utility/form.js.map +1 -0
- package/dist/app/assets/script/utility/regex.d.ts +14 -0
- package/dist/app/assets/script/utility/regex.js +27 -0
- package/dist/app/assets/script/utility/regex.js.map +1 -0
- package/dist/app/assets/script/utility/share.d.ts +68 -0
- package/dist/app/assets/script/utility/share.js +81 -0
- package/dist/app/assets/script/utility/share.js.map +1 -0
- package/dist/app/assets/script/utility/string.d.ts +64 -0
- package/dist/app/assets/script/utility/string.js +135 -0
- package/dist/app/assets/script/utility/string.js.map +1 -0
- package/dist/app/assets/script/view/default.d.ts +11 -0
- package/dist/app/assets/script/view/default.js +15 -0
- package/dist/app/assets/script/view/default.js.map +1 -0
- package/dist/app/assets/script/view/toolkit/youtube-player-1.d.ts +23 -0
- package/dist/app/assets/script/view/toolkit/youtube-player-1.js +32 -0
- package/dist/app/assets/script/view/toolkit/youtube-player-1.js.map +1 -0
- package/dist/generators/app/index.d.ts +18 -0
- package/dist/generators/app/index.js +59 -0
- package/dist/generators/app/index.js.map +1 -0
- package/dist/scripts/build.d.ts +22 -0
- package/dist/scripts/build.js +158 -0
- package/dist/scripts/build.js.map +1 -0
- package/generators/app/index.js +2 -43
- package/generators/app/index.ts +61 -0
- package/package.json +79 -129
- package/scripts/build.ts +175 -0
- package/tsconfig.site.json +26 -0
- package/.babelrc +0 -14
- package/.editorconfig +0 -13
- package/.eslintrc +0 -64
- package/.htmllintrc +0 -6
- package/.sass-lint.yml +0 -16
- package/.travis.yml +0 -18
- package/app/assets/font/opensans/generator_config.txt +0 -5
- package/app/assets/font/opensans/opensans-bold-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-bold-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-bold-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-bold-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-bolditalic-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-bolditalic-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-bolditalic-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-bolditalic-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-extrabold-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-extrabold-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-extrabold-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-extrabold-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-extrabolditalic-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-extrabolditalic-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-extrabolditalic-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-extrabolditalic-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-italic-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-italic-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-italic-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-italic-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-light-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-light-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-light-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-light-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-lightitalic-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-lightitalic-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-lightitalic-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-lightitalic-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-regular-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-regular-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-regular-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-regular-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-semibold-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-semibold-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-semibold-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-semibold-webfont.woff +0 -0
- package/app/assets/font/opensans/opensans-semibolditalic-webfont.eot +0 -0
- package/app/assets/font/opensans/opensans-semibolditalic-webfont.svg +0 -1824
- package/app/assets/font/opensans/opensans-semibolditalic-webfont.ttf +0 -0
- package/app/assets/font/opensans/opensans-semibolditalic-webfont.woff +0 -0
- package/app/assets/font/opensans/specimen_files/grid_12-825-55-15.css +0 -129
- package/app/assets/font/opensans/specimen_files/specimen_stylesheet.css +0 -396
- package/app/assets/image/demo/large.jpg +0 -0
- package/app/assets/image/demo/medium.jpg +0 -0
- package/app/assets/image/demo/small.jpg +0 -0
- package/app/assets/image/demo/xlarge.jpg +0 -0
- package/app/assets/image/demo/xxlarge.jpg +0 -0
- package/app/assets/script/api/youtube.js +0 -18
- package/app/assets/script/index.js +0 -6
- package/app/assets/script/mediator/global.js +0 -5
- package/app/assets/script/model/singletons/countries.js +0 -6
- package/app/assets/script/model/singletons/global.js +0 -6
- package/app/assets/script/model/singletons/states.js +0 -6
- package/app/assets/script/model/user.js +0 -5
- package/app/assets/script/toolkit.js +0 -12
- package/app/assets/script/utility/ajax.js +0 -11
- package/app/assets/script/utility/form.js +0 -86
- package/app/assets/script/utility/share.js +0 -52
- package/app/assets/script/utility/string.js +0 -70
- package/app/assets/script/view/default.js +0 -11
- package/app/assets/script/view/toolkit/youtube-player-1.js +0 -17
- package/app/assets/style/base/vendor/_foundation.scss +0 -2
- package/app/assets/test/spec/shareSpec.js +0 -137
- package/app/index.html +0 -40
- package/app/report/istanbul/base.css +0 -213
- package/app/report/istanbul/prettify.css +0 -1
- package/app/report/istanbul/prettify.js +0 -1
- package/app/report/istanbul/sort-arrow-sprite.png +0 -0
- package/app/report/istanbul/sorter.js +0 -158
- package/app/report/jsdoc/fonts/glyphicons-halflings-regular.eot +0 -0
- package/app/report/jsdoc/fonts/glyphicons-halflings-regular.svg +0 -288
- package/app/report/jsdoc/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/app/report/jsdoc/fonts/glyphicons-halflings-regular.woff +0 -0
- package/app/report/jsdoc/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/app/report/jsdoc/img/glyphicons-halflings-white.png +0 -0
- package/app/report/jsdoc/img/glyphicons-halflings.png +0 -0
- package/app/report/jsdoc/scripts/docstrap.lib.js +0 -11
- package/app/report/jsdoc/scripts/fulltext-search-ui.js +0 -89
- package/app/report/jsdoc/scripts/fulltext-search.js +0 -36
- package/app/report/jsdoc/scripts/lunr.min.js +0 -6
- package/app/report/jsdoc/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/app/report/jsdoc/scripts/prettify/jquery.min.js +0 -6
- package/app/report/jsdoc/scripts/prettify/lang-css.js +0 -21
- package/app/report/jsdoc/scripts/prettify/prettify.js +0 -496
- package/app/report/jsdoc/scripts/sunlight.js +0 -1157
- package/app/report/jsdoc/scripts/toc.js +0 -203
- package/app/report/jsdoc/styles/darkstrap.css +0 -960
- package/app/report/jsdoc/styles/prettify-tomorrow.css +0 -132
- package/app/report/jsdoc/styles/site.cerulean.css +0 -7008
- package/app/report/jsdoc/styles/site.cosmo.css +0 -7061
- package/app/report/jsdoc/styles/site.cyborg.css +0 -7048
- package/app/report/jsdoc/styles/site.darkly.css +0 -7171
- package/app/report/jsdoc/styles/site.darkstrap.css +0 -5638
- package/app/report/jsdoc/styles/site.dibs-bootstrap.css +0 -5899
- package/app/report/jsdoc/styles/site.flatly.css +0 -7147
- package/app/report/jsdoc/styles/site.journal.css +0 -6973
- package/app/report/jsdoc/styles/site.lumen.css +0 -7298
- package/app/report/jsdoc/styles/site.paper.css +0 -7623
- package/app/report/jsdoc/styles/site.readable.css +0 -6997
- package/app/report/jsdoc/styles/site.sandstone.css +0 -7035
- package/app/report/jsdoc/styles/site.simplex.css +0 -7023
- package/app/report/jsdoc/styles/site.slate.css +0 -7343
- package/app/report/jsdoc/styles/site.spacelab.css +0 -7055
- package/app/report/jsdoc/styles/site.superhero.css +0 -7131
- package/app/report/jsdoc/styles/site.united.css +0 -6895
- package/app/report/jsdoc/styles/site.yeti.css +0 -7195
- package/app/report/jsdoc/styles/sunlight.dark.css +0 -345
- package/app/report/jsdoc/styles/sunlight.default.css +0 -344
- package/gulp/config.js +0 -224
- package/gulp/tasks/accessibility.js +0 -34
- package/gulp/tasks/build.js +0 -19
- package/gulp/tasks/clean.js +0 -34
- package/gulp/tasks/data.js +0 -22
- package/gulp/tasks/default.js +0 -9
- package/gulp/tasks/deploy.js +0 -225
- package/gulp/tasks/documentation.js +0 -25
- package/gulp/tasks/markup.js +0 -121
- package/gulp/tasks/script.js +0 -92
- package/gulp/tasks/style.js +0 -42
- package/gulp/tasks/unit.js +0 -38
- package/gulp/tasks/watch.js +0 -83
- package/gulpfile.js +0 -8
- package/jsdoc.json +0 -23
- package/karma.conf.js +0 -58
package/scripts/build.ts
ADDED
|
@@ -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
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
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,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"}
|
|
Binary file
|