@simple-reporting/base 1.0.23 → 1.0.25
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/cli.js +5 -1
- package/dev/index.html +1 -1
- package/dev/livingdocs.config.json +6 -6
- package/dev/package.json +6 -1
- package/dev/src/Dialog.vue +3 -0
- package/dev/src/assets/scss/word.scss +44 -1
- package/livingdocs/010.Titles/010.title-h1/scss/word.scss +3 -0
- package/livingdocs/010.Titles/020.title-h2/scss/word.scss +10 -0
- package/livingdocs/010.Titles/030.title-h3/scss/word.scss +10 -0
- package/livingdocs/010.Titles/040.title-h4/scss/word.scss +10 -0
- package/livingdocs/010.Titles/050.title-h5/scss/word.scss +5 -0
- package/livingdocs/010.Titles/060.title-h6/scss/word.scss +5 -0
- package/livingdocs/020.Text/010.lead/scss/word.scss +5 -0
- package/livingdocs/020.Text/020.paragraph/scss/word.scss +5 -0
- package/livingdocs/020.Text/030.paragraph-strong/scss/word.scss +6 -0
- package/livingdocs/020.Text/040.link/scss/word.scss +5 -0
- package/livingdocs/020.Text/050.quote/scss/word.scss +7 -0
- package/livingdocs/020.Text/060.quote-with-portrait/scss/word.scss +7 -0
- package/livingdocs/020.Text/080.footnote-item/scss/word.scss +6 -0
- package/livingdocs/030.Lists/010.unordered-list/scss/general.scss +0 -5
- package/livingdocs/030.Lists/010.unordered-list/scss/word.scss +6 -0
- package/livingdocs/030.Lists/020.ordered-list/scss/word.scss +9 -0
- package/livingdocs/030.Lists/030.alphanumeric-list/scss/word.scss +9 -0
- package/livingdocs/030.Lists/040.list-item/scss/pdf.scss +2 -2
- package/livingdocs/030.Lists/040.list-item/scss/word.scss +19 -0
- package/livingdocs/040.Media/010.table/scss/general.scss +22 -17
- package/livingdocs/040.Media/010.table/scss/word.scss +21 -0
- package/livingdocs/040.Media/020.image/scss/word.scss +5 -0
- package/livingdocs/040.Media/030.video/scss/word.scss +5 -0
- package/livingdocs/040.Media/030.video/video.html +2 -2
- package/livingdocs/060.Buttons/020.button/scss/word.scss +6 -1
- package/livingdocs/080.CV/010.cv/cv.html +7 -7
- package/livingdocs/090.Signatures/010.signature-container/scss/word.scss +5 -0
- package/livingdocs/090.Signatures/020.signature-item/scss/word.scss +6 -0
- package/livingdocs/100.Misc/010.anchor/anchor.html +2 -1
- package/livingdocs/110.PDF/010.pdf-pagebreak/pdf-pagebreak.html +1 -1
- package/livingdocs/110.PDF/010.pdf-pagebreak/scss/word.scss +5 -0
- package/livingdocs/110.PDF/030.pdf-publication-title/pdf-publication-title.html +1 -0
- package/livingdocs/110.PDF/040.pdf-chapter-title/pdf-chapter-title.html +1 -0
- package/livingdocs/110.PDF/050.pdf-chapter-navigation-container/pdf-chapter-navigation.html +1 -0
- package/livingdocs/110.PDF/070.pdf-cover/pdf-cover.html +1 -1
- package/livingdocs/110.PDF/080.pdf-toc-page/pdf-toc-page.html +2 -2
- package/livingdocs/110.PDF/080.pdf-toc-page/scss/editor.scss +2 -2
- package/livingdocs/110.PDF/100.pdf-toc-item/pdf-toc-item.html +3 -3
- package/package.json +2 -1
- package/scripts/beaver.js +14 -18
- package/scripts/build/variables.d.ts +6 -0
- package/scripts/build/variables.js +6 -0
- package/scripts/build.d.ts +1 -1
- package/scripts/build.js +227 -99
- package/scripts/dotenv.d.ts +1 -0
- package/scripts/dotenv.js +8 -0
- package/scripts/init.js +1 -1
- package/scripts/ldd/mapLdd.js +2 -2
- package/scripts/utils.d.ts +1 -0
- package/scripts/utils.js +22 -0
- package/scss/colors/functions.scss +2 -10
- package/scss/colors/mixins.scss +0 -18
- package/scss/colors/root.scss +10 -0
- package/scss/core-styles.scss +4 -1
- package/scss/fonts/root.scss +4 -0
- package/scss/grid/functions.scss +8 -6
- package/scss/grid/mixins.scss +0 -77
- package/scss/grid/root.scss +80 -0
- package/scss/helpers/root.scss +4 -0
- package/scss/init-root.scss +12 -0
- package/scss/meta/root.scss +4 -0
- package/scss/spacer/functions.scss +2 -1
- package/scss/spacer/mixins.scss +0 -52
- package/scss/spacer/root.scss +55 -0
- package/scss/system/functions.scss +70 -5
- package/scss/system/root.scss +0 -3
- package/scss/system/variables.scss +1 -0
- package/scss/typography/functions.scss +12 -12
- package/scss/typography/mixins.scss +0 -221
- package/scss/typography/root.scss +226 -0
- package/srl/.srl/components/Srl/Article/Dialog/Button.vue +18 -20
- package/srl/.srl/components/Srl/Article/Root.vue +4 -3
- package/srl/.srl/components/Srl/Page/Dialog.vue +17 -19
- package/srl/.srl/types/nswow.d.ts +3 -0
- package/srl/.srl/utils/pageState.ts +2 -2
- package/srl/srl/pdf.scss +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<a class="srl-pdf-toc__item" doc-link="href" data-page-number="">
|
|
2
|
-
<div class="srl-pdf-toc__text" doc-editable="pdf-toc-item-text">
|
|
1
|
+
<a class="srl-pdf-toc__item" doc-link="href" data-page-number="" data-is-toc-item="true">
|
|
2
|
+
<div class="srl-pdf-toc__text" doc-editable="pdf-toc-item-text" data-is-toc-text="true">
|
|
3
3
|
Article title
|
|
4
4
|
</div>
|
|
5
|
-
<div class="srl-pdf-toc__number" doc-editable="pdf-toc-item-number">1</div>
|
|
5
|
+
<div class="srl-pdf-toc__number" doc-editable="pdf-toc-item-number" data-is-toc-number="true">1</div>
|
|
6
6
|
</a>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-reporting/base",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "Manage srl templates, build and publish",
|
|
5
5
|
"bin": {
|
|
6
6
|
"srl": "cli.js"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"chalk": "^5.6.2",
|
|
23
23
|
"colors": "^1.4.0",
|
|
24
24
|
"commander": "^11.1.0",
|
|
25
|
+
"dotenv": "^17.2.3",
|
|
25
26
|
"enquirer": "^2.4.1",
|
|
26
27
|
"fs": "^0.0.1-security",
|
|
27
28
|
"fs-extra": "^11.3.2",
|
package/scripts/beaver.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { writeFileSync, readFileSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path/posix';
|
|
3
3
|
import { colors } from './colors.js';
|
|
4
|
-
import { readNsWowJson } from './utils.js';
|
|
4
|
+
import { readNsWowJson, deepAssign } from './utils.js';
|
|
5
5
|
import colorPalette from '@kne/color-palette';
|
|
6
6
|
import folders from './folders.js';
|
|
7
|
+
import { buildVariables } from "./build/variables.js";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Maps the values of an object or array recursively.
|
|
9
11
|
*
|
|
@@ -176,24 +178,18 @@ async function beaver(verbose = 0) {
|
|
|
176
178
|
verbose = verbose ? 1 : 0;
|
|
177
179
|
}
|
|
178
180
|
|
|
179
|
-
|
|
180
|
-
configJson.system = {};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (typeof configJson.system.environment === 'undefined') {
|
|
184
|
-
configJson.system.environment = process.env.NODE_ENV;
|
|
185
|
-
}
|
|
181
|
+
const configAssigned = deepAssign(configJson, buildVariables);
|
|
186
182
|
|
|
187
|
-
if (typeof
|
|
188
|
-
const fontBasePath =
|
|
183
|
+
if (typeof configAssigned.fonts !== 'undefined') {
|
|
184
|
+
const fontBasePath = configAssigned.fonts['font-base-path'] ?? '';
|
|
189
185
|
if (fontBasePath.length) {
|
|
190
|
-
|
|
186
|
+
configAssigned.fonts['font-base-path'] = '.' + path.normalize(fontBasePath);
|
|
191
187
|
}
|
|
192
|
-
if (typeof
|
|
193
|
-
for (let x = 0; x <
|
|
194
|
-
let font =
|
|
188
|
+
if (typeof configAssigned.fonts.fonts !== 'undefined') {
|
|
189
|
+
for (let x = 0; x < configAssigned.fonts.fonts.length; x++) {
|
|
190
|
+
let font = configAssigned.fonts.fonts[x];
|
|
195
191
|
if (typeof font === 'string') {
|
|
196
|
-
|
|
192
|
+
configAssigned.fonts.fonts[x] = JSON.parse(
|
|
197
193
|
readFileSync(
|
|
198
194
|
path.join(process.cwd(), fontBasePath, font, 'styles.json'),
|
|
199
195
|
),
|
|
@@ -205,10 +201,10 @@ async function beaver(verbose = 0) {
|
|
|
205
201
|
|
|
206
202
|
const map = {};
|
|
207
203
|
|
|
208
|
-
for (const file in
|
|
204
|
+
for (const file in configAssigned) {
|
|
209
205
|
map[file] = {};
|
|
210
|
-
for (const variable in
|
|
211
|
-
map[file][variable] = mapValues(
|
|
206
|
+
for (const variable in configAssigned[file]) {
|
|
207
|
+
map[file][variable] = mapValues(configAssigned[file][variable]);
|
|
212
208
|
}
|
|
213
209
|
}
|
|
214
210
|
|
package/scripts/build.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param {string} version
|
|
6
6
|
* @return {Promise<void>} A Promise that resolves when the build process is completed or rejects if an error occurs.
|
|
7
7
|
*/
|
|
8
|
-
export function build(version: string, options
|
|
8
|
+
export function build(version: string, options?: {}): Promise<void>;
|
|
9
9
|
/**
|
|
10
10
|
* Builds the project sequentially by executing a series of asynchronous tasks in a specific order.
|
|
11
11
|
* This method is used to build the project in a predetermined sequence.
|
package/scripts/build.js
CHANGED
|
@@ -24,6 +24,8 @@ import folders from './folders.js';
|
|
|
24
24
|
import { mapLdd } from './ldd/mapLdd.js';
|
|
25
25
|
import { LivingdocsDesignValidator } from './ldd/LivingdocsDesignValidator.js';
|
|
26
26
|
import { camelCase } from './utils.js';
|
|
27
|
+
import { buildVariables } from './build/variables.js';
|
|
28
|
+
import './dotenv.js';
|
|
27
29
|
|
|
28
30
|
const placeholderId = '6297EAFB-33A0-48B8-8D64-E61CDC3E9035';
|
|
29
31
|
const nswowPath = folders.srlImports;
|
|
@@ -83,7 +85,11 @@ async function cleanOutput() {
|
|
|
83
85
|
* @returns {Promise<void>} A Promise that resolves when the application is built.
|
|
84
86
|
*/
|
|
85
87
|
async function buildApp() {
|
|
86
|
-
console.log(
|
|
88
|
+
console.log('\n\nBuild application');
|
|
89
|
+
buildVariables.system.environment = 'production';
|
|
90
|
+
buildVariables.system.build = 'app';
|
|
91
|
+
buildVariables.system['size-unit'] = 'rem';
|
|
92
|
+
|
|
87
93
|
await checkFolders();
|
|
88
94
|
const build = await viteBuild({
|
|
89
95
|
build: {
|
|
@@ -101,7 +107,7 @@ async function buildApp() {
|
|
|
101
107
|
|
|
102
108
|
// Copy public folder exclude nswow folders
|
|
103
109
|
console.log(
|
|
104
|
-
'\n\nCopy public folder exclude nswow folders and exclude folder',
|
|
110
|
+
'\n\nCopy public folder exclude nswow folders and assets, template, exclude folder and index.html',
|
|
105
111
|
);
|
|
106
112
|
await cpSync(join(folders.srlPublic, '/'), join(outputPath, 'app'), {
|
|
107
113
|
filter: (src) => {
|
|
@@ -110,7 +116,10 @@ async function buildApp() {
|
|
|
110
116
|
src.startsWith(join(folders.srlPublic, 'html')) ||
|
|
111
117
|
src.startsWith(join(folders.srlPublic, 'images')) ||
|
|
112
118
|
src.startsWith(join(folders.srlPublic, 'json')) ||
|
|
113
|
-
src.startsWith(join(folders.srlPublic, 'exclude'))
|
|
119
|
+
src.startsWith(join(folders.srlPublic, 'exclude')) ||
|
|
120
|
+
src.startsWith(join(folders.srlPublic, 'assets')) ||
|
|
121
|
+
src.startsWith(join(folders.srlPublic, 'template')) ||
|
|
122
|
+
src.startsWith(join(folders.srlPublic, 'index.html'))
|
|
114
123
|
) {
|
|
115
124
|
return false;
|
|
116
125
|
} else {
|
|
@@ -144,9 +153,7 @@ async function buildApp() {
|
|
|
144
153
|
index = index.replace(
|
|
145
154
|
/(<div\s+[^>]*id\s*=\s*["']app["'][^>]*>)([\s\S]*?)(<\/div>)/i,
|
|
146
155
|
`$1
|
|
147
|
-
|
|
148
|
-
[[content-${placeholderId}]]
|
|
149
|
-
</template>
|
|
156
|
+
[[content-${placeholderId}]]
|
|
150
157
|
$3`,
|
|
151
158
|
);
|
|
152
159
|
|
|
@@ -191,7 +198,11 @@ async function buildApp() {
|
|
|
191
198
|
* @returns {Promise<void>} A Promise that resolves when the application is built.
|
|
192
199
|
*/
|
|
193
200
|
async function buildDDev() {
|
|
194
|
-
console.log(
|
|
201
|
+
console.log('\n\nBuild application for DDEV');
|
|
202
|
+
buildVariables.system.environment = 'production';
|
|
203
|
+
buildVariables.system.build = 'app';
|
|
204
|
+
buildVariables.system['size-unit'] = 'rem';
|
|
205
|
+
|
|
195
206
|
await checkFolders();
|
|
196
207
|
const build = await viteBuild({
|
|
197
208
|
build: {
|
|
@@ -210,7 +221,7 @@ async function buildDDev() {
|
|
|
210
221
|
* @returns {Promise<void>} - A Promise that resolves when the zip operation is complete, or rejects with an error.
|
|
211
222
|
*/
|
|
212
223
|
async function zipApp() {
|
|
213
|
-
console.log(
|
|
224
|
+
console.log('\n\nCreate zip file for app');
|
|
214
225
|
await checkFolders();
|
|
215
226
|
const archiver = require('archiver');
|
|
216
227
|
const output = createWriteStream(join(outputPath, 'app.zip'));
|
|
@@ -241,7 +252,7 @@ async function zipApp() {
|
|
|
241
252
|
}
|
|
242
253
|
|
|
243
254
|
async function zipLdd() {
|
|
244
|
-
console.log(
|
|
255
|
+
console.log('\n\nCreate zip file for LDD');
|
|
245
256
|
await checkFolders();
|
|
246
257
|
|
|
247
258
|
const archiver = require('archiver');
|
|
@@ -279,7 +290,11 @@ async function zipLdd() {
|
|
|
279
290
|
* false otherwise.
|
|
280
291
|
*/
|
|
281
292
|
async function buildPdf() {
|
|
282
|
-
console.log(
|
|
293
|
+
console.log('\n\nBuild PDF');
|
|
294
|
+
buildVariables.system.environment = 'production';
|
|
295
|
+
buildVariables.system.build = 'pdf';
|
|
296
|
+
buildVariables.system['size-unit'] = 'rem';
|
|
297
|
+
|
|
283
298
|
await checkFolders();
|
|
284
299
|
|
|
285
300
|
const config = {
|
|
@@ -311,7 +326,11 @@ async function buildPdf() {
|
|
|
311
326
|
}
|
|
312
327
|
|
|
313
328
|
async function buildXbrl() {
|
|
314
|
-
console.log(
|
|
329
|
+
console.log('\n\nBuild XBRL');
|
|
330
|
+
buildVariables.system.environment = 'production';
|
|
331
|
+
buildVariables.system.build = 'xbrl';
|
|
332
|
+
buildVariables.system['size-unit'] = 'rem';
|
|
333
|
+
|
|
315
334
|
await checkFolders();
|
|
316
335
|
|
|
317
336
|
const config = {
|
|
@@ -350,7 +369,11 @@ async function buildXbrl() {
|
|
|
350
369
|
* @returns {Promise<boolean>} - A Promise that resolves to true if the LDD build is successful, false otherwise.
|
|
351
370
|
*/
|
|
352
371
|
async function buildLdd(version) {
|
|
353
|
-
console.log(
|
|
372
|
+
console.log('\n\nBuild Livingdocs');
|
|
373
|
+
buildVariables.system.environment = 'production';
|
|
374
|
+
buildVariables.system.build = 'ldd';
|
|
375
|
+
buildVariables.system['size-unit'] = 'rem';
|
|
376
|
+
|
|
354
377
|
await checkFolders();
|
|
355
378
|
await mapLdd();
|
|
356
379
|
|
|
@@ -410,12 +433,15 @@ async function buildLdd(version) {
|
|
|
410
433
|
}
|
|
411
434
|
}
|
|
412
435
|
|
|
413
|
-
const fontFiles = await glob(
|
|
414
|
-
|
|
415
|
-
|
|
436
|
+
const fontFiles = await glob(
|
|
437
|
+
join(folders.srlAssets, 'fonts', '**', '*.scss'),
|
|
438
|
+
{
|
|
439
|
+
withFileTypes: true,
|
|
440
|
+
},
|
|
441
|
+
);
|
|
416
442
|
|
|
417
443
|
if (fontFiles.length) {
|
|
418
|
-
console.log(
|
|
444
|
+
console.log('\n\nBuild Livingdocs fonts');
|
|
419
445
|
|
|
420
446
|
const importPath = join(folders.srlImports, 'fonts');
|
|
421
447
|
try {
|
|
@@ -426,10 +452,13 @@ async function buildLdd(version) {
|
|
|
426
452
|
const importFile = join(importPath, 'style.scss');
|
|
427
453
|
|
|
428
454
|
const importFonts = [];
|
|
429
|
-
fontFiles.forEach(
|
|
455
|
+
fontFiles.forEach((f) => {
|
|
430
456
|
importFonts.push(`../../../${f.relativePosix()}`);
|
|
431
|
-
})
|
|
432
|
-
await writeFileSync(
|
|
457
|
+
});
|
|
458
|
+
await writeFileSync(
|
|
459
|
+
importFile,
|
|
460
|
+
`@use "` + importFonts.join('" as *;\n@use "') + `" as *;\n`,
|
|
461
|
+
);
|
|
433
462
|
|
|
434
463
|
await viteBuild({
|
|
435
464
|
css: {
|
|
@@ -452,15 +481,15 @@ async function buildLdd(version) {
|
|
|
452
481
|
return '[name][extname]';
|
|
453
482
|
}
|
|
454
483
|
return '[name]-[hash][extname]';
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
},
|
|
458
487
|
},
|
|
459
488
|
publicDir: false,
|
|
460
|
-
})
|
|
489
|
+
});
|
|
461
490
|
}
|
|
462
491
|
|
|
463
|
-
console.log(
|
|
492
|
+
console.log('\n\nBuild Livingdocs design.json');
|
|
464
493
|
await writeLivingDocsJson();
|
|
465
494
|
|
|
466
495
|
return true;
|
|
@@ -478,7 +507,7 @@ async function buildLdd(version) {
|
|
|
478
507
|
}
|
|
479
508
|
|
|
480
509
|
async function buildPdfCustomer(customer) {
|
|
481
|
-
|
|
510
|
+
const internalLddUrl = process.env.INTERNAL_LDD_URL ?? nsWowInternalLddUrl;
|
|
482
511
|
const customersDir = join(folders.root, 'pdf', 'customers');
|
|
483
512
|
|
|
484
513
|
if (customer === 'all') {
|
|
@@ -503,25 +532,43 @@ async function buildPdfCustomer(customer) {
|
|
|
503
532
|
const lddPdfDir = join(folders.srlOutput, 'ldd', 'pdf');
|
|
504
533
|
const lddJson = await readLivingDocsJson();
|
|
505
534
|
|
|
535
|
+
try {
|
|
536
|
+
const wordDir = join(folders.srlOutput, 'word');
|
|
537
|
+
const lddWordDir = join(folders.srlOutput, 'ldd', 'word');
|
|
538
|
+
statSync(wordDir);
|
|
539
|
+
await cpSync(wordDir, lddWordDir, { recursive: true });
|
|
540
|
+
console.log(`Word folder has been copied to ${relative(folders.root, lddWordDir)}`);
|
|
541
|
+
} catch (e) {
|
|
542
|
+
console.error(e)
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
try {
|
|
546
|
+
const xbrlDir = join(folders.srlOutput, 'xbrl');
|
|
547
|
+
const lddXbrlDir = join(folders.srlOutput, 'ldd', 'xbrl');
|
|
548
|
+
statSync(xbrlDir);
|
|
549
|
+
await cpSync(xbrlDir, lddXbrlDir, { recursive: true });
|
|
550
|
+
console.log(`Xbrl folder has been copied to ${relative(folders.root, lddXbrlDir)}`);
|
|
551
|
+
} catch (e) {
|
|
552
|
+
console.error(e)
|
|
553
|
+
}
|
|
554
|
+
|
|
506
555
|
try {
|
|
507
556
|
const pdfDir = join(folders.srlOutput, 'pdf');
|
|
508
557
|
statSync(pdfDir);
|
|
509
558
|
await cpSync(pdfDir, lddPdfDir, { recursive: true });
|
|
510
|
-
console.log(
|
|
559
|
+
console.log(
|
|
560
|
+
`PDF folder has been copied to ${relative(folders.root, lddPdfDir)}`,
|
|
561
|
+
);
|
|
511
562
|
} catch (e) {
|
|
512
|
-
console.error(e)
|
|
563
|
+
console.error(e);
|
|
513
564
|
}
|
|
514
565
|
|
|
515
566
|
try {
|
|
516
567
|
statSync(customerDir);
|
|
517
568
|
const customerTarget = join(lddPdfDir, customerName);
|
|
518
569
|
mkdirSync(customerTarget, { recursive: true });
|
|
519
|
-
const jsReferences = [
|
|
520
|
-
|
|
521
|
-
];
|
|
522
|
-
const cssReferences = [
|
|
523
|
-
'pdf.css'
|
|
524
|
-
];
|
|
570
|
+
const jsReferences = ['pdf.js'];
|
|
571
|
+
const cssReferences = ['pdf.css'];
|
|
525
572
|
|
|
526
573
|
try {
|
|
527
574
|
const tsPath = join(customerDir, 'custom.ts');
|
|
@@ -550,9 +597,9 @@ async function buildPdfCustomer(customer) {
|
|
|
550
597
|
return '[name][extname]';
|
|
551
598
|
}
|
|
552
599
|
return 'assets/[name]-[hash][extname]';
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
},
|
|
556
603
|
},
|
|
557
604
|
publicDir: false,
|
|
558
605
|
};
|
|
@@ -576,9 +623,13 @@ async function buildPdfCustomer(customer) {
|
|
|
576
623
|
statSync(publicDir);
|
|
577
624
|
const publicTarget = join(customerTarget, 'public');
|
|
578
625
|
await cpSync(publicDir, publicTarget, { recursive: true });
|
|
579
|
-
console.log(
|
|
626
|
+
console.log(
|
|
627
|
+
`Customer ${customer} public folder has been copied to ${relative(folders.root, publicTarget)}`,
|
|
628
|
+
);
|
|
580
629
|
|
|
581
|
-
const publicFiles = await glob(join(publicTarget, '**', '*'), {
|
|
630
|
+
const publicFiles = await glob(join(publicTarget, '**', '*'), {
|
|
631
|
+
withFileTypes: true,
|
|
632
|
+
});
|
|
582
633
|
|
|
583
634
|
for (const publicFile of publicFiles) {
|
|
584
635
|
if (publicFile.isFile()) {
|
|
@@ -594,38 +645,53 @@ async function buildPdfCustomer(customer) {
|
|
|
594
645
|
|
|
595
646
|
const pdfXmlStart = `<configuration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n`;
|
|
596
647
|
const pdfXmlEnd = `\n</configuration>`;
|
|
597
|
-
const nsWowUrl = `${
|
|
648
|
+
const nsWowUrl = `${internalLddUrl}/${lddJson.name}/${lddJson.version}/pdf`;
|
|
598
649
|
|
|
599
650
|
const pdfConfig = [];
|
|
600
|
-
cssReferences.forEach(
|
|
601
|
-
pdfConfig.push(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
651
|
+
cssReferences.forEach((p) => {
|
|
652
|
+
pdfConfig.push(
|
|
653
|
+
` <userStyleSheets><uri>${nsWowUrl}/${p}</uri></userStyleSheets>`,
|
|
654
|
+
);
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
jsReferences.forEach((p) => {
|
|
658
|
+
pdfConfig.push(
|
|
659
|
+
` <userScripts><beforeDocumentScripts>true</beforeDocumentScripts><uri>${nsWowUrl}/${p}</uri></userScripts>`,
|
|
660
|
+
);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
const pdfConfigContent =
|
|
664
|
+
pdfXmlStart +
|
|
665
|
+
` <appendLog>false</appendLog>\n` +
|
|
666
|
+
pdfConfig.join('\n') +
|
|
667
|
+
pdfXmlEnd;
|
|
612
668
|
const pdfConfigPath = join(customerTarget, 'pdf-configuration.xml');
|
|
613
669
|
writeFileSync(pdfConfigPath, pdfConfigContent);
|
|
614
|
-
console.log(
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
+
|
|
620
|
-
+
|
|
621
|
-
+
|
|
622
|
-
|
|
670
|
+
console.log(
|
|
671
|
+
`Customer ${customer} PDF configuration file has been built to ${relative(folders.root, pdfConfigPath)}`,
|
|
672
|
+
);
|
|
673
|
+
|
|
674
|
+
const pdfConfigDebugContent =
|
|
675
|
+
pdfXmlStart +
|
|
676
|
+
` <appendLog>true</appendLog>\n` +
|
|
677
|
+
` <inspectableSettings><enabled>true</enabled></inspectableSettings>\n` +
|
|
678
|
+
` <debugSettings><all>true</all></debugSettings>\n` +
|
|
679
|
+
pdfConfig.join('\n') +
|
|
680
|
+
pdfXmlEnd;
|
|
681
|
+
const pdfConfigDebugPath = join(
|
|
682
|
+
customerTarget,
|
|
683
|
+
'pdf-configuration-debug.xml',
|
|
684
|
+
);
|
|
623
685
|
writeFileSync(pdfConfigDebugPath, pdfConfigDebugContent);
|
|
624
|
-
console.log(
|
|
686
|
+
console.log(
|
|
687
|
+
`Customer ${customer} PDF debug configuration file has been built to ${relative(folders.root, pdfConfigDebugPath)}`,
|
|
688
|
+
);
|
|
625
689
|
|
|
626
|
-
console.log(
|
|
690
|
+
console.log(
|
|
691
|
+
`Customer ${customer} PDF files has been built to ${relative(folders.root, customerTarget)}`,
|
|
692
|
+
);
|
|
627
693
|
|
|
628
|
-
console.log(
|
|
694
|
+
console.log('\n');
|
|
629
695
|
} catch (e) {}
|
|
630
696
|
|
|
631
697
|
return true;
|
|
@@ -639,7 +705,10 @@ async function buildPdfCustomer(customer) {
|
|
|
639
705
|
* or false if there was an error during the build process.
|
|
640
706
|
*/
|
|
641
707
|
async function buildWord() {
|
|
642
|
-
console.log(
|
|
708
|
+
console.log('\n\nBuild Word');
|
|
709
|
+
buildVariables.system.environment = 'production';
|
|
710
|
+
buildVariables.system.build = 'word';
|
|
711
|
+
buildVariables.system['size-unit'] = 'pt';
|
|
643
712
|
await checkFolders();
|
|
644
713
|
|
|
645
714
|
const config = {
|
|
@@ -677,33 +746,68 @@ async function buildWord() {
|
|
|
677
746
|
* @param {string} version
|
|
678
747
|
* @return {Promise<void>} A Promise that resolves when the build process is completed or rejects if an error occurs.
|
|
679
748
|
*/
|
|
680
|
-
async function build(version, options) {
|
|
681
|
-
|
|
749
|
+
async function build(version, options = {}) {
|
|
682
750
|
try {
|
|
683
751
|
await checkFolders();
|
|
752
|
+
|
|
684
753
|
const packageJson = await readPackageJson();
|
|
685
754
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
755
|
+
// target option for separate build
|
|
756
|
+
const targetsString = options.target || 'app,pdf,word,xbrl,ldd';
|
|
757
|
+
const targets = targetsString
|
|
758
|
+
.split(',')
|
|
759
|
+
.map((t) => t.trim())
|
|
760
|
+
.filter(Boolean);
|
|
761
|
+
const has = (name) => targets.includes(name);
|
|
762
|
+
|
|
763
|
+
if (has('ldd')) {
|
|
764
|
+
if (!version) {
|
|
765
|
+
const prompt = new Input({
|
|
766
|
+
message: 'Livingdocs version',
|
|
767
|
+
initial: packageJson.version,
|
|
768
|
+
});
|
|
769
|
+
version = await prompt.run();
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
packageJson.version = version;
|
|
773
|
+
await writePackageJson();
|
|
692
774
|
}
|
|
693
775
|
|
|
694
|
-
|
|
695
|
-
await writePackageJson();
|
|
776
|
+
|
|
696
777
|
|
|
697
778
|
await cleanOutput();
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
779
|
+
|
|
780
|
+
if (has('app')) {
|
|
781
|
+
await buildApp();
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
if (has('pdf')) {
|
|
785
|
+
await buildPdf();
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
if (has('word')) {
|
|
789
|
+
await buildWord();
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
if (has('xbrl') || has('xhtml')) {
|
|
793
|
+
await buildXbrl();
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
if (has('ldd')) {
|
|
797
|
+
await buildLdd();
|
|
798
|
+
|
|
799
|
+
const livingdocsJson = await readLivingDocsJson();
|
|
800
|
+
new LivingdocsDesignValidator(livingdocsJson).IsDesignValid();
|
|
801
|
+
await zipLdd();
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
if (has('pdf') && options.customer) {
|
|
805
|
+
await buildPdfCustomer(options.customer);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
if (has('app')) {
|
|
809
|
+
await zipApp();
|
|
810
|
+
}
|
|
707
811
|
} catch (error) {
|
|
708
812
|
console.log(error);
|
|
709
813
|
}
|
|
@@ -740,36 +844,60 @@ function cleanupScssAlias(string) {
|
|
|
740
844
|
async function mapScss() {
|
|
741
845
|
await checkFolders();
|
|
742
846
|
try {
|
|
847
|
+
const internalLddUrl = process.env.INTERNAL_LDD_URL ?? nsWowInternalLddUrl;
|
|
743
848
|
const packageJson = await readPackageJson();
|
|
744
849
|
|
|
745
850
|
const relativePathToRoot = join('..', '..', '/');
|
|
746
851
|
|
|
747
852
|
const output = {
|
|
748
|
-
app: [
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
853
|
+
app: [
|
|
854
|
+
`"../../srl/config" as *`,
|
|
855
|
+
`"@simple-reporting/base/scss/init-root.scss" as *`,
|
|
856
|
+
],
|
|
857
|
+
ldd: [
|
|
858
|
+
`"../../srl/config" as *`,
|
|
859
|
+
`"@simple-reporting/base/scss/init-root.scss" as *`,
|
|
860
|
+
],
|
|
861
|
+
pdf: [
|
|
862
|
+
`"../../srl/config" as *`,
|
|
863
|
+
`"@simple-reporting/base/scss/init-root.scss" as *`,
|
|
864
|
+
],
|
|
865
|
+
word: [
|
|
866
|
+
`"../../srl/config" as *`,
|
|
867
|
+
`"@simple-reporting/base/scss/init-root.scss" as *`,
|
|
868
|
+
],
|
|
869
|
+
xbrl: [
|
|
870
|
+
`"../../srl/config" as *`,
|
|
871
|
+
`"@simple-reporting/base/scss/init-root.scss" as *`,
|
|
872
|
+
],
|
|
753
873
|
};
|
|
754
874
|
|
|
755
|
-
const fontFiles = await glob(
|
|
756
|
-
|
|
757
|
-
|
|
875
|
+
const fontFiles = await glob(
|
|
876
|
+
join(folders.srlAssets, 'fonts', '**', '*.scss'),
|
|
877
|
+
{
|
|
878
|
+
withFileTypes: true,
|
|
879
|
+
},
|
|
880
|
+
);
|
|
758
881
|
|
|
759
|
-
const fontsOutput = []
|
|
882
|
+
const fontsOutput = [];
|
|
760
883
|
|
|
761
884
|
if (fontFiles.length) {
|
|
762
|
-
fontsOutput.push(
|
|
763
|
-
|
|
885
|
+
fontsOutput.push(
|
|
886
|
+
`@import "${internalLddUrl}/${packageJson.name}/${packageJson.version}/fonts/style.css";`,
|
|
887
|
+
);
|
|
888
|
+
fontFiles.forEach((f) => {
|
|
764
889
|
output.app.push(`"${relativePathToRoot}${f.relativePosix()}" as *`);
|
|
765
890
|
output.xbrl.push(`"${relativePathToRoot}${f.relativePosix()}" as *`);
|
|
766
|
-
})
|
|
891
|
+
});
|
|
767
892
|
output.ldd.push(`"./fonts.scss" as *`);
|
|
768
893
|
output.pdf.push(`"./fonts.scss" as *`);
|
|
769
894
|
output.word.push(`"./fonts.scss" as *`);
|
|
770
895
|
}
|
|
771
896
|
|
|
772
|
-
await writeFileSync(
|
|
897
|
+
await writeFileSync(
|
|
898
|
+
join(folders.srlImports, 'fonts.scss'),
|
|
899
|
+
fontsOutput.join('\n'),
|
|
900
|
+
);
|
|
773
901
|
|
|
774
902
|
const mainFiles = await glob(join(folders.srlAssets, 'scss', '*.scss'), {
|
|
775
903
|
withFileTypes: true,
|
|
@@ -908,9 +1036,9 @@ async function mapScss() {
|
|
|
908
1036
|
|
|
909
1037
|
await writeFileSync(
|
|
910
1038
|
join(folders.srlImports, 'xbrl.scss'),
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
1039
|
+
`@use ` +
|
|
1040
|
+
output.xbrl.join(`;\n@use `) +
|
|
1041
|
+
`;\n@use "@simple-reporting/base/scss/xbrl-core-styles.scss" as *;\n`,
|
|
914
1042
|
);
|
|
915
1043
|
|
|
916
1044
|
return true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import dotenv from 'dotenv'
|
|
2
|
+
import folders from './folders.js';
|
|
3
|
+
import { join } from 'node:path/posix';
|
|
4
|
+
|
|
5
|
+
dotenv.config({quiet: true, path: join(folders.root, '.env.nswow')});
|
|
6
|
+
dotenv.config({quiet: true, path: join(folders.root, '.env.production.local')});
|
|
7
|
+
dotenv.config({quiet: true, path: join(folders.root, '.env.production')});
|
|
8
|
+
dotenv.config({quiet: true});
|
package/scripts/init.js
CHANGED
|
@@ -58,7 +58,7 @@ async function init(folder, options) {
|
|
|
58
58
|
|
|
59
59
|
await writeFileSync(
|
|
60
60
|
`${projectPath}/.gitignore`,
|
|
61
|
-
`/.output/\n/.srl/\n/node_modules/\n/public/downloads/\n/public/html/\n/public/images/\n/public/json/\n/public/exclude/\n/dev-dist/\n/.DS_Store\n/.idea`,
|
|
61
|
+
`/.output/\n/.srl/\n/node_modules/\n/public/downloads/\n/public/html/\n/public/images/\n/public/json/\n/public/exclude/\n/dev-dist/\n/.DS_Store\n/.idea\n/**/*.lcoal\n`,
|
|
62
62
|
);
|
|
63
63
|
console.log(`Project has created`);
|
|
64
64
|
console.log(`cd ${folder}`);
|