@public-ui/kolibri-cli 1.7.0-rc.0 → 1.7.0-rc.2
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 +32 -9
- package/dist/index.js +6 -4
- package/dist/migrate/index.js +10 -13
- package/dist/migrate/runner/task-runner.js +0 -10
- package/dist/migrate/runner/tasks/v1/index.js +27 -0
- package/dist/migrate/runner/tasks/v1/input-number.js +1 -1
- package/dist/migrate/runner/types.js +1 -2
- package/dist/migrate/shares/reuse.js +6 -20
- package/dist/migrate/types.js +4 -0
- package/package.json +3 -3
- package/dist/migrate/runner/tasks/index.js +0 -18
- package/dist/migrate/runner/tasks/test-tasks.js +0 -12
- package/dist/migrate/runner/tasks/v1/abbr-property-renaming-title-to-label.js +0 -30
- package/dist/migrate/runner/tasks/v1/accordion-property-renaming-heading-to-label.js +0 -30
- package/dist/migrate/runner/tasks/v1/test-version-1.3.js +0 -17
- package/dist/migrate/runner/tasks/v1/test-version-current.js +0 -17
- package/dist/migrate/runner/tasks/v1/test-version-next-2.js +0 -17
- package/dist/migrate/runner/tasks/v1/test-version-next-3.js +0 -17
- package/dist/migrate/runner/tasks/v1/test-version-zero.js +0 -17
- package/dist/runner/abstract-task.js +0 -48
- package/dist/runner/task-runner.js +0 -28
- package/dist/runner/tasks/abbr-property-renaming-title-to-label.js +0 -27
- package/dist/runner/tasks/index.js +0 -6
- package/dist/runner/types.js +0 -4
- package/dist/shares/reuse.js +0 -48
package/README.md
CHANGED
|
@@ -16,12 +16,33 @@ yarn add -g @public-ui/kolibri-cli
|
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
Use the `kolibri` command to start the CLI.
|
|
19
|
+
The `KoliBri` CLI is intended to be executed in your project root directory. Use the `kolibri` command to start the CLI.
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
kolibri --help
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
```bash
|
|
26
|
+
,--. ,--. ,--. ,--. ,-----. ,--.
|
|
27
|
+
| .' / ,---. | | `--' | |) /_ ,--.--. `--'
|
|
28
|
+
| . ' | .-. | | | ,--. | .-. \ | .--' ,--.
|
|
29
|
+
| |\ \ | '-' | | | | | | '--' / | | | |
|
|
30
|
+
`--' `--´ `---´ `--' `--' `------´ `--' `--'
|
|
31
|
+
🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io
|
|
32
|
+
|
|
33
|
+
Usage: kolibri [options] [command]
|
|
34
|
+
|
|
35
|
+
CLI for executing some helpful commands for KoliBri projects.
|
|
36
|
+
|
|
37
|
+
Options:
|
|
38
|
+
-V, --version output the version number
|
|
39
|
+
-h, --help display help for command
|
|
40
|
+
|
|
41
|
+
Commands:
|
|
42
|
+
migrate [options] <string> This command migrates KoliBri code to the current version.
|
|
43
|
+
help [command] display help for command
|
|
44
|
+
```
|
|
45
|
+
|
|
25
46
|
### Migrate
|
|
26
47
|
|
|
27
48
|
With the `migrate` command you can migrate your project to the latest version of `KoliBri`.
|
|
@@ -41,12 +62,13 @@ Actually the following migrations are available:
|
|
|
41
62
|
|
|
42
63
|
#### How does it work?
|
|
43
64
|
|
|
44
|
-
1. The migration command will check your project for clear `git history` and the `installed version` of `KoliBri`. Now it
|
|
45
|
-
2.
|
|
65
|
+
1. The migration command will check your project for clear `git history` and the `installed version` of `KoliBri`. Now it loads all available migration tasks.
|
|
66
|
+
2. Tasks in the correct version range will be executed one by one. Otherwise they will be skipped.
|
|
46
67
|
3. After that the `package.json` will be updated with the new version of `KoliBri` and execute the `npm install` command.
|
|
47
|
-
4.
|
|
68
|
+
4. If there are any pending tasks, the migration command will be executed again. Otherwise the migration is finished.
|
|
69
|
+
5. Now you can check the result and commit the changes.
|
|
48
70
|
|
|
49
|
-
|
|
71
|
+
> **Note:** You can reset the migration with `git reset --hard HEAD~1` or by discarding the affected files.
|
|
50
72
|
|
|
51
73
|
#### Help
|
|
52
74
|
|
|
@@ -62,9 +84,10 @@ kolibri migrate <path>
|
|
|
62
84
|
|
|
63
85
|
#### Options
|
|
64
86
|
|
|
65
|
-
| Option
|
|
66
|
-
|
|
|
67
|
-
| `--
|
|
87
|
+
| Option | Description | Type | Default |
|
|
88
|
+
| ------------------------------ | ----------------------------------------- | :------------------: | :------: |
|
|
89
|
+
| `--ignore-uncommitted-changes` | Allows execution with uncommitted changes | boolean | false |
|
|
90
|
+
| `--remove-mode` | Prefix property name or delete property | `delete` \| `prefix` | `prefix` |
|
|
68
91
|
|
|
69
92
|
#### Configuration
|
|
70
93
|
|
|
@@ -140,4 +163,4 @@ You have always the possibility of a dry run. Because before the migration will
|
|
|
140
163
|
|
|
141
164
|
After the migration you can check the result with `git status` and `git diff`.
|
|
142
165
|
|
|
143
|
-
Is anything wrong, you can reset the migration with `git reset --hard HEAD~1
|
|
166
|
+
Is anything wrong, you can reset the migration with `git reset --hard HEAD~1` or by discarding the affected files.
|
package/dist/index.js
CHANGED
|
@@ -7,19 +7,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const migrate_1 = __importDefault(require("./migrate"));
|
|
9
9
|
const gradient_string_1 = __importDefault(require("gradient-string"));
|
|
10
|
-
const
|
|
10
|
+
const reuse_1 = require("./migrate/shares/reuse");
|
|
11
|
+
const versionOfPublicUiKoliBriCli = (0, reuse_1.getVersionOfPublicUiKoliBriCli)();
|
|
12
|
+
const banner = gradient_string_1.default.atlas.multiline(`
|
|
11
13
|
,--. ,--. ,--. ,--. ,-----. ,--.
|
|
12
14
|
| .' / ,---. | | \`--' | |) /_ ,--.--. \`--'
|
|
13
15
|
| . ' | .-. | | | ,--. | .-. \\ | .--' ,--.
|
|
14
16
|
| |\\ \\ | '-' | | | | | | '--' / | | | |
|
|
15
17
|
\`--' \`--´ \`---´ \`--' \`--' \`------´ \`--' \`--'
|
|
16
|
-
🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io |
|
|
18
|
+
🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | ${versionOfPublicUiKoliBriCli}
|
|
17
19
|
`, {
|
|
18
20
|
interpolation: 'hsv',
|
|
19
21
|
});
|
|
20
|
-
console.log(
|
|
22
|
+
console.log(banner);
|
|
21
23
|
const program = new commander_1.Command();
|
|
22
|
-
program.name('kolibri').description('CLI for executing some helpful commands for KoliBri projects.').version(
|
|
24
|
+
program.name('kolibri').description('CLI for executing some helpful commands for KoliBri projects.').version(versionOfPublicUiKoliBriCli);
|
|
23
25
|
// Add commands
|
|
24
26
|
(0, migrate_1.default)(program);
|
|
25
27
|
program.parse();
|
package/dist/migrate/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const task_runner_1 = require("./runner/task-runner");
|
|
|
11
11
|
const test_1 = require("./runner/tasks/test");
|
|
12
12
|
const v1_1 = require("./runner/tasks/v1");
|
|
13
13
|
const reuse_1 = require("./shares/reuse");
|
|
14
|
+
const types_1 = require("./types");
|
|
14
15
|
/**
|
|
15
16
|
* This function is used to register the migrate command.
|
|
16
17
|
* @param {Command} program The program object to register the command
|
|
@@ -20,20 +21,21 @@ function default_1(program) {
|
|
|
20
21
|
.command('migrate')
|
|
21
22
|
.description('This command migrates KoliBri code to the current version.')
|
|
22
23
|
.argument('<string>', 'Source code folder to migrate')
|
|
23
|
-
.addOption(new commander_1.Option('--
|
|
24
|
-
.
|
|
24
|
+
.addOption(new commander_1.Option('--ignore-uncommitted-changes', 'Allows execution with uncommitted changes').default(false))
|
|
25
|
+
.addOption(new commander_1.Option('--remove-mode <mode>', 'Prefix property name or delete property').choices(types_1.REMOVE_MODE).default('prefix'))
|
|
26
|
+
.addOption(new commander_1.Option('--test-tasks', 'Run additional test tasks').default(false).hideHelp())
|
|
25
27
|
.action((baseDir, options) => {
|
|
26
28
|
(0, child_process_1.exec)('git status --porcelain', (err, stdout) => {
|
|
27
29
|
if (err) {
|
|
28
30
|
console.error(`exec error: ${err.message}`);
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
31
|
-
if (stdout) {
|
|
33
|
+
if (!options.ignoreUncommittedChanges && stdout) {
|
|
32
34
|
throw new Error('There are uncommitted changes');
|
|
33
35
|
}
|
|
34
36
|
(0, reuse_1.setRemoveMode)(options.removeMode);
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
+
const versionOfPublicUiComponents = (0, reuse_1.getVersionOfPublicUiComponents)();
|
|
38
|
+
const versionOfPublicUiKoliBriCli = (0, reuse_1.getVersionOfPublicUiKoliBriCli)();
|
|
37
39
|
console.log(`
|
|
38
40
|
Current version of @public-ui/components: ${versionOfPublicUiComponents}
|
|
39
41
|
Source folder to migrate: ${baseDir}
|
|
@@ -85,16 +87,11 @@ Modified files: ${reuse_1.MODIFIED_FILES.size}`);
|
|
|
85
87
|
console.log(`- ${file}`);
|
|
86
88
|
});
|
|
87
89
|
console.log(`
|
|
88
|
-
After the code migration has gone through, the code formatting may no longer
|
|
89
|
-
be as desired. Therefore, please reformat your code afterwards if necessary.
|
|
90
|
+
After the code migration has gone through, the code formatting may no longer be as desired. Therefore, please reformat your code afterwards if necessary.
|
|
90
91
|
|
|
91
|
-
Afterwards, it may be that functions or themes in newer major versions have
|
|
92
|
-
changed or are no longer included. This should be checked finally and corrected
|
|
93
|
-
manually if necessary.
|
|
92
|
+
Afterwards, it may be that functions or themes in newer major versions have changed or are no longer included. This should be checked finally and corrected manually if necessary.
|
|
94
93
|
|
|
95
|
-
Is anything wrong, you can reset the migration with "git reset --hard HEAD~1"
|
|
96
|
-
read the troubleshooting section in the readme.
|
|
97
|
-
`);
|
|
94
|
+
Is anything wrong, you can reset the migration with "git reset --hard HEAD~1" or by discarding the affected files. For more information read the troubleshooting section in the README.`);
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
97
|
const status = runner.getStatus();
|
|
@@ -13,7 +13,6 @@ class TaskRunner {
|
|
|
13
13
|
this.baseDir = '/';
|
|
14
14
|
this.cliVersion = '0.0.0';
|
|
15
15
|
this.projectVersion = '0.0.0';
|
|
16
|
-
this.openRun = true;
|
|
17
16
|
this.config = {
|
|
18
17
|
migrate: {
|
|
19
18
|
tasks: {},
|
|
@@ -42,7 +41,6 @@ class TaskRunner {
|
|
|
42
41
|
}
|
|
43
42
|
if (this.projectVersion !== version) {
|
|
44
43
|
this.projectVersion = version;
|
|
45
|
-
this.openRun = true;
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
setConfig(config) {
|
|
@@ -61,13 +59,9 @@ class TaskRunner {
|
|
|
61
59
|
}
|
|
62
60
|
else {
|
|
63
61
|
this.tasks.set(task.getIdentifier(), task);
|
|
64
|
-
this.openRun = true;
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
64
|
}
|
|
68
|
-
registerTask(task) {
|
|
69
|
-
this.registerTasks([task]);
|
|
70
|
-
}
|
|
71
65
|
runTask(task) {
|
|
72
66
|
var _a;
|
|
73
67
|
if (((_a = this.config.migrate) === null || _a === void 0 ? void 0 : _a.tasks[task.getIdentifier()]) === false) {
|
|
@@ -97,7 +91,6 @@ class TaskRunner {
|
|
|
97
91
|
this.tasks.forEach((task) => {
|
|
98
92
|
this.dependentTaskRun(task, task.getDependentTasks());
|
|
99
93
|
});
|
|
100
|
-
this.openRun = false;
|
|
101
94
|
}
|
|
102
95
|
getPendingMinVersion() {
|
|
103
96
|
let version = this.cliVersion;
|
|
@@ -112,9 +105,6 @@ class TaskRunner {
|
|
|
112
105
|
});
|
|
113
106
|
return version;
|
|
114
107
|
}
|
|
115
|
-
hasPendingTasks() {
|
|
116
|
-
return this.openRun || semver_1.default.lt(this.getPendingMinVersion(), this.cliVersion);
|
|
117
|
-
}
|
|
118
108
|
getStatus(outline = false) {
|
|
119
109
|
let done = 0;
|
|
120
110
|
let pending = 0;
|
|
@@ -18,7 +18,11 @@ const input_number_1 = require("./input-number");
|
|
|
18
18
|
const input_radio_1 = require("./input-radio");
|
|
19
19
|
const input_range_1 = require("./input-range");
|
|
20
20
|
const input_text_1 = require("./input-text");
|
|
21
|
+
const link_1 = require("./link");
|
|
22
|
+
const link_button_1 = require("./link-button");
|
|
21
23
|
const link_group_1 = require("./link-group");
|
|
24
|
+
const logo_1 = require("./logo");
|
|
25
|
+
const modal_1 = require("./modal");
|
|
22
26
|
const nav_1 = require("./nav");
|
|
23
27
|
const pagination_1 = require("./pagination");
|
|
24
28
|
const progress_1 = require("./progress");
|
|
@@ -43,6 +47,7 @@ exports.v1Tasks.push(button_link_1.ButtonLinkRemovePropertyAriaLabel);
|
|
|
43
47
|
exports.v1Tasks.push(button_link_1.ButtonLinkRenamePropertyIconOnlyToHideLabel);
|
|
44
48
|
exports.v1Tasks.push(button_1.ButtonRemovePropertyAriaCurrent);
|
|
45
49
|
exports.v1Tasks.push(button_1.ButtonRemovePropertyAriaLabel);
|
|
50
|
+
exports.v1Tasks.push(button_1.ButtonRemovePropertyIconAlign);
|
|
46
51
|
exports.v1Tasks.push(button_1.ButtonRenamePropertyIconOnlyToHideLabel);
|
|
47
52
|
exports.v1Tasks.push(card_1.CardRenamePropertyHeadingToLabel);
|
|
48
53
|
exports.v1Tasks.push(card_1.CardRenamePropertyHeadlineToLabel);
|
|
@@ -57,11 +62,33 @@ exports.v1Tasks.push(input_number_1.InputNumberRenamePropertyListToSuggestions);
|
|
|
57
62
|
exports.v1Tasks.push(input_radio_1.InputRadioRenamePropertyListToSuggestions);
|
|
58
63
|
exports.v1Tasks.push(input_range_1.InputRangeRenamePropertyListToSuggestions);
|
|
59
64
|
exports.v1Tasks.push(input_text_1.InputTextRenamePropertyListToSuggestions);
|
|
65
|
+
exports.v1Tasks.push(link_button_1.LinkButtonRemovePropertyAriaControl);
|
|
66
|
+
exports.v1Tasks.push(link_button_1.LinkButtonRenamePropertyAriaCurrentToListenAriaCurrent);
|
|
67
|
+
exports.v1Tasks.push(link_button_1.LinkButtonRemovePropertyAriaExpanded);
|
|
68
|
+
exports.v1Tasks.push(link_button_1.LinkButtonRemovePropertyAriaLabel);
|
|
69
|
+
exports.v1Tasks.push(link_button_1.LinkButtonRemovePropertyAriaSelected);
|
|
70
|
+
exports.v1Tasks.push(link_button_1.LinkButtonRemovePropertyDisabled);
|
|
71
|
+
exports.v1Tasks.push(link_button_1.LinkButtonRenamePropertyIconOnlyToHideLabel);
|
|
72
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyAriaControl);
|
|
73
|
+
exports.v1Tasks.push(link_1.LinkRenamePropertyAriaCurrentToListenAriaCurrent);
|
|
74
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyAriaExpanded);
|
|
75
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyAriaLabel);
|
|
76
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyAriaSelected);
|
|
77
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyDisabled);
|
|
78
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyIconAlign);
|
|
79
|
+
exports.v1Tasks.push(link_1.LinkRenamePropertyIconOnlyToHideLabel);
|
|
80
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertySelector);
|
|
81
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyStealth);
|
|
82
|
+
exports.v1Tasks.push(link_1.LinkRemovePropertyUseCase);
|
|
83
|
+
exports.v1Tasks.push(logo_1.LogoRenamePropertyAbbrToOrg);
|
|
84
|
+
exports.v1Tasks.push(modal_1.ModalRenamePropertyAriaLabelToLabel);
|
|
60
85
|
exports.v1Tasks.push(link_group_1.LinkGroupRenamePropertyAriaLabelToLabel);
|
|
86
|
+
exports.v1Tasks.push(link_group_1.LinkGroupRemovePropertyHeading);
|
|
61
87
|
exports.v1Tasks.push(link_group_1.LinkGroupRemovePropertyOrdered);
|
|
62
88
|
exports.v1Tasks.push(nav_1.NavRenamePropertyAriaLabelToLabel);
|
|
63
89
|
exports.v1Tasks.push(nav_1.NavRenamePropertyCompactToHideLabel);
|
|
64
90
|
exports.v1Tasks.push(nav_1.NavRemovePropertyHasCompactButton);
|
|
91
|
+
exports.v1Tasks.push(nav_1.NavRemovePropertyVariant);
|
|
65
92
|
exports.v1Tasks.push(nav_1.NavRenamePropertyCompactToHideLabel);
|
|
66
93
|
exports.v1Tasks.push(pagination_1.PaginationRenamePropertyCountToTotal);
|
|
67
94
|
exports.v1Tasks.push(progress_1.ProgressRenamePropertyTypeToVariant);
|
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InputNumberRenamePropertyListToSuggestions = void 0;
|
|
4
4
|
const RenamePropertyNameTask_1 = require("../common/RenamePropertyNameTask");
|
|
5
5
|
exports.InputNumberRenamePropertyListToSuggestions = RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance('kol-input-number', '_list', '_suggestions', '^1');
|
|
6
|
-
// export const InputNumberRemovePropertyType = RemovePropertyNameTask.getInstance('kol-input-number', '_type', '^1');
|
|
6
|
+
// @todo export const InputNumberRemovePropertyType = RemovePropertyNameTask.getInstance('kol-input-number', '_type', '^1');
|
|
@@ -3,7 +3,7 @@ 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.getRemoveMode = exports.setRemoveMode = exports.MODIFIED_FILES = exports.kebabToCapitalCase = exports.isPropertyKebabCaseRegExp = exports.isTagKebabCaseRegExp = exports.getPackageManagerInstallCommand = exports.readPackageJson = exports.readPackageString = exports.
|
|
6
|
+
exports.getVersionOfPublicUiKoliBriCli = exports.getVersionOfPublicUiComponents = exports.getRemoveMode = exports.setRemoveMode = exports.MODIFIED_FILES = exports.kebabToCapitalCase = exports.isPropertyKebabCaseRegExp = exports.isTagKebabCaseRegExp = exports.getPackageManagerInstallCommand = exports.readPackageJson = exports.readPackageString = exports.filterFilesByExt = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
/**
|
|
@@ -28,24 +28,6 @@ function filterFilesByExt(dir, ext) {
|
|
|
28
28
|
return files;
|
|
29
29
|
}
|
|
30
30
|
exports.filterFilesByExt = filterFilesByExt;
|
|
31
|
-
/**
|
|
32
|
-
* This function is used to get the versions of @public-ui in the package.json.
|
|
33
|
-
* @param {Record<string, unknown>} packageJson The package.json as object
|
|
34
|
-
* @returns {Map<string, string>} The versions of @public-ui packages
|
|
35
|
-
*/
|
|
36
|
-
function getPublicUiVersions(packageJson) {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
const publicUiVersions = new Map();
|
|
39
|
-
const dependencies = (_a = packageJson.dependencies) !== null && _a !== void 0 ? _a : {};
|
|
40
|
-
const devDependencies = (_b = packageJson.devDependencies) !== null && _b !== void 0 ? _b : {};
|
|
41
|
-
for (const [name, version] of Object.entries(Object.assign(Object.assign({}, dependencies), devDependencies))) {
|
|
42
|
-
if (name.startsWith('@public-ui/')) {
|
|
43
|
-
publicUiVersions.set(name, version);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return publicUiVersions;
|
|
47
|
-
}
|
|
48
|
-
exports.getPublicUiVersions = getPublicUiVersions;
|
|
49
31
|
/**
|
|
50
32
|
* This function is used to get the version of the package.json as string.
|
|
51
33
|
* @param {string} offsetPath The offset path to the package.json
|
|
@@ -110,7 +92,7 @@ function kebabToCapitalCase(tag) {
|
|
|
110
92
|
}
|
|
111
93
|
exports.kebabToCapitalCase = kebabToCapitalCase;
|
|
112
94
|
exports.MODIFIED_FILES = new Set();
|
|
113
|
-
let REMOVE_MODE = '
|
|
95
|
+
let REMOVE_MODE = 'prefix';
|
|
114
96
|
/**
|
|
115
97
|
* Sets the remove mode.
|
|
116
98
|
* @param {RemoveMode} mode The remove mode
|
|
@@ -127,3 +109,7 @@ function getRemoveMode() {
|
|
|
127
109
|
return REMOVE_MODE;
|
|
128
110
|
}
|
|
129
111
|
exports.getRemoveMode = getRemoveMode;
|
|
112
|
+
const getVersionOfPublicUiComponents = () => readPackageJson(path_1.default.resolve(process.cwd(), 'node_modules/@public-ui/components')).version;
|
|
113
|
+
exports.getVersionOfPublicUiComponents = getVersionOfPublicUiComponents;
|
|
114
|
+
const getVersionOfPublicUiKoliBriCli = () => readPackageJson(path_1.default.resolve(__dirname, '..', '..', '..')).version;
|
|
115
|
+
exports.getVersionOfPublicUiKoliBriCli = getVersionOfPublicUiKoliBriCli;
|
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.2",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": "https://github.com/public-ui/kolibri",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"description": "CLI for executing some helpful commands for KoliBri projects.",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"reset": "pnpm i @public-ui/components@1.1.7",
|
|
21
|
-
"depcheck": "depcheck --ignore-bin-package --skip-missing",
|
|
21
|
+
"depcheck": "depcheck --ignores=\"chalk,loglevel,@public-ui/components\" --ignore-bin-package --skip-missing",
|
|
22
22
|
"format": "prettier -c src",
|
|
23
23
|
"lint": "eslint src && tsc --noEmit",
|
|
24
24
|
"prepack": "tsc",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"semver": "7.5.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@public-ui/components": "1.7
|
|
40
|
+
"@public-ui/components": "1.1.7",
|
|
41
41
|
"@types/gradient-string": "1.1.2",
|
|
42
42
|
"@types/node": "20.5.9",
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "6.5.0",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./test"), exports);
|
|
18
|
-
__exportStar(require("./v1"), exports);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testTasks = void 0;
|
|
4
|
-
const test_version_1_3_1 = require("./v1/test-version-1.3");
|
|
5
|
-
const test_version_next_2_1 = require("./v1/test-version-next-2");
|
|
6
|
-
const test_version_next_3_1 = require("./v1/test-version-next-3");
|
|
7
|
-
const test_version_zero_1 = require("./v1/test-version-zero");
|
|
8
|
-
exports.testTasks = [];
|
|
9
|
-
exports.testTasks.push(test_version_zero_1.TestVersionZero.getInstance());
|
|
10
|
-
exports.testTasks.push(test_version_next_2_1.TestVersionNext2.getInstance());
|
|
11
|
-
exports.testTasks.push(test_version_next_3_1.TestVersionNext3.getInstance());
|
|
12
|
-
exports.testTasks.push(test_version_1_3_1.TestVersion13.getInstance());
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AbbrPropertyRenamingTitleToLabel = void 0;
|
|
4
|
-
const reuse_1 = require("../../../shares/reuse");
|
|
5
|
-
const types_1 = require("../../../../types");
|
|
6
|
-
const abstract_task_1 = require("../../abstract-task");
|
|
7
|
-
class AbbrPropertyRenamingTitleToLabel extends abstract_task_1.AbstractTask {
|
|
8
|
-
constructor() {
|
|
9
|
-
super('abbr-property-renaming-title-to-label', 'Renaming property `_title` to `_label`', types_1.COMPONENT_FILE_EXTENSIONS.concat(types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS), '>=1 <2');
|
|
10
|
-
}
|
|
11
|
-
static getInstance() {
|
|
12
|
-
if (!(this.instance instanceof AbbrPropertyRenamingTitleToLabel)) {
|
|
13
|
-
this.instance = new AbbrPropertyRenamingTitleToLabel();
|
|
14
|
-
}
|
|
15
|
-
return this.instance;
|
|
16
|
-
}
|
|
17
|
-
run(baseDir) {
|
|
18
|
-
this.transpileComponentFile(baseDir);
|
|
19
|
-
this.transpileCustomElementFile(baseDir);
|
|
20
|
-
}
|
|
21
|
-
transpileComponentFile(baseDir) {
|
|
22
|
-
const files = (0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS);
|
|
23
|
-
this.runDummy(files);
|
|
24
|
-
}
|
|
25
|
-
transpileCustomElementFile(baseDir) {
|
|
26
|
-
const files = (0, reuse_1.filterFilesByExt)(baseDir, types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS);
|
|
27
|
-
this.runDummy(files);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.AbbrPropertyRenamingTitleToLabel = AbbrPropertyRenamingTitleToLabel;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AccordionPropertyRenamingHeadingToLabel = void 0;
|
|
4
|
-
const abstract_task_1 = require("../../abstract-task");
|
|
5
|
-
const types_1 = require("../../../../types");
|
|
6
|
-
const reuse_1 = require("../../../shares/reuse");
|
|
7
|
-
class AccordionPropertyRenamingHeadingToLabel extends abstract_task_1.AbstractTask {
|
|
8
|
-
constructor() {
|
|
9
|
-
super('accordion-property-renaming-heading-to-label copy', 'Renaming property `_heading` to `_label`', types_1.COMPONENT_FILE_EXTENSIONS.concat(types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS), '>=1 <2');
|
|
10
|
-
}
|
|
11
|
-
static getInstance() {
|
|
12
|
-
if (!(this.instance instanceof AccordionPropertyRenamingHeadingToLabel)) {
|
|
13
|
-
this.instance = new AccordionPropertyRenamingHeadingToLabel();
|
|
14
|
-
}
|
|
15
|
-
return this.instance;
|
|
16
|
-
}
|
|
17
|
-
run(baseDir) {
|
|
18
|
-
this.transpileComponentFile(baseDir);
|
|
19
|
-
this.transpileCustomElementFile(baseDir);
|
|
20
|
-
}
|
|
21
|
-
transpileComponentFile(baseDir) {
|
|
22
|
-
const files = (0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS);
|
|
23
|
-
this.runDummy(files);
|
|
24
|
-
}
|
|
25
|
-
transpileCustomElementFile(baseDir) {
|
|
26
|
-
const files = (0, reuse_1.filterFilesByExt)(baseDir, types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS);
|
|
27
|
-
this.runDummy(files);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.AccordionPropertyRenamingHeadingToLabel = AccordionPropertyRenamingHeadingToLabel;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestVersion13 = void 0;
|
|
4
|
-
const abstract_task_1 = require("../../abstract-task");
|
|
5
|
-
class TestVersion13 extends abstract_task_1.AbstractTask {
|
|
6
|
-
constructor() {
|
|
7
|
-
super('test-version-1.3', 'Test version 1.3', [], '1.3');
|
|
8
|
-
}
|
|
9
|
-
static getInstance() {
|
|
10
|
-
if (!(this.instance instanceof TestVersion13)) {
|
|
11
|
-
this.instance = new TestVersion13();
|
|
12
|
-
}
|
|
13
|
-
return this.instance;
|
|
14
|
-
}
|
|
15
|
-
run() { }
|
|
16
|
-
}
|
|
17
|
-
exports.TestVersion13 = TestVersion13;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestVersionCurrent = void 0;
|
|
4
|
-
const abstract_task_1 = require("../../abstract-task");
|
|
5
|
-
class TestVersionCurrent extends abstract_task_1.AbstractTask {
|
|
6
|
-
constructor(version) {
|
|
7
|
-
super('test-version-current', 'Test version current', [], version);
|
|
8
|
-
}
|
|
9
|
-
static getInstance(version) {
|
|
10
|
-
if (!(this.instance instanceof TestVersionCurrent)) {
|
|
11
|
-
this.instance = new TestVersionCurrent(version);
|
|
12
|
-
}
|
|
13
|
-
return this.instance;
|
|
14
|
-
}
|
|
15
|
-
run() { }
|
|
16
|
-
}
|
|
17
|
-
exports.TestVersionCurrent = TestVersionCurrent;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestVersionNext2 = void 0;
|
|
4
|
-
const abstract_task_1 = require("../../abstract-task");
|
|
5
|
-
class TestVersionNext2 extends abstract_task_1.AbstractTask {
|
|
6
|
-
constructor() {
|
|
7
|
-
super('test-version-next-2', 'Test version next v2', [], '^2');
|
|
8
|
-
}
|
|
9
|
-
static getInstance() {
|
|
10
|
-
if (!(this.instance instanceof TestVersionNext2)) {
|
|
11
|
-
this.instance = new TestVersionNext2();
|
|
12
|
-
}
|
|
13
|
-
return this.instance;
|
|
14
|
-
}
|
|
15
|
-
run() { }
|
|
16
|
-
}
|
|
17
|
-
exports.TestVersionNext2 = TestVersionNext2;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestVersionNext3 = void 0;
|
|
4
|
-
const abstract_task_1 = require("../../abstract-task");
|
|
5
|
-
class TestVersionNext3 extends abstract_task_1.AbstractTask {
|
|
6
|
-
constructor() {
|
|
7
|
-
super('test-version-next-3', 'Test version next v3', [], '^3');
|
|
8
|
-
}
|
|
9
|
-
static getInstance() {
|
|
10
|
-
if (!(this.instance instanceof TestVersionNext3)) {
|
|
11
|
-
this.instance = new TestVersionNext3();
|
|
12
|
-
}
|
|
13
|
-
return this.instance;
|
|
14
|
-
}
|
|
15
|
-
run() { }
|
|
16
|
-
}
|
|
17
|
-
exports.TestVersionNext3 = TestVersionNext3;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestVersionZero = void 0;
|
|
4
|
-
const abstract_task_1 = require("../../abstract-task");
|
|
5
|
-
class TestVersionZero extends abstract_task_1.AbstractTask {
|
|
6
|
-
constructor() {
|
|
7
|
-
super('test-version-zero', 'Test version zero', [], '<1');
|
|
8
|
-
}
|
|
9
|
-
static getInstance() {
|
|
10
|
-
if (!(this.instance instanceof TestVersionZero)) {
|
|
11
|
-
this.instance = new TestVersionZero();
|
|
12
|
-
}
|
|
13
|
-
return this.instance;
|
|
14
|
-
}
|
|
15
|
-
run() { }
|
|
16
|
-
}
|
|
17
|
-
exports.TestVersionZero = TestVersionZero;
|
|
@@ -1,48 +0,0 @@
|
|
|
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.AbstractTask = void 0;
|
|
7
|
-
const types_1 = require("../types");
|
|
8
|
-
const semver_1 = __importDefault(require("semver"));
|
|
9
|
-
const reuse_1 = require("../shares/reuse");
|
|
10
|
-
class AbstractTask {
|
|
11
|
-
constructor(identifier, title, extensions, version, options = {}) {
|
|
12
|
-
this.identifier = identifier;
|
|
13
|
-
this.title = title;
|
|
14
|
-
this.extensions = extensions;
|
|
15
|
-
this.version = version;
|
|
16
|
-
this.status = 'pending';
|
|
17
|
-
this.description = options.description;
|
|
18
|
-
this.extensions = this.extensions.filter((ext) => types_1.FILE_EXTENSIONS.includes(ext));
|
|
19
|
-
if (this.version && !semver_1.default.valid(this.version)) {
|
|
20
|
-
throw new Error(`[${this.identifier}] Invalid semver version: ${this.version}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
getDescription() {
|
|
24
|
-
return this.description;
|
|
25
|
-
}
|
|
26
|
-
getFiles(baseDir) {
|
|
27
|
-
return (0, reuse_1.filterFilesByExt)(baseDir, this.extensions);
|
|
28
|
-
}
|
|
29
|
-
getIdentifier() {
|
|
30
|
-
return this.identifier;
|
|
31
|
-
}
|
|
32
|
-
getStatus() {
|
|
33
|
-
return this.status;
|
|
34
|
-
}
|
|
35
|
-
getTitle() {
|
|
36
|
-
return this.title;
|
|
37
|
-
}
|
|
38
|
-
getVersion() {
|
|
39
|
-
return this.version;
|
|
40
|
-
}
|
|
41
|
-
setStatus(status) {
|
|
42
|
-
this.status = status;
|
|
43
|
-
}
|
|
44
|
-
static getInstance() {
|
|
45
|
-
throw new Error('not implemented');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.AbstractTask = AbstractTask;
|
|
@@ -1,28 +0,0 @@
|
|
|
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.TaskRunner = void 0;
|
|
7
|
-
const semver_1 = __importDefault(require("semver"));
|
|
8
|
-
class TaskRunner {
|
|
9
|
-
constructor(baseDir, version) {
|
|
10
|
-
this.baseDir = baseDir;
|
|
11
|
-
this.version = version;
|
|
12
|
-
this.tasks = [];
|
|
13
|
-
if (semver_1.default.valid(version) === null) {
|
|
14
|
-
throw new Error(`Invalid semver version: ${version}`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
registerTask(task) {
|
|
18
|
-
this.tasks.concat(Array.isArray(task) ? task : [task]);
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
run() {
|
|
22
|
-
this.tasks.forEach((task) => {
|
|
23
|
-
console.log(task.getFiles(this.baseDir));
|
|
24
|
-
// task.run();
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.TaskRunner = TaskRunner;
|
|
@@ -1,27 +0,0 @@
|
|
|
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.AbbrPropertyRenamingTitleToLabel = void 0;
|
|
7
|
-
const abstract_task_1 = require("../abstract-task");
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
class AbbrPropertyRenamingTitleToLabel extends abstract_task_1.AbstractTask {
|
|
10
|
-
constructor() {
|
|
11
|
-
super('abbr-property-renaming-title-to-label', 'Renaming property `_title` to `_label`', ['html', 'jsx', 'tsx', 'vue'], '^1');
|
|
12
|
-
}
|
|
13
|
-
static getInstance() {
|
|
14
|
-
if (!(this.instance instanceof AbbrPropertyRenamingTitleToLabel)) {
|
|
15
|
-
this.instance = new AbbrPropertyRenamingTitleToLabel();
|
|
16
|
-
}
|
|
17
|
-
return this.instance;
|
|
18
|
-
}
|
|
19
|
-
run(files) {
|
|
20
|
-
for (const file of files) {
|
|
21
|
-
let content = fs_1.default.readFileSync(file, 'utf8');
|
|
22
|
-
content = content.replace(/_title="([^"]+)"/g, '_label="$1"');
|
|
23
|
-
fs_1.default.writeFileSync(file, content);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.AbbrPropertyRenamingTitleToLabel = AbbrPropertyRenamingTitleToLabel;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tasks = void 0;
|
|
4
|
-
const abbr_property_renaming_title_to_label_1 = require("./abbr-property-renaming-title-to-label");
|
|
5
|
-
exports.tasks = [];
|
|
6
|
-
exports.tasks.push(abbr_property_renaming_title_to_label_1.AbbrPropertyRenamingTitleToLabel.getInstance());
|
package/dist/runner/types.js
DELETED
package/dist/shares/reuse.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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.getPublicUiVersions = exports.filterFilesByExt = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
/**
|
|
10
|
-
* Recursively searches for files with the specified extension in the specified.
|
|
11
|
-
* @param {string} dir The directory to search in
|
|
12
|
-
* @param {FileExtension | FileExtension[]} ext The extension to search for
|
|
13
|
-
* @returns {string[]} The found files
|
|
14
|
-
*/
|
|
15
|
-
function filterFilesByExt(dir, ext) {
|
|
16
|
-
ext = Array.isArray(ext) ? ext : [ext];
|
|
17
|
-
let files = [];
|
|
18
|
-
const dirPath = path_1.default.resolve(process.cwd(), dir);
|
|
19
|
-
fs_1.default.readdirSync(dirPath).forEach((file) => {
|
|
20
|
-
const fullPath = path_1.default.resolve(dir, file);
|
|
21
|
-
if (fs_1.default.lstatSync(fullPath).isDirectory()) {
|
|
22
|
-
files = files.concat(filterFilesByExt(fullPath, ext));
|
|
23
|
-
}
|
|
24
|
-
else if (ext.includes(path_1.default.extname(fullPath).replace('.', ''))) {
|
|
25
|
-
files.push(fullPath);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return files;
|
|
29
|
-
}
|
|
30
|
-
exports.filterFilesByExt = filterFilesByExt;
|
|
31
|
-
/**
|
|
32
|
-
* This function is used to get the versions of @public-ui in the package.json.
|
|
33
|
-
* @param {Record<string, unknown>} packageJson The package.json as object
|
|
34
|
-
* @returns {Map<string, string>} The versions of @public-ui packages
|
|
35
|
-
*/
|
|
36
|
-
function getPublicUiVersions(packageJson) {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
const publicUiVersions = new Map();
|
|
39
|
-
const dependencies = (_a = packageJson.dependencies) !== null && _a !== void 0 ? _a : {};
|
|
40
|
-
const devDependencies = (_b = packageJson.devDependencies) !== null && _b !== void 0 ? _b : {};
|
|
41
|
-
for (const [name, version] of Object.entries(Object.assign(Object.assign({}, dependencies), devDependencies))) {
|
|
42
|
-
if (name.startsWith('@public-ui/')) {
|
|
43
|
-
publicUiVersions.set(name, version);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return publicUiVersions;
|
|
47
|
-
}
|
|
48
|
-
exports.getPublicUiVersions = getPublicUiVersions;
|