@public-ui/kolibri-cli 1.7.0-rc.2 → 1.7.0-rc.4
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 +2 -0
- package/dist/index.js +1 -1
- package/dist/migrate/index.js +5 -5
- package/dist/migrate/runner/abstract-task.js +2 -1
- package/dist/migrate/runner/task-runner.js +13 -4
- package/dist/migrate/runner/tasks/common/GenericRenamePropertyTask.js +9 -11
- package/dist/migrate/runner/tasks/common/LabelExpertSlot.js +68 -0
- package/dist/migrate/runner/tasks/common/RemovePropertyNameTask.js +8 -7
- package/dist/migrate/runner/tasks/common/RenamePropertyNameTask.js +1 -4
- package/dist/migrate/runner/tasks/test/index.js +2 -6
- package/dist/migrate/runner/tasks/v1/index.js +17 -1
- package/dist/migrate/runner/tasks/v1/link-group.js +3 -2
- package/dist/migrate/shares/reuse.js +66 -11
- package/dist/types.js +2 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -153,6 +153,8 @@ If the migration failed, you can reset the migration with `git reset --hard HEAD
|
|
|
153
153
|
|
|
154
154
|
Use the configuration (`.kolibri.config.json`) to exclude some tasks.
|
|
155
155
|
|
|
156
|
+
If there are multiple obsolete properties that have been migrated to just one new property, the new property may appear multiple times in the tag. You can then decide which variant to use and remove all other variants accordingly.
|
|
157
|
+
|
|
156
158
|
Maybe it can help to prepare your code in the tricky places for migration.
|
|
157
159
|
|
|
158
160
|
Please give us feedback, if you have problems with the migration: [GitHub Issues](https://github.com/public-ui/kolibri/issues/new?assignees=&labels=useful+hint&projects=&template=7_feedback.md&title=%F0%9F%92%A1+CLI%3A+)
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
|
-
const migrate_1 = __importDefault(require("./migrate"));
|
|
9
8
|
const gradient_string_1 = __importDefault(require("gradient-string"));
|
|
9
|
+
const migrate_1 = __importDefault(require("./migrate"));
|
|
10
10
|
const reuse_1 = require("./migrate/shares/reuse");
|
|
11
11
|
const versionOfPublicUiKoliBriCli = (0, reuse_1.getVersionOfPublicUiKoliBriCli)();
|
|
12
12
|
const banner = gradient_string_1.default.atlas.multiline(`
|
package/dist/migrate/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function default_1(program) {
|
|
|
20
20
|
program
|
|
21
21
|
.command('migrate')
|
|
22
22
|
.description('This command migrates KoliBri code to the current version.')
|
|
23
|
-
.argument('
|
|
23
|
+
.argument('[string]', 'Source code folder to migrate', 'src')
|
|
24
24
|
.addOption(new commander_1.Option('--ignore-uncommitted-changes', 'Allows execution with uncommitted changes').default(false))
|
|
25
25
|
.addOption(new commander_1.Option('--remove-mode <mode>', 'Prefix property name or delete property').choices(types_1.REMOVE_MODE).default('prefix'))
|
|
26
26
|
.addOption(new commander_1.Option('--test-tasks', 'Run additional test tasks').default(false).hideHelp())
|
|
@@ -31,7 +31,7 @@ function default_1(program) {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
if (!options.ignoreUncommittedChanges && stdout) {
|
|
34
|
-
throw
|
|
34
|
+
throw (0, reuse_1.logAndCreateError)('There are uncommitted changes');
|
|
35
35
|
}
|
|
36
36
|
(0, reuse_1.setRemoveMode)(options.removeMode);
|
|
37
37
|
const versionOfPublicUiComponents = (0, reuse_1.getVersionOfPublicUiComponents)();
|
|
@@ -63,7 +63,7 @@ Source folder to migrate: ${baseDir}
|
|
|
63
63
|
runner.run();
|
|
64
64
|
if (version !== runner.getPendingMinVersion()) {
|
|
65
65
|
version = runner.getPendingMinVersion();
|
|
66
|
-
let packageJson = (0, reuse_1.
|
|
66
|
+
let packageJson = (0, reuse_1.getContentOfProjectPkgJson)();
|
|
67
67
|
packageJson = packageJson.replace(/"(@public-ui\/[^"]+)":\s*".*"/g, `"$1": "${version}"`);
|
|
68
68
|
fs_1.default.writeFileSync(path_1.default.resolve(process.cwd(), 'package.json'), packageJson);
|
|
69
69
|
runner.setProjectVersion(version);
|
|
@@ -78,7 +78,7 @@ Source folder to migrate: ${baseDir}
|
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
80
|
console.log(`
|
|
81
|
-
|
|
81
|
+
Status of all executed Tasks:`);
|
|
82
82
|
const status = runner.getStatus(true);
|
|
83
83
|
fs_1.default.writeFileSync(configFile, JSON.stringify(status.config, null, 2));
|
|
84
84
|
console.log(`
|
|
@@ -96,7 +96,7 @@ Is anything wrong, you can reset the migration with "git reset --hard HEAD~1" or
|
|
|
96
96
|
}
|
|
97
97
|
const status = runner.getStatus();
|
|
98
98
|
console.log(`
|
|
99
|
-
|
|
99
|
+
Execute ${status.total} registered tasks...`);
|
|
100
100
|
runLoop();
|
|
101
101
|
});
|
|
102
102
|
});
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AbstractTask = void 0;
|
|
7
7
|
const semver_1 = __importDefault(require("semver"));
|
|
8
8
|
const types_1 = require("../../types");
|
|
9
|
+
const reuse_1 = require("../shares/reuse");
|
|
9
10
|
class AbstractTask {
|
|
10
11
|
constructor(identifier, title, extensions, versionRange, dependentTasks = [], options = {}) {
|
|
11
12
|
this.identifier = identifier;
|
|
@@ -17,7 +18,7 @@ class AbstractTask {
|
|
|
17
18
|
this.description = options.description;
|
|
18
19
|
this.extensions = this.extensions.filter((ext) => types_1.FILE_EXTENSIONS.includes(ext));
|
|
19
20
|
if (!semver_1.default.validRange(this.versionRange)) {
|
|
20
|
-
throw
|
|
21
|
+
throw (0, reuse_1.logAndCreateError)(`[${this.identifier}] Invalid semver range version: ${this.versionRange}`);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
getDependentTasks() {
|
|
@@ -4,9 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TaskRunner = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const semver_1 = __importDefault(require("semver"));
|
|
11
|
+
const reuse_1 = require("../shares/reuse");
|
|
10
12
|
class TaskRunner {
|
|
11
13
|
constructor(baseDir, cliVersion, projectVersion, config) {
|
|
12
14
|
this.tasks = new Map();
|
|
@@ -25,19 +27,19 @@ class TaskRunner {
|
|
|
25
27
|
}
|
|
26
28
|
setBaseDir(baseDir) {
|
|
27
29
|
if (!fs_1.default.existsSync(path_1.default.resolve(process.cwd(), baseDir))) {
|
|
28
|
-
throw
|
|
30
|
+
throw (0, reuse_1.logAndCreateError)(`Base directory "${baseDir}" does not exist`);
|
|
29
31
|
}
|
|
30
32
|
this.baseDir = baseDir;
|
|
31
33
|
}
|
|
32
34
|
setCliVersion(version) {
|
|
33
35
|
if (semver_1.default.valid(version) === null) {
|
|
34
|
-
throw
|
|
36
|
+
throw (0, reuse_1.logAndCreateError)(`Invalid CLI version: ${version}`);
|
|
35
37
|
}
|
|
36
38
|
this.cliVersion = version;
|
|
37
39
|
}
|
|
38
40
|
setProjectVersion(version) {
|
|
39
41
|
if (semver_1.default.valid(version) === null) {
|
|
40
|
-
throw
|
|
42
|
+
throw (0, reuse_1.logAndCreateError)(`Invalid project version: ${version}`);
|
|
41
43
|
}
|
|
42
44
|
if (this.projectVersion !== version) {
|
|
43
45
|
this.projectVersion = version;
|
|
@@ -62,6 +64,9 @@ class TaskRunner {
|
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
66
|
}
|
|
67
|
+
registerTask(task) {
|
|
68
|
+
this.registerTasks([task]);
|
|
69
|
+
}
|
|
65
70
|
runTask(task) {
|
|
66
71
|
var _a;
|
|
67
72
|
if (((_a = this.config.migrate) === null || _a === void 0 ? void 0 : _a.tasks[task.getIdentifier()]) === false) {
|
|
@@ -74,6 +79,9 @@ class TaskRunner {
|
|
|
74
79
|
includePrerelease: true,
|
|
75
80
|
})) {
|
|
76
81
|
// task.setStatus('running'); only of the task is async
|
|
82
|
+
if (!this.tasks.has(task.getIdentifier())) {
|
|
83
|
+
this.registerTask(task);
|
|
84
|
+
}
|
|
77
85
|
task.run(this.baseDir);
|
|
78
86
|
task.setStatus('done');
|
|
79
87
|
}
|
|
@@ -118,7 +126,8 @@ class TaskRunner {
|
|
|
118
126
|
break;
|
|
119
127
|
}
|
|
120
128
|
if (outline) {
|
|
121
|
-
|
|
129
|
+
const status = task.getStatus();
|
|
130
|
+
console.log(`- ${task.getTitle()}:`, status === 'done' ? chalk_1.default.green(status) : chalk_1.default.yellow(status));
|
|
122
131
|
}
|
|
123
132
|
});
|
|
124
133
|
return {
|
|
@@ -8,25 +8,23 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const types_1 = require("../../../../types");
|
|
9
9
|
const reuse_1 = require("../../../shares/reuse");
|
|
10
10
|
const abstract_task_1 = require("../../abstract-task");
|
|
11
|
-
const
|
|
12
|
-
const DATA_REMOVED_REGEXP = /DataRemoved_/g; // not /DataRemoved-_/g
|
|
11
|
+
const DATA_REMOVED_REGEXP = /DataRemoved_/gi; // not /DataRemoved-_/g
|
|
13
12
|
const DATA_REMOVEDS_REGEXP = /(data-removed-){2,}/g;
|
|
14
13
|
class GenericRenamePropertyTask extends abstract_task_1.AbstractTask {
|
|
15
14
|
constructor(identifier, description, tag, oldProperty, newProperty, versionRange, dependentTasks = [], options = {}) {
|
|
16
|
-
super(identifier, description,
|
|
15
|
+
super(identifier, description, types_1.MARKUP_EXTENSIONS, versionRange, dependentTasks, options);
|
|
16
|
+
this.newProperty = newProperty;
|
|
17
17
|
if (!reuse_1.isTagKebabCaseRegExp.test(tag)) {
|
|
18
|
-
throw
|
|
18
|
+
throw (0, reuse_1.logAndCreateError)(`Tag "${tag}" is not in kebab case.`);
|
|
19
19
|
}
|
|
20
20
|
if (!reuse_1.isPropertyKebabCaseRegExp.test(oldProperty)) {
|
|
21
|
-
throw
|
|
21
|
+
throw (0, reuse_1.logAndCreateError)(`Old property "${oldProperty}" is not in kebab case.`);
|
|
22
22
|
}
|
|
23
23
|
if (!reuse_1.isPropertyKebabCaseRegExp.test(newProperty)) {
|
|
24
|
-
throw
|
|
24
|
+
throw (0, reuse_1.logAndCreateError)(`New property "${newProperty}" is not in kebab case.`);
|
|
25
25
|
}
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.newPropertyInCamelCase = (0, reuse_1.kebabToCapitalCase)(newProperty);
|
|
29
|
-
this.componentRegExp = new RegExp(`(<${(0, reuse_1.kebabToCapitalCase)(tag)}[^>]+)${this.oldPropertyInCamelCase}([ >=])`, 'g');
|
|
26
|
+
this.newPropertyInCamelCase = (0, reuse_1.kebabToCamelCase)(newProperty);
|
|
27
|
+
this.componentRegExp = new RegExp(`(<${(0, reuse_1.kebabToCapitalCase)(tag)}[^>]+)${(0, reuse_1.kebabToCapitalCase)(oldProperty)}([ >=])`, 'g');
|
|
30
28
|
this.customElementRegExp = new RegExp(`(<${tag}[^>]+)${oldProperty}([ >=])`, 'g');
|
|
31
29
|
}
|
|
32
30
|
run(baseDir) {
|
|
@@ -48,7 +46,7 @@ class GenericRenamePropertyTask extends abstract_task_1.AbstractTask {
|
|
|
48
46
|
});
|
|
49
47
|
}
|
|
50
48
|
transpileCustomElementFileRename(baseDir) {
|
|
51
|
-
(0, reuse_1.filterFilesByExt)(baseDir, types_1.
|
|
49
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS).forEach((file) => {
|
|
52
50
|
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
53
51
|
const newContent = content
|
|
54
52
|
// Replacements
|
|
@@ -0,0 +1,68 @@
|
|
|
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.LabelExpertSlot = 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
|
+
const removeLineBreaksAndSpaces = (match) => {
|
|
12
|
+
return match.replace(/\r?\n/g, ' ').replace(/>\s+/g, '>').replace(/\s+</g, '<');
|
|
13
|
+
};
|
|
14
|
+
class LabelExpertSlot extends abstract_task_1.AbstractTask {
|
|
15
|
+
constructor(identifier, tag, property, versionRange, dependentTasks, options) {
|
|
16
|
+
super(identifier, `Move innerText of "${tag}" component to property "${property}"`, types_1.MARKUP_EXTENSIONS, versionRange, dependentTasks, options);
|
|
17
|
+
this.property = property;
|
|
18
|
+
if (!reuse_1.isTagKebabCaseRegExp.test(tag)) {
|
|
19
|
+
throw (0, reuse_1.logAndCreateError)(`Tag "${tag}" is not in kebab case.`);
|
|
20
|
+
}
|
|
21
|
+
if (!reuse_1.isPropertyKebabCaseRegExp.test(property)) {
|
|
22
|
+
throw (0, reuse_1.logAndCreateError)(`Property "${property}" is not in kebab case.`);
|
|
23
|
+
}
|
|
24
|
+
const tagCapitalCase = (0, reuse_1.kebabToCapitalCase)(tag);
|
|
25
|
+
this.propertyInCamelCase = (0, reuse_1.kebabToCamelCase)(property);
|
|
26
|
+
// https://regex101.com/r/WkEKxu/1
|
|
27
|
+
this.componentRegExp = new RegExp(`(<${tagCapitalCase}[^>]*)>([^<]+(\\n\\s*)*)(<\\/${tagCapitalCase}>)`, 'g');
|
|
28
|
+
this.customElementRegExp = new RegExp(`(<${tag}[^>]*)>([^<]+(\\n\\s*)*)(<\\/${tag}>)`, 'g');
|
|
29
|
+
}
|
|
30
|
+
static getInstance(tag, property, versionRange, dependentTasks = [], options = {}) {
|
|
31
|
+
const identifier = `${tag}-move-innerText-to-property-${property}`;
|
|
32
|
+
if (!this.instances.has(identifier)) {
|
|
33
|
+
this.instances.set(identifier, new LabelExpertSlot(identifier, tag, property, versionRange, dependentTasks, options));
|
|
34
|
+
}
|
|
35
|
+
return this.instances.get(identifier);
|
|
36
|
+
}
|
|
37
|
+
run(baseDir) {
|
|
38
|
+
this.transpileComponentFileDelete(baseDir);
|
|
39
|
+
this.transpileCustomElementFileDelete(baseDir);
|
|
40
|
+
}
|
|
41
|
+
transpileComponentFileDelete(baseDir) {
|
|
42
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS).forEach((file) => {
|
|
43
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
44
|
+
const newContent = content
|
|
45
|
+
// Replacements
|
|
46
|
+
.replace(this.componentRegExp, removeLineBreaksAndSpaces)
|
|
47
|
+
.replace(this.componentRegExp, `$1 ${this.propertyInCamelCase}="$2">$4`);
|
|
48
|
+
if (content !== newContent) {
|
|
49
|
+
reuse_1.MODIFIED_FILES.add(file);
|
|
50
|
+
fs_1.default.writeFileSync(file, newContent);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
transpileCustomElementFileDelete(baseDir) {
|
|
55
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS).forEach((file) => {
|
|
56
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
57
|
+
const newContent = content
|
|
58
|
+
// Replacements
|
|
59
|
+
.replace(this.customElementRegExp, removeLineBreaksAndSpaces)
|
|
60
|
+
.replace(this.customElementRegExp, `$1 ${this.property}="$2">$4`);
|
|
61
|
+
if (content !== newContent) {
|
|
62
|
+
reuse_1.MODIFIED_FILES.add(file);
|
|
63
|
+
// fs.writeFileSync(file, newContent);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.LabelExpertSlot = LabelExpertSlot;
|
|
@@ -13,15 +13,16 @@ class RemovePropertyNameTask extends GenericRenamePropertyTask_1.GenericRenamePr
|
|
|
13
13
|
constructor(identifier, tag, property, versionRange, dependentTasks, options) {
|
|
14
14
|
super(identifier, `Remove property "${property}" of "${tag}" component`, tag, property, `data-removed-${property}`, versionRange, dependentTasks, options);
|
|
15
15
|
if (!reuse_1.isTagKebabCaseRegExp.test(tag)) {
|
|
16
|
-
throw
|
|
16
|
+
throw (0, reuse_1.logAndCreateError)(`Tag "${tag}" is not in kebab case.`);
|
|
17
17
|
}
|
|
18
18
|
if (!reuse_1.isPropertyKebabCaseRegExp.test(property)) {
|
|
19
|
-
throw
|
|
19
|
+
throw (0, reuse_1.logAndCreateError)(`Property "${property}" is not in kebab case.`);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
21
|
+
const tagCapitalCase = (0, reuse_1.kebabToCapitalCase)(tag);
|
|
22
|
+
const propertyInCamelCase = (0, reuse_1.kebabToCamelCase)(property);
|
|
23
|
+
this.componentRegExpBoolean = new RegExp(`(<${tagCapitalCase}[^>]+)${propertyInCamelCase}([ >])`, 'g');
|
|
24
|
+
this.componentRegExpCurlyBrackets = new RegExp(`(<${tagCapitalCase}[^>]+)${propertyInCamelCase}(=\\{[^\\}]+\\})`, 'g');
|
|
25
|
+
this.componentRegExpQuotationMarks = new RegExp(`(<${tagCapitalCase}[^>]+)${propertyInCamelCase}(="[^"]+")`, 'g');
|
|
25
26
|
this.customElementRegExpBoolean = new RegExp(`(<${tag}[^>]+)${property}([ >])`, 'g');
|
|
26
27
|
this.customElementRegExpCurlyBrackets = new RegExp(`(<${tag}[^>]+)${property}(=\\{[^\\}]+\\})`, 'g');
|
|
27
28
|
this.customElementRegExpQuotationMarks = new RegExp(`(<${tag}[^>]+)${property}(="[^"]+")`, 'g');
|
|
@@ -59,7 +60,7 @@ class RemovePropertyNameTask extends GenericRenamePropertyTask_1.GenericRenamePr
|
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
transpileCustomElementFileDelete(baseDir) {
|
|
62
|
-
(0, reuse_1.filterFilesByExt)(baseDir, types_1.
|
|
63
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS).forEach((file) => {
|
|
63
64
|
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
64
65
|
const newContent = content
|
|
65
66
|
// Replacements
|
|
@@ -3,14 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RenamePropertyNameTask = void 0;
|
|
4
4
|
const GenericRenamePropertyTask_1 = require("./GenericRenamePropertyTask");
|
|
5
5
|
class RenamePropertyNameTask extends GenericRenamePropertyTask_1.GenericRenamePropertyTask {
|
|
6
|
-
constructor(identifier, tag, oldProperty, newProperty, versionRange, dependentTasks = [], options = {}) {
|
|
7
|
-
super(identifier, `Rename property "${oldProperty}" to "${newProperty}" of "${tag}" component`, tag, oldProperty, newProperty, versionRange, dependentTasks, options);
|
|
8
|
-
}
|
|
9
6
|
static getInstance(tag, oldProperty, newProperty, versionRange, dependentTasks = [], options = {}) {
|
|
10
7
|
var _a;
|
|
11
8
|
const identifier = `${tag}-rename-property-${oldProperty}-to-${newProperty}`;
|
|
12
9
|
if (!this.instances.has(identifier)) {
|
|
13
|
-
(_a = this.instances) === null || _a === void 0 ? void 0 : _a.set(identifier, new RenamePropertyNameTask(identifier, tag, oldProperty, newProperty, versionRange, dependentTasks, options));
|
|
10
|
+
(_a = this.instances) === null || _a === void 0 ? void 0 : _a.set(identifier, new RenamePropertyNameTask(identifier, `Rename property "${oldProperty}" to "${newProperty}" of "${tag}" component`, tag, oldProperty, newProperty, versionRange, dependentTasks, options));
|
|
14
11
|
}
|
|
15
12
|
return this.instances.get(identifier);
|
|
16
13
|
}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.testTasks = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
4
|
const reuse_1 = require("../../../shares/reuse");
|
|
9
5
|
const test_version_1_3_1 = require("./test-version-1.3");
|
|
6
|
+
const test_version_current_1 = require("./test-version-current");
|
|
10
7
|
const test_version_next_2_1 = require("./test-version-next-2");
|
|
11
8
|
const test_version_next_3_1 = require("./test-version-next-3");
|
|
12
9
|
const test_version_zero_1 = require("./test-version-zero");
|
|
13
|
-
const test_version_current_1 = require("./test-version-current");
|
|
14
10
|
exports.testTasks = [];
|
|
15
11
|
exports.testTasks.push(test_version_zero_1.TestVersionZero.getInstance());
|
|
16
12
|
exports.testTasks.push(test_version_next_2_1.TestVersionNext2.getInstance());
|
|
17
13
|
exports.testTasks.push(test_version_next_3_1.TestVersionNext3.getInstance());
|
|
18
14
|
exports.testTasks.push(test_version_1_3_1.TestVersion13.getInstance());
|
|
19
|
-
const versionOfPublicUiComponents = (0, reuse_1.
|
|
15
|
+
const versionOfPublicUiComponents = (0, reuse_1.getVersionOfPublicUiComponents)();
|
|
20
16
|
exports.testTasks.push(test_version_current_1.TestVersionCurrent.getInstance(versionOfPublicUiComponents));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.v1Tasks = void 0;
|
|
4
|
+
const LabelExpertSlot_1 = require("../common/LabelExpertSlot");
|
|
4
5
|
const abbr_1 = require("./abbr");
|
|
5
6
|
const accordion_1 = require("./accordion");
|
|
6
7
|
const badge_1 = require("./badge");
|
|
@@ -81,10 +82,11 @@ exports.v1Tasks.push(link_1.LinkRemovePropertySelector);
|
|
|
81
82
|
exports.v1Tasks.push(link_1.LinkRemovePropertyStealth);
|
|
82
83
|
exports.v1Tasks.push(link_1.LinkRemovePropertyUseCase);
|
|
83
84
|
exports.v1Tasks.push(logo_1.LogoRenamePropertyAbbrToOrg);
|
|
84
|
-
exports.v1Tasks.push(modal_1.ModalRenamePropertyAriaLabelToLabel);
|
|
85
85
|
exports.v1Tasks.push(link_group_1.LinkGroupRenamePropertyAriaLabelToLabel);
|
|
86
|
+
exports.v1Tasks.push(link_group_1.LinkGroupRenamePropertyHeadingToLabel);
|
|
86
87
|
exports.v1Tasks.push(link_group_1.LinkGroupRemovePropertyHeading);
|
|
87
88
|
exports.v1Tasks.push(link_group_1.LinkGroupRemovePropertyOrdered);
|
|
89
|
+
exports.v1Tasks.push(modal_1.ModalRenamePropertyAriaLabelToLabel);
|
|
88
90
|
exports.v1Tasks.push(nav_1.NavRenamePropertyAriaLabelToLabel);
|
|
89
91
|
exports.v1Tasks.push(nav_1.NavRenamePropertyCompactToHideLabel);
|
|
90
92
|
exports.v1Tasks.push(nav_1.NavRemovePropertyHasCompactButton);
|
|
@@ -103,3 +105,17 @@ exports.v1Tasks.push(tabs_1.TabsRenamePropertyAriaLabelToLabel);
|
|
|
103
105
|
exports.v1Tasks.push(tabs_1.TabsRenamePropertyTabAlignToAlign);
|
|
104
106
|
exports.v1Tasks.push(toast_1.ToastRenamePropertyHeadingToLabel);
|
|
105
107
|
exports.v1Tasks.push(version_1.VersionRenamePropertyVersionToLabel);
|
|
108
|
+
exports.v1Tasks.push(LabelExpertSlot_1.LabelExpertSlot.getInstance('kol-heading', '_label', '^1'));
|
|
109
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-checkbox', '_label', '^1'));
|
|
110
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-color', '_label', '^1'));
|
|
111
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-date', '_label', '^1'));
|
|
112
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-email', '_label', '^1'));
|
|
113
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-file', '_label', '^1'));
|
|
114
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-number', '_label', '^1'));
|
|
115
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-password', '_label', '^1'));
|
|
116
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-radio', '_label', '^1'));
|
|
117
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-range', '_label', '^1'));
|
|
118
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-input-text', '_label', '^1'));
|
|
119
|
+
exports.v1Tasks.push(LabelExpertSlot_1.LabelExpertSlot.getInstance('kol-link', '_label', '^1'));
|
|
120
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-select', '_label', '^1'));
|
|
121
|
+
// v1Tasks.push(LabelExpertSlot.getInstance('kol-textarea', '_label', '^1'));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LinkGroupRemovePropertyOrdered = exports.LinkGroupRemovePropertyHeading = exports.LinkGroupRenamePropertyAriaLabelToLabel = void 0;
|
|
3
|
+
exports.LinkGroupRemovePropertyOrdered = exports.LinkGroupRemovePropertyHeading = exports.LinkGroupRenamePropertyHeadingToLabel = exports.LinkGroupRenamePropertyAriaLabelToLabel = void 0;
|
|
4
4
|
const RemovePropertyNameTask_1 = require("../common/RemovePropertyNameTask");
|
|
5
5
|
const RenamePropertyNameTask_1 = require("../common/RenamePropertyNameTask");
|
|
6
6
|
exports.LinkGroupRenamePropertyAriaLabelToLabel = RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance('kol-link-group', '_aria-label', '_label', '^1');
|
|
7
|
-
exports.
|
|
7
|
+
exports.LinkGroupRenamePropertyHeadingToLabel = RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance('kol-link-group', '_heading', '_label', '^1');
|
|
8
|
+
exports.LinkGroupRemovePropertyHeading = RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-link-group', '_heading', '^1', [exports.LinkGroupRenamePropertyHeadingToLabel]);
|
|
8
9
|
exports.LinkGroupRemovePropertyOrdered = RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-link-group', '_ordered', '^1');
|
|
@@ -3,9 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getVersionOfPublicUiKoliBriCli = exports.getVersionOfPublicUiComponents = exports.getRemoveMode = exports.setRemoveMode = exports.MODIFIED_FILES = exports.
|
|
6
|
+
exports.getVersionOfPublicUiKoliBriCli = exports.getVersionOfPublicUiComponents = exports.getContentOfProjectPkgJson = exports.getRemoveMode = exports.setRemoveMode = exports.MODIFIED_FILES = exports.kebabToCamelCase = exports.kebabToCapitalCase = exports.isPropertyKebabCaseRegExp = exports.isTagKebabCaseRegExp = exports.getPackageManagerInstallCommand = exports.filterFilesByExt = exports.logAndCreateError = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
/**
|
|
11
|
+
* This function is used to exit the process with an error message.
|
|
12
|
+
* @param {string} msg The error message
|
|
13
|
+
* @param {string} hint The hint message
|
|
14
|
+
* @returns {Error} The error object
|
|
15
|
+
*/
|
|
16
|
+
function logAndCreateError(msg, hint) {
|
|
17
|
+
const hintText = hint
|
|
18
|
+
? chalk_1.default.yellow(`
|
|
19
|
+
ℹ️ `, chalk_1.default.underline.bold(`Hinweis:`), hint, `
|
|
20
|
+
`)
|
|
21
|
+
: '';
|
|
22
|
+
console.log(chalk_1.default.red(chalk_1.default.underline.bold(`
|
|
23
|
+
Error:`), `${msg}
|
|
24
|
+
`), hintText, `
|
|
25
|
+
👉 You can report this error to`, chalk_1.default.blue(`https://github.com/public-ui/kolibri/issues/new?title=CLI:+`), `
|
|
26
|
+
`);
|
|
27
|
+
// @todo process.exit(1); // makes `hint` undefined - ?!
|
|
28
|
+
return new Error();
|
|
29
|
+
}
|
|
30
|
+
exports.logAndCreateError = logAndCreateError;
|
|
9
31
|
/**
|
|
10
32
|
* Recursively searches for files with the specified extension in the specified directory.
|
|
11
33
|
* @param {string} dir The directory to search in
|
|
@@ -36,11 +58,10 @@ exports.filterFilesByExt = filterFilesByExt;
|
|
|
36
58
|
function readPackageString(offsetPath) {
|
|
37
59
|
offsetPath = path_1.default.resolve(offsetPath, 'package.json');
|
|
38
60
|
if (!fs_1.default.existsSync(offsetPath)) {
|
|
39
|
-
throw
|
|
61
|
+
throw logAndCreateError(`The following "package.json" does not exists: ${offsetPath}`);
|
|
40
62
|
}
|
|
41
63
|
return fs_1.default.readFileSync(offsetPath, 'utf8');
|
|
42
64
|
}
|
|
43
|
-
exports.readPackageString = readPackageString;
|
|
44
65
|
/**
|
|
45
66
|
* This function is used to get the version of the package.json.
|
|
46
67
|
* @param {string} offsetPath The offset path to the package.json
|
|
@@ -53,11 +74,10 @@ function readPackageJson(offsetPath) {
|
|
|
53
74
|
json = JSON.parse(content);
|
|
54
75
|
}
|
|
55
76
|
catch (err) {
|
|
56
|
-
throw
|
|
77
|
+
throw logAndCreateError(`The following "package.json" content could not parse: ${content}`);
|
|
57
78
|
}
|
|
58
79
|
return json;
|
|
59
80
|
}
|
|
60
|
-
exports.readPackageJson = readPackageJson;
|
|
61
81
|
/**
|
|
62
82
|
* This function is used to get the package manager install command.
|
|
63
83
|
* @param {string} baseDir The base directory to start searching for the package manager
|
|
@@ -72,7 +92,7 @@ function getPackageManagerInstallCommand(baseDir = process.cwd()) {
|
|
|
72
92
|
return 'npm i';
|
|
73
93
|
baseDir = path_1.default.resolve(baseDir, '..');
|
|
74
94
|
if (baseDir === '/') {
|
|
75
|
-
throw
|
|
95
|
+
throw logAndCreateError('Package manager could not detected.');
|
|
76
96
|
}
|
|
77
97
|
return getPackageManagerInstallCommand(baseDir);
|
|
78
98
|
}
|
|
@@ -81,16 +101,28 @@ exports.isTagKebabCaseRegExp = /^kol-[a-z]+(-[a-z]+)*$/;
|
|
|
81
101
|
exports.isPropertyKebabCaseRegExp = /^(data-removed-)?_[a-z]+(-[a-z]+)*$/;
|
|
82
102
|
/**
|
|
83
103
|
* Converts a kebab case string to a capital case string.
|
|
84
|
-
* @param {string}
|
|
104
|
+
* @param {string} str The kebab case string
|
|
85
105
|
* @returns {string} The capital case string
|
|
86
106
|
*/
|
|
87
|
-
function kebabToCapitalCase(
|
|
88
|
-
return
|
|
107
|
+
function kebabToCapitalCase(str) {
|
|
108
|
+
return str
|
|
89
109
|
.split('-') // Split on hyphen
|
|
90
110
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) // Capitalize each word
|
|
91
111
|
.join(''); // Join without space
|
|
92
112
|
}
|
|
93
113
|
exports.kebabToCapitalCase = kebabToCapitalCase;
|
|
114
|
+
/**
|
|
115
|
+
* Converts a kebab case string to a camel case string.
|
|
116
|
+
* @param {string} str The kebab case string
|
|
117
|
+
* @returns {string} The camel case string
|
|
118
|
+
*/
|
|
119
|
+
function kebabToCamelCase(str) {
|
|
120
|
+
return str
|
|
121
|
+
.split('-') // Split on hyphen
|
|
122
|
+
.map((word, index) => (index === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())) // Capitalize each word
|
|
123
|
+
.join(''); // Join without space
|
|
124
|
+
}
|
|
125
|
+
exports.kebabToCamelCase = kebabToCamelCase;
|
|
94
126
|
exports.MODIFIED_FILES = new Set();
|
|
95
127
|
let REMOVE_MODE = 'prefix';
|
|
96
128
|
/**
|
|
@@ -109,7 +141,30 @@ function getRemoveMode() {
|
|
|
109
141
|
return REMOVE_MODE;
|
|
110
142
|
}
|
|
111
143
|
exports.getRemoveMode = getRemoveMode;
|
|
112
|
-
const
|
|
144
|
+
const getContentOfProjectPkgJson = () => {
|
|
145
|
+
try {
|
|
146
|
+
return readPackageString(path_1.default.resolve(process.cwd()));
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
throw logAndCreateError('Could not read content of project "package.json"!');
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
exports.getContentOfProjectPkgJson = getContentOfProjectPkgJson;
|
|
153
|
+
const getVersionOfPublicUiComponents = () => {
|
|
154
|
+
try {
|
|
155
|
+
return readPackageJson(path_1.default.resolve(process.cwd(), 'node_modules/@public-ui/components')).version;
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
throw logAndCreateError('Could not get version of installed "@public-ui/components" package!', 'Check that you are in the root directory of your project and that the package "@public-ui/components" is installed.');
|
|
159
|
+
}
|
|
160
|
+
};
|
|
113
161
|
exports.getVersionOfPublicUiComponents = getVersionOfPublicUiComponents;
|
|
114
|
-
const getVersionOfPublicUiKoliBriCli = () =>
|
|
162
|
+
const getVersionOfPublicUiKoliBriCli = () => {
|
|
163
|
+
try {
|
|
164
|
+
return readPackageJson(path_1.default.resolve(__dirname, '..', '..', '..')).version;
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
throw logAndCreateError('Could not get version of global installed "@public-ui/kolibri-cli" package!', 'Install the package with: npm i -g @public-ui/kolibri-cli');
|
|
168
|
+
}
|
|
169
|
+
};
|
|
115
170
|
exports.getVersionOfPublicUiKoliBriCli = getVersionOfPublicUiKoliBriCli;
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CUSTOM_ELEMENT_FILE_EXTENSIONS = exports.COMPONENT_FILE_EXTENSIONS = exports.FILE_EXTENSIONS = void 0;
|
|
3
|
+
exports.MARKUP_EXTENSIONS = exports.CUSTOM_ELEMENT_FILE_EXTENSIONS = exports.COMPONENT_FILE_EXTENSIONS = exports.FILE_EXTENSIONS = void 0;
|
|
4
4
|
exports.FILE_EXTENSIONS = ['html', 'js', 'json', 'jsx', 'ts', 'tsx', 'vue'];
|
|
5
5
|
exports.COMPONENT_FILE_EXTENSIONS = ['jsx', 'tsx', 'vue'];
|
|
6
6
|
exports.CUSTOM_ELEMENT_FILE_EXTENSIONS = ['html', 'jsx', 'tsx', 'vue'];
|
|
7
|
+
exports.MARKUP_EXTENSIONS = exports.COMPONENT_FILE_EXTENSIONS.concat(exports.CUSTOM_ELEMENT_FILE_EXTENSIONS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/kolibri-cli",
|
|
3
|
-
"version": "1.7.0-rc.
|
|
3
|
+
"version": "1.7.0-rc.4",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": "https://github.com/public-ui/kolibri",
|
|
@@ -22,14 +22,15 @@
|
|
|
22
22
|
"format": "prettier -c src",
|
|
23
23
|
"lint": "eslint src && tsc --noEmit",
|
|
24
24
|
"prepack": "tsc",
|
|
25
|
-
"start": "ts-node src/index.ts migrate --test-tasks test",
|
|
25
|
+
"start": "ts-node src/index.ts migrate --ignore-uncommitted-changes --test-tasks test",
|
|
26
26
|
"restart": "pnpm reset && pnpm start",
|
|
27
27
|
"unused": "knip",
|
|
28
28
|
"update": "ncu -t minor -u && ncu",
|
|
29
|
-
"watch": "nodemon --ignore package.json src/index.ts migrate --test-tasks test"
|
|
29
|
+
"watch": "nodemon --ignore package.json src/index.ts migrate --ignore-uncommitted-changes --test-tasks test"
|
|
30
30
|
},
|
|
31
|
+
"type": "commonjs",
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"chalk": "
|
|
33
|
+
"chalk": "^4",
|
|
33
34
|
"commander": "11.0.0",
|
|
34
35
|
"gradient-string": "2.0.2",
|
|
35
36
|
"loglevel": "1.8.1",
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
"@public-ui/components": "1.1.7",
|
|
41
42
|
"@types/gradient-string": "1.1.2",
|
|
42
43
|
"@types/node": "20.5.9",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
44
|
-
"@typescript-eslint/parser": "6.
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "6.6.0",
|
|
45
|
+
"@typescript-eslint/parser": "6.6.0",
|
|
45
46
|
"depcheck": "1.4.5",
|
|
46
47
|
"eslint-config-prettier": "9.0.0",
|
|
47
48
|
"eslint-plugin-html": "7.1.0",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
51
52
|
"eslint-plugin-no-loops": "0.3.0",
|
|
52
53
|
"eslint-plugin-react": "7.33.2",
|
|
53
|
-
"knip": "2.
|
|
54
|
+
"knip": "2.22.0",
|
|
54
55
|
"mocha": "10.2.0",
|
|
55
56
|
"nodemon": "3.0.1",
|
|
56
57
|
"npm-check-updates": "16.13.2",
|