@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.
Files changed (82) hide show
  1. package/cli.js +5 -1
  2. package/dev/index.html +1 -1
  3. package/dev/livingdocs.config.json +6 -6
  4. package/dev/package.json +6 -1
  5. package/dev/src/Dialog.vue +3 -0
  6. package/dev/src/assets/scss/word.scss +44 -1
  7. package/livingdocs/010.Titles/010.title-h1/scss/word.scss +3 -0
  8. package/livingdocs/010.Titles/020.title-h2/scss/word.scss +10 -0
  9. package/livingdocs/010.Titles/030.title-h3/scss/word.scss +10 -0
  10. package/livingdocs/010.Titles/040.title-h4/scss/word.scss +10 -0
  11. package/livingdocs/010.Titles/050.title-h5/scss/word.scss +5 -0
  12. package/livingdocs/010.Titles/060.title-h6/scss/word.scss +5 -0
  13. package/livingdocs/020.Text/010.lead/scss/word.scss +5 -0
  14. package/livingdocs/020.Text/020.paragraph/scss/word.scss +5 -0
  15. package/livingdocs/020.Text/030.paragraph-strong/scss/word.scss +6 -0
  16. package/livingdocs/020.Text/040.link/scss/word.scss +5 -0
  17. package/livingdocs/020.Text/050.quote/scss/word.scss +7 -0
  18. package/livingdocs/020.Text/060.quote-with-portrait/scss/word.scss +7 -0
  19. package/livingdocs/020.Text/080.footnote-item/scss/word.scss +6 -0
  20. package/livingdocs/030.Lists/010.unordered-list/scss/general.scss +0 -5
  21. package/livingdocs/030.Lists/010.unordered-list/scss/word.scss +6 -0
  22. package/livingdocs/030.Lists/020.ordered-list/scss/word.scss +9 -0
  23. package/livingdocs/030.Lists/030.alphanumeric-list/scss/word.scss +9 -0
  24. package/livingdocs/030.Lists/040.list-item/scss/pdf.scss +2 -2
  25. package/livingdocs/030.Lists/040.list-item/scss/word.scss +19 -0
  26. package/livingdocs/040.Media/010.table/scss/general.scss +22 -17
  27. package/livingdocs/040.Media/010.table/scss/word.scss +21 -0
  28. package/livingdocs/040.Media/020.image/scss/word.scss +5 -0
  29. package/livingdocs/040.Media/030.video/scss/word.scss +5 -0
  30. package/livingdocs/040.Media/030.video/video.html +2 -2
  31. package/livingdocs/060.Buttons/020.button/scss/word.scss +6 -1
  32. package/livingdocs/080.CV/010.cv/cv.html +7 -7
  33. package/livingdocs/090.Signatures/010.signature-container/scss/word.scss +5 -0
  34. package/livingdocs/090.Signatures/020.signature-item/scss/word.scss +6 -0
  35. package/livingdocs/100.Misc/010.anchor/anchor.html +2 -1
  36. package/livingdocs/110.PDF/010.pdf-pagebreak/pdf-pagebreak.html +1 -1
  37. package/livingdocs/110.PDF/010.pdf-pagebreak/scss/word.scss +5 -0
  38. package/livingdocs/110.PDF/030.pdf-publication-title/pdf-publication-title.html +1 -0
  39. package/livingdocs/110.PDF/040.pdf-chapter-title/pdf-chapter-title.html +1 -0
  40. package/livingdocs/110.PDF/050.pdf-chapter-navigation-container/pdf-chapter-navigation.html +1 -0
  41. package/livingdocs/110.PDF/070.pdf-cover/pdf-cover.html +1 -1
  42. package/livingdocs/110.PDF/080.pdf-toc-page/pdf-toc-page.html +2 -2
  43. package/livingdocs/110.PDF/080.pdf-toc-page/scss/editor.scss +2 -2
  44. package/livingdocs/110.PDF/100.pdf-toc-item/pdf-toc-item.html +3 -3
  45. package/package.json +2 -1
  46. package/scripts/beaver.js +14 -18
  47. package/scripts/build/variables.d.ts +6 -0
  48. package/scripts/build/variables.js +6 -0
  49. package/scripts/build.d.ts +1 -1
  50. package/scripts/build.js +227 -99
  51. package/scripts/dotenv.d.ts +1 -0
  52. package/scripts/dotenv.js +8 -0
  53. package/scripts/init.js +1 -1
  54. package/scripts/ldd/mapLdd.js +2 -2
  55. package/scripts/utils.d.ts +1 -0
  56. package/scripts/utils.js +22 -0
  57. package/scss/colors/functions.scss +2 -10
  58. package/scss/colors/mixins.scss +0 -18
  59. package/scss/colors/root.scss +10 -0
  60. package/scss/core-styles.scss +4 -1
  61. package/scss/fonts/root.scss +4 -0
  62. package/scss/grid/functions.scss +8 -6
  63. package/scss/grid/mixins.scss +0 -77
  64. package/scss/grid/root.scss +80 -0
  65. package/scss/helpers/root.scss +4 -0
  66. package/scss/init-root.scss +12 -0
  67. package/scss/meta/root.scss +4 -0
  68. package/scss/spacer/functions.scss +2 -1
  69. package/scss/spacer/mixins.scss +0 -52
  70. package/scss/spacer/root.scss +55 -0
  71. package/scss/system/functions.scss +70 -5
  72. package/scss/system/root.scss +0 -3
  73. package/scss/system/variables.scss +1 -0
  74. package/scss/typography/functions.scss +12 -12
  75. package/scss/typography/mixins.scss +0 -221
  76. package/scss/typography/root.scss +226 -0
  77. package/srl/.srl/components/Srl/Article/Dialog/Button.vue +18 -20
  78. package/srl/.srl/components/Srl/Article/Root.vue +4 -3
  79. package/srl/.srl/components/Srl/Page/Dialog.vue +17 -19
  80. package/srl/.srl/types/nswow.d.ts +3 -0
  81. package/srl/.srl/utils/pageState.ts +2 -2
  82. 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.23",
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
- if (typeof configJson.system === 'undefined') {
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 configJson.fonts !== 'undefined') {
188
- const fontBasePath = configJson.fonts['font-base-path'] ?? '';
183
+ if (typeof configAssigned.fonts !== 'undefined') {
184
+ const fontBasePath = configAssigned.fonts['font-base-path'] ?? '';
189
185
  if (fontBasePath.length) {
190
- configJson.fonts['font-base-path'] = '.' + path.normalize(fontBasePath);
186
+ configAssigned.fonts['font-base-path'] = '.' + path.normalize(fontBasePath);
191
187
  }
192
- if (typeof configJson.fonts.fonts !== 'undefined') {
193
- for (let x = 0; x < configJson.fonts.fonts.length; x++) {
194
- let font = configJson.fonts.fonts[x];
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
- configJson.fonts.fonts[x] = JSON.parse(
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 configJson) {
204
+ for (const file in configAssigned) {
209
205
  map[file] = {};
210
- for (const variable in configJson[file]) {
211
- map[file][variable] = mapValues(configJson[file][variable]);
206
+ for (const variable in configAssigned[file]) {
207
+ map[file][variable] = mapValues(configAssigned[file][variable]);
212
208
  }
213
209
  }
214
210
 
@@ -0,0 +1,6 @@
1
+ export namespace buildVariables {
2
+ namespace system {
3
+ let environment: string;
4
+ let build: string;
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ export const buildVariables = {
2
+ system: {
3
+ environment: 'development',
4
+ build: 'app',
5
+ }
6
+ }
@@ -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: any): Promise<void>;
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("\n\nBuild application");
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
- <template>
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("\n\nBuild application for DDEV");
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("\n\nCreate zip file for app");
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("\n\nCreate zip file for LDD");
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("\n\nBuild PDF");
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("\n\nBuild XBRL");
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("\n\nBuild Livingdocs");
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(join(folders.srlAssets, 'fonts', '**', '*.scss'), {
414
- withFileTypes: true,
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("\n\nBuild Livingdocs fonts");
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( f => {
455
+ fontFiles.forEach((f) => {
430
456
  importFonts.push(`../../../${f.relativePosix()}`);
431
- })
432
- await writeFileSync(importFile, `@use "` + importFonts.join('" as *;\n@use "') + `" as *;\n`)
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("\n\nBuild Livingdocs design.json");
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(`PDF folder has been copied to ${relative(folders.root, lddPdfDir)}`);
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
- 'pdf.js'
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(`Customer ${customer} public folder has been copied to ${relative(folders.root, publicTarget)}`);
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, '**', '*'), { withFileTypes: true });
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 = `${nsWowInternalLddUrl}/${lddJson.name}/${lddJson.version}/pdf`;
648
+ const nsWowUrl = `${internalLddUrl}/${lddJson.name}/${lddJson.version}/pdf`;
598
649
 
599
650
  const pdfConfig = [];
600
- cssReferences.forEach( p => {
601
- pdfConfig.push(` <userStyleSheets><uri>${nsWowUrl}/${p}</uri></userStyleSheets>`);
602
- })
603
-
604
- jsReferences.forEach( p => {
605
- pdfConfig.push(` <userScripts><beforeDocumentScripts>true</beforeDocumentScripts><uri>${nsWowUrl}/${p}</uri></userScripts>`);
606
- })
607
-
608
- const pdfConfigContent = pdfXmlStart
609
- + ` <appendLog>false</appendLog>\n`
610
- + pdfConfig.join('\n')
611
- + pdfXmlEnd;
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(`Customer ${customer} PDF configuration file has been built to ${relative(folders.root, pdfConfigPath)}`);
615
-
616
- const pdfConfigDebugContent = pdfXmlStart
617
- + ` <appendLog>true</appendLog>\n`
618
- + ` <inspectableSettings><enabled>true</enabled></inspectableSettings>\n`
619
- + ` <debugSettings><all>true</all></debugSettings>\n`
620
- + pdfConfig.join('\n')
621
- + pdfXmlEnd;
622
- const pdfConfigDebugPath = join(customerTarget, 'pdf-configuration-debug.xml');
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(`Customer ${customer} PDF debug configuration file has been built to ${relative(folders.root, pdfConfigDebugPath)}`);
686
+ console.log(
687
+ `Customer ${customer} PDF debug configuration file has been built to ${relative(folders.root, pdfConfigDebugPath)}`,
688
+ );
625
689
 
626
- console.log(`Customer ${customer} PDF files has been built to ${relative(folders.root, customerTarget)}`);
690
+ console.log(
691
+ `Customer ${customer} PDF files has been built to ${relative(folders.root, customerTarget)}`,
692
+ );
627
693
 
628
- console.log("\n");
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("\n\nBuild Word");
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
- if (!version) {
687
- const prompt = new Input({
688
- message: 'Livingdocs version',
689
- initial: packageJson.version,
690
- });
691
- version = await prompt.run();
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
- packageJson.version = version;
695
- await writePackageJson();
776
+
696
777
 
697
778
  await cleanOutput();
698
- await buildApp();
699
- await buildPdf();
700
- await buildWord();
701
- await buildXbrl();
702
- await buildLdd();
703
- !options.customer || await buildPdfCustomer(options.customer);
704
- new LivingdocsDesignValidator(await readLivingDocsJson()).IsDesignValid();
705
- await zipApp();
706
- await zipLdd();
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
- ldd: [],
750
- pdf: [],
751
- word: [],
752
- xbrl: [],
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(join(folders.srlAssets, 'fonts', '**', '*.scss'), {
756
- withFileTypes: true,
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(`@import "${nsWowInternalLddUrl}/${packageJson.name}/${packageJson.version}/fonts/style.css";`);
763
- fontFiles.forEach(f => {
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(join(folders.srlImports, 'fonts.scss'), fontsOutput.join('\n'));
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
- output.xbrl.length
912
- ? `@use ` + output.xbrl.join(`;\n@use `)
913
- : `;\n` + `;\n@use "@simple-reporting/base/scss/xbrl-core-styles.scss" as *;\n`,
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}`);