@public-ui/kolibri-cli 3.0.0-rc.1 → 3.0.0-rc.11
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/dist/migrate/runner/tasks/common/GenericRenameTagNameTask.js +0 -2
- package/dist/migrate/runner/tasks/common/GenericUpdatePropertyValueTask.js +0 -2
- package/dist/migrate/runner/tasks/common/RefactorPropertyErrorToMsg.js +56 -0
- package/dist/migrate/runner/tasks/v3/abbr.js +5 -0
- package/dist/migrate/runner/tasks/v3/all-input.js +27 -0
- package/dist/migrate/runner/tasks/v3/index.js +8 -0
- package/dist/migrate/runner/tasks/v3/input-file.js +5 -0
- package/dist/migrate/runner/tasks/v3/modal.js +5 -0
- package/package.json +13 -10
|
@@ -30,7 +30,6 @@ class GenericRenameTagNameTask extends abstract_task_1.AbstractTask {
|
|
|
30
30
|
transpileComponentFileRename(baseDir) {
|
|
31
31
|
(0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS).forEach((file) => {
|
|
32
32
|
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
33
|
-
console.log('CONTENT: ', content);
|
|
34
33
|
const newContent = content
|
|
35
34
|
// Replacements
|
|
36
35
|
.replace(this.componentRegExp, `$1${this.newTagNameInCamelCase}$2`)
|
|
@@ -39,7 +38,6 @@ class GenericRenameTagNameTask extends abstract_task_1.AbstractTask {
|
|
|
39
38
|
reuse_1.MODIFIED_FILES.add(file);
|
|
40
39
|
fs_1.default.writeFileSync(file, newContent);
|
|
41
40
|
}
|
|
42
|
-
console.log('NEW CONTENT: ', newContent);
|
|
43
41
|
});
|
|
44
42
|
}
|
|
45
43
|
transpileCustomElementFileRename(baseDir) {
|
|
@@ -33,7 +33,6 @@ class GenericUpdatePropertyValueTask extends abstract_task_1.AbstractTask {
|
|
|
33
33
|
(0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS).forEach((file) => {
|
|
34
34
|
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
35
35
|
const newContent = updateAttributeValue(content, this.componentRegExp, this.oldValue, this.newValue);
|
|
36
|
-
console.log('RUN transpileComponentFileUpdate');
|
|
37
36
|
if (content !== newContent) {
|
|
38
37
|
reuse_1.MODIFIED_FILES.add(file);
|
|
39
38
|
fs_1.default.writeFileSync(file, newContent);
|
|
@@ -44,7 +43,6 @@ class GenericUpdatePropertyValueTask extends abstract_task_1.AbstractTask {
|
|
|
44
43
|
(0, reuse_1.filterFilesByExt)(baseDir, types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS).forEach((file) => {
|
|
45
44
|
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
46
45
|
const newContent = updateAttributeValue(content, this.customElementRegExp, this.oldValue, this.newValue);
|
|
47
|
-
console.log('RUN transpileCustomElementFileUpdate');
|
|
48
46
|
if (content !== newContent) {
|
|
49
47
|
reuse_1.MODIFIED_FILES.add(file);
|
|
50
48
|
fs_1.default.writeFileSync(file, newContent);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RefactorPropertyErrorToMsg = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const types_1 = require("../../../../types");
|
|
9
|
+
const reuse_1 = require("../../../shares/reuse");
|
|
10
|
+
const abstract_task_1 = require("../../abstract-task");
|
|
11
|
+
class RefactorPropertyErrorToMsg extends abstract_task_1.AbstractTask {
|
|
12
|
+
constructor(identifier, tag, versionRange) {
|
|
13
|
+
super(identifier, `Refactor property "_error" to "_msg" of "${tag}" component`, types_1.MARKUP_EXTENSIONS, versionRange);
|
|
14
|
+
if (!reuse_1.isTagKebabCaseRegExp.test(tag)) {
|
|
15
|
+
throw (0, reuse_1.logAndCreateError)(`Tag "${tag}" is not in kebab case.`);
|
|
16
|
+
}
|
|
17
|
+
const tagCapitalCase = (0, reuse_1.kebabToCapitalCase)(tag);
|
|
18
|
+
this.componentRegExpCurlyBrackets = new RegExp(`(<${tagCapitalCase}[^>]+)_error=\\{([^\\}]+)\\}`, 'g');
|
|
19
|
+
this.componentRegExpQuotationMarks = new RegExp(`(<${tagCapitalCase}[^>]+)_error="([^"]+)"`, 'g');
|
|
20
|
+
this.customElementRegExpQuotationMarks = new RegExp(`(<${tag}[^>]+)_error="([^"]+)"`, 'g');
|
|
21
|
+
}
|
|
22
|
+
static getInstance(tag, versionRange) {
|
|
23
|
+
const identifier = `${tag}-refactor-property-error-to-msg`;
|
|
24
|
+
if (!this.instances.has(identifier)) {
|
|
25
|
+
this.instances.set(identifier, new RefactorPropertyErrorToMsg(identifier, tag, versionRange));
|
|
26
|
+
}
|
|
27
|
+
return this.instances.get(identifier);
|
|
28
|
+
}
|
|
29
|
+
run(baseDir) {
|
|
30
|
+
this.transpileComponentFiles(baseDir);
|
|
31
|
+
this.transpileCustomElementFiles(baseDir);
|
|
32
|
+
}
|
|
33
|
+
transpileComponentFiles(baseDir) {
|
|
34
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS).forEach((file) => {
|
|
35
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
36
|
+
const newContent = content
|
|
37
|
+
.replace(this.componentRegExpCurlyBrackets, `$1_msg={{ _type: 'error', _description: $2 }}`)
|
|
38
|
+
.replace(this.componentRegExpQuotationMarks, `$1_msg={{ _type: 'error', _description: '$2' }}`);
|
|
39
|
+
if (content !== newContent) {
|
|
40
|
+
reuse_1.MODIFIED_FILES.add(file);
|
|
41
|
+
fs_1.default.writeFileSync(file, newContent);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
transpileCustomElementFiles(baseDir) {
|
|
46
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS).forEach((file) => {
|
|
47
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
48
|
+
const newContent = content.replace(this.customElementRegExpQuotationMarks, `$1_msg='${JSON.stringify({ _type: 'error', _description: '$2' })}'`);
|
|
49
|
+
if (content !== newContent) {
|
|
50
|
+
reuse_1.MODIFIED_FILES.add(file);
|
|
51
|
+
fs_1.default.writeFileSync(file, newContent);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.RefactorPropertyErrorToMsg = RefactorPropertyErrorToMsg;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbbrRemovePropertyTooltipAlign = void 0;
|
|
4
|
+
const RemovePropertyNameTask_1 = require("../common/RemovePropertyNameTask");
|
|
5
|
+
exports.AbbrRemovePropertyTooltipAlign = RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-abbr', '_tooltip-align', '>=2 <4');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllInputTasks = void 0;
|
|
4
|
+
const RemovePropertyNameTask_1 = require("../common/RemovePropertyNameTask");
|
|
5
|
+
const RefactorPropertyErrorToMsg_1 = require("../common/RefactorPropertyErrorToMsg");
|
|
6
|
+
const RenamePropertyNameTask_1 = require("../common/RenamePropertyNameTask");
|
|
7
|
+
const INPUT_COMPONENTS = [
|
|
8
|
+
'kol-combobox',
|
|
9
|
+
'kol-input-checkbox',
|
|
10
|
+
'kol-input-color',
|
|
11
|
+
'kol-input-date',
|
|
12
|
+
'kol-input-email',
|
|
13
|
+
'kol-input-file',
|
|
14
|
+
'kol-input-number',
|
|
15
|
+
'kol-input-password',
|
|
16
|
+
'kol-input-radio',
|
|
17
|
+
'kol-input-range',
|
|
18
|
+
'kol-input-text',
|
|
19
|
+
'kol-select',
|
|
20
|
+
'kol-single-select',
|
|
21
|
+
'kol-textarea',
|
|
22
|
+
];
|
|
23
|
+
exports.AllInputTasks = INPUT_COMPONENTS.flatMap((componentName) => [
|
|
24
|
+
RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance(componentName, '_alert', '>=2 <4'),
|
|
25
|
+
RefactorPropertyErrorToMsg_1.RefactorPropertyErrorToMsg.getInstance(componentName, '>=2 <4'),
|
|
26
|
+
RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance(componentName, '_hide-error', '_hide-msg', '>=2 <4'),
|
|
27
|
+
]);
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.v3Tasks = void 0;
|
|
4
4
|
const textarea_1 = require("./textarea");
|
|
5
|
+
const abbr_1 = require("./abbr");
|
|
6
|
+
const modal_1 = require("./modal");
|
|
7
|
+
const input_file_1 = require("./input-file");
|
|
8
|
+
const all_input_1 = require("./all-input");
|
|
5
9
|
exports.v3Tasks = [];
|
|
6
10
|
exports.v3Tasks.push(textarea_1.TextareaUpdatePropertyValue_Resize_Both);
|
|
7
11
|
exports.v3Tasks.push(textarea_1.TextareaUpdatePropertyValue_Resize_Horizontal);
|
|
12
|
+
exports.v3Tasks.push(abbr_1.AbbrRemovePropertyTooltipAlign);
|
|
13
|
+
exports.v3Tasks.push(modal_1.ModalRemovePropertyActiveElement);
|
|
14
|
+
exports.v3Tasks.push(input_file_1.InputFileRemovePropertyValue);
|
|
15
|
+
exports.v3Tasks.push(...all_input_1.AllInputTasks);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InputFileRemovePropertyValue = void 0;
|
|
4
|
+
const RemovePropertyNameTask_1 = require("../common/RemovePropertyNameTask");
|
|
5
|
+
exports.InputFileRemovePropertyValue = RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-input-file', '_value', '>=2 <4');
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModalRemovePropertyActiveElement = void 0;
|
|
4
|
+
const RemovePropertyNameTask_1 = require("../common/RemovePropertyNameTask");
|
|
5
|
+
exports.ModalRemovePropertyActiveElement = RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-modal', '_active-element', '>=2 <4');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/kolibri-cli",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.11",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"deepmerge": "4.3.1",
|
|
27
27
|
"gradient-string": "2.0.2",
|
|
28
28
|
"loglevel": "1.9.2",
|
|
29
|
-
"prettier": "3.
|
|
30
|
-
"semver": "7.
|
|
29
|
+
"prettier": "3.5.3",
|
|
30
|
+
"semver": "7.7.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/gradient-string": "1.1.6",
|
|
@@ -37,25 +37,28 @@
|
|
|
37
37
|
"eslint": "8.57.1",
|
|
38
38
|
"eslint-config-prettier": "9.1.0",
|
|
39
39
|
"eslint-plugin-html": "8.1.2",
|
|
40
|
-
"eslint-plugin-jsdoc": "50.
|
|
40
|
+
"eslint-plugin-jsdoc": "50.6.8",
|
|
41
41
|
"eslint-plugin-json": "3.1.0",
|
|
42
42
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
43
|
-
"eslint-plugin-react": "7.37.
|
|
44
|
-
"knip": "5.
|
|
43
|
+
"eslint-plugin-react": "7.37.4",
|
|
44
|
+
"knip": "5.46.0",
|
|
45
45
|
"mocha": "10.8.2",
|
|
46
|
-
"nodemon": "3.1.
|
|
46
|
+
"nodemon": "3.1.9",
|
|
47
47
|
"rimraf": "6.0.1",
|
|
48
48
|
"ts-node": "10.9.2",
|
|
49
|
-
"typescript": "5.
|
|
50
|
-
"@public-ui/components": "3.0.0-rc.
|
|
49
|
+
"typescript": "5.8.2",
|
|
50
|
+
"@public-ui/components": "3.0.0-rc.11"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
53
53
|
"dist"
|
|
54
54
|
],
|
|
55
55
|
"scripts": {
|
|
56
|
+
"build": "tsc",
|
|
56
57
|
"reset": "pnpm i @public-ui/components@1.1.7",
|
|
57
58
|
"format": "prettier -c src",
|
|
58
|
-
"lint": "
|
|
59
|
+
"lint": "pnpm lint:eslint && pnpm lint:tsc",
|
|
60
|
+
"lint:eslint": "eslint src",
|
|
61
|
+
"lint:tsc": "tsc --noemit",
|
|
59
62
|
"start": "rimraf test && cpy \"../../samples/react/src/components\" test/src && cpy \"../../samples/react/public/*.html\" test/ && ts-node src/index.ts migrate --ignore-uncommitted-changes --test-tasks test",
|
|
60
63
|
"restart": "pnpm reset && pnpm start",
|
|
61
64
|
"unused": "knip",
|