@simple-reporting/base 1.0.10 → 1.0.12
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/dev/package.json +1 -1
- package/package.json +1 -1
- package/scripts/doPublish.js +11 -1
- package/srl/plugins/viteSrlPlugin.ts +11 -1
- package/srl/utils/html.ts +6 -6
package/dev/package.json
CHANGED
package/package.json
CHANGED
package/scripts/doPublish.js
CHANGED
|
@@ -3,6 +3,16 @@ import { preparePublish } from './preparePublish.js';
|
|
|
3
3
|
import { packageName } from './config.js';
|
|
4
4
|
import { getPackageVersion } from './utils.js';
|
|
5
5
|
|
|
6
|
+
function isVersionGreater(v1, v2) {
|
|
7
|
+
const a = v1.split('.').map(Number);
|
|
8
|
+
const b = v2.split('.').map(Number);
|
|
9
|
+
for (let i = 0; i < 3; i++) {
|
|
10
|
+
if (a[i] > b[i]) return true;
|
|
11
|
+
if (a[i] < b[i]) return false;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
export async function doPublish(version = null) {
|
|
7
17
|
try {
|
|
8
18
|
const publishVersion = await preparePublish(version);
|
|
@@ -13,7 +23,7 @@ export async function doPublish(version = null) {
|
|
|
13
23
|
|
|
14
24
|
const latest = await getPackageVersion(packageName);
|
|
15
25
|
|
|
16
|
-
if (publishVersion
|
|
26
|
+
if (isVersionGreater(publishVersion, latest)) {
|
|
17
27
|
await execSync(
|
|
18
28
|
`npm dist-tag add ${packageName}@${publishVersion} latest`,
|
|
19
29
|
{
|
|
@@ -24,6 +24,16 @@ function centerText(text: string): string {
|
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
function isVersionGreater(v1, v2) {
|
|
28
|
+
const a = v1.split('.').map(Number);
|
|
29
|
+
const b = v2.split('.').map(Number);
|
|
30
|
+
for (let i = 0; i < 3; i++) {
|
|
31
|
+
if (a[i] > b[i]) return true;
|
|
32
|
+
if (a[i] < b[i]) return false;
|
|
33
|
+
}
|
|
34
|
+
return false; // gleich
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
function checkSrlVersion() {
|
|
28
38
|
try {
|
|
29
39
|
const pkgPath = join(folders.packagePath, 'package.json');
|
|
@@ -37,7 +47,7 @@ function checkSrlVersion() {
|
|
|
37
47
|
.toString()
|
|
38
48
|
.trim();
|
|
39
49
|
|
|
40
|
-
if (current
|
|
50
|
+
if (isVersionGreater(latest, current)) {
|
|
41
51
|
console.log('');
|
|
42
52
|
console.log(chalk.bgWhiteBright(centerText('')));
|
|
43
53
|
console.log(
|
package/srl/utils/html.ts
CHANGED
|
@@ -36,7 +36,7 @@ function replaceAccordionContainer(text: string): string {
|
|
|
36
36
|
const innerContent = replaceAccordionContainer(text.slice(openTagRegex.lastIndex, end - 6));
|
|
37
37
|
|
|
38
38
|
result += text.slice(lastIndex, start);
|
|
39
|
-
result += `<srl-note-accordion${attrs}>${innerContent}</srl-note-accordion>`;
|
|
39
|
+
result += `<srl-note-accordion v-slot="{ id, open, toggle }"${attrs}>${innerContent}</srl-note-accordion>`;
|
|
40
40
|
lastIndex = end;
|
|
41
41
|
openTagRegex.lastIndex = end;
|
|
42
42
|
}
|
|
@@ -61,7 +61,7 @@ function replaceAccordionToggle(text: string): string {
|
|
|
61
61
|
const innerContent = text.slice(contentStart, end);
|
|
62
62
|
|
|
63
63
|
result += text.slice(lastIndex, start);
|
|
64
|
-
result += `<srl-note-accordion-toggle${attrs}>${innerContent}</srl-note-accordion-toggle>`;
|
|
64
|
+
result += `<srl-note-accordion-toggle :id="id" :open="open" :toggle="toggle"${attrs}>${innerContent}</srl-note-accordion-toggle>`;
|
|
65
65
|
lastIndex = end + closeTag.length;
|
|
66
66
|
openTagRegex.lastIndex = lastIndex;
|
|
67
67
|
}
|
|
@@ -97,7 +97,7 @@ function replaceAccordionContent(text: string): string {
|
|
|
97
97
|
const innerContent = replaceAccordionContent(text.slice(openTagRegex.lastIndex, end - 6));
|
|
98
98
|
|
|
99
99
|
result += text.slice(lastIndex, start);
|
|
100
|
-
result += `<srl-note-accordion-content${attrs}>${innerContent}</srl-note-accordion-content>`;
|
|
100
|
+
result += `<srl-note-accordion-content :id="id" :open="open"${attrs}>${innerContent}</srl-note-accordion-content>`;
|
|
101
101
|
lastIndex = end;
|
|
102
102
|
openTagRegex.lastIndex = end;
|
|
103
103
|
}
|
|
@@ -169,9 +169,9 @@ export function prepareHtmlContent(text: string): string {
|
|
|
169
169
|
(_match, name, content) => `<template #${name}>${content}</template>`
|
|
170
170
|
);
|
|
171
171
|
|
|
172
|
-
text = replaceAccordionContainer(text)
|
|
173
|
-
text = replaceAccordionToggle(text)
|
|
174
|
-
text = replaceAccordionContent(text)
|
|
172
|
+
text = replaceAccordionContainer(text);
|
|
173
|
+
text = replaceAccordionToggle(text);
|
|
174
|
+
text = replaceAccordionContent(text);
|
|
175
175
|
|
|
176
176
|
text = text.replaceAll('../', `./`);
|
|
177
177
|
|