@public-ui/kolibri-cli 1.7.0-rc.14 → 1.7.0-rc.15
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 -1
- package/dist/index.js +0 -0
- package/dist/migrate/index.js +47 -21
- package/package.json +64 -65
package/README.md
CHANGED
|
@@ -92,7 +92,8 @@ kolibri migrate <path>
|
|
|
92
92
|
| Option | Description | Type | Default |
|
|
93
93
|
| ------------------------------ | ---------------------------------------------- | :------------------: | :------: |
|
|
94
94
|
| `--format` | Try to format the modified files with prettier | boolean | true |
|
|
95
|
-
| `--ignore-
|
|
95
|
+
| `--ignore-greater-version` | Allows execution with greater versions | boolean | false |
|
|
96
|
+
| `--ignore-uncommitted-changes` | Allows execution with uncommitted changes | boolean | false |
|
|
96
97
|
| `--remove-mode` | Prefix property name or delete property | `delete` \| `prefix` | `prefix` |
|
|
97
98
|
|
|
98
99
|
#### Configuration
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/migrate/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const child_process_1 = require("child_process");
|
|
|
8
8
|
const commander_1 = require("commander");
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const semver_1 = __importDefault(require("semver"));
|
|
11
12
|
const task_runner_1 = require("./runner/task-runner");
|
|
12
13
|
const test_1 = require("./runner/tasks/test");
|
|
13
14
|
const v1_1 = require("./runner/tasks/v1");
|
|
@@ -24,6 +25,7 @@ function default_1(program) {
|
|
|
24
25
|
.description('This command migrates KoliBri code to the current version.')
|
|
25
26
|
.argument('[string]', 'Source code folder to migrate', 'src')
|
|
26
27
|
.addOption(new commander_1.Option('--format', 'Try to format the modified files with prettier').default(true))
|
|
28
|
+
.addOption(new commander_1.Option('--ignore-greater-version', 'Allows execution with greater versions').default(false))
|
|
27
29
|
.addOption(new commander_1.Option('--ignore-uncommitted-changes', 'Allows execution with uncommitted changes').default(false))
|
|
28
30
|
.addOption(new commander_1.Option('--remove-mode <mode>', 'Prefix property name or delete property').choices(types_1.REMOVE_MODE).default('prefix'))
|
|
29
31
|
.addOption(new commander_1.Option('--test-tasks', 'Run additional test tasks').default(false).hideHelp())
|
|
@@ -43,6 +45,9 @@ function default_1(program) {
|
|
|
43
45
|
Current version of @public-ui/components: ${versionOfPublicUiComponents}
|
|
44
46
|
Source folder to migrate: ${baseDir}
|
|
45
47
|
`);
|
|
48
|
+
if (!options.ignoreGreaterVersion && semver_1.default.lt(versionOfPublicUiKoliBriCli, versionOfPublicUiComponents)) {
|
|
49
|
+
throw (0, reuse_1.logAndCreateError)('Your current version of @public-ui/components is greater than the version of @public-ui/kolibri-cli. Please update @public-ui/kolibri-cli or force the migration with --ignore-greater-version.');
|
|
50
|
+
}
|
|
46
51
|
const configFile = path_1.default.resolve(process.cwd(), '.kolibri.config.json');
|
|
47
52
|
let config = {};
|
|
48
53
|
if (fs_1.default.existsSync(configFile)) {
|
|
@@ -80,31 +85,53 @@ Source folder to migrate: ${baseDir}
|
|
|
80
85
|
runLoop();
|
|
81
86
|
});
|
|
82
87
|
}
|
|
88
|
+
else if (semver_1.default.lt(version, versionOfPublicUiComponents)) {
|
|
89
|
+
version = versionOfPublicUiComponents;
|
|
90
|
+
let packageJson = (0, reuse_1.getContentOfProjectPkgJson)();
|
|
91
|
+
packageJson = packageJson.replace(/"(@public-ui\/[^"]+)":\s*".*"/g, `"$1": "${version}"`);
|
|
92
|
+
fs_1.default.writeFileSync(path_1.default.resolve(process.cwd(), 'package.json'), packageJson);
|
|
93
|
+
runner.setProjectVersion(version);
|
|
94
|
+
console.log(`- Update @public-ui/* to version ${version}`);
|
|
95
|
+
(0, child_process_1.exec)((0, reuse_1.getPackageManagerInstallCommand)(), (err) => {
|
|
96
|
+
if (err) {
|
|
97
|
+
console.error(`exec error: ${err.message}`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
finish();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
83
103
|
else {
|
|
84
|
-
|
|
104
|
+
finish();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Prints the status of the task runner and the modified files.
|
|
109
|
+
*/
|
|
110
|
+
function finish() {
|
|
111
|
+
console.log(`
|
|
85
112
|
Status of all executed Tasks:`);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
113
|
+
const status = runner.getStatus(true);
|
|
114
|
+
fs_1.default.writeFileSync(configFile, JSON.stringify(status.config, null, 2));
|
|
115
|
+
console.log(`
|
|
89
116
|
Modified files: ${reuse_1.MODIFIED_FILES.size}`);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
117
|
+
reuse_1.MODIFIED_FILES.forEach((file) => {
|
|
118
|
+
console.log(`- ${file}`);
|
|
119
|
+
});
|
|
120
|
+
if (options.format) {
|
|
121
|
+
console.log(`
|
|
95
122
|
We try to format the modified files with prettier...`);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
console.log(`Modified files could not be formatted. Please format them manually: npx prettier ${baseDir} -w`);
|
|
104
|
-
}
|
|
105
|
-
console.log();
|
|
123
|
+
try {
|
|
124
|
+
node_child_process_1.default.execFileSync('npx', ['prettier', '-w', ...Array.from(reuse_1.MODIFIED_FILES)], {
|
|
125
|
+
encoding: 'utf-8',
|
|
126
|
+
});
|
|
127
|
+
console.log(`Modified files have been formatted.`);
|
|
106
128
|
}
|
|
107
|
-
|
|
129
|
+
catch (e) {
|
|
130
|
+
console.log(`Modified files could not be formatted. Please format them manually: npx prettier ${baseDir} -w`);
|
|
131
|
+
}
|
|
132
|
+
console.log();
|
|
133
|
+
}
|
|
134
|
+
console.log(`
|
|
108
135
|
After migrating the code, the formatting of the code may no longer be as desired. Therefore, reformat your code afterwards if necessary: npx prettier ${baseDir} -w
|
|
109
136
|
|
|
110
137
|
When migrating the labels, the text (innerText) is assigned 1 to 1 to the _label property. There could be the following situation, where manual corrections have to be made: _label={\`I am {count} years old.\`} -> _label={\`I am \${count} years old.\`} (add a $)
|
|
@@ -112,7 +139,6 @@ When migrating the labels, the text (innerText) is assigned 1 to 1 to the _label
|
|
|
112
139
|
Afterwards, it may be that functions or themes have changed or are no longer included in newer major versions. This should be checked finally and corrected manually if necessary.
|
|
113
140
|
|
|
114
141
|
If something is wrong, the migration can be stopped with "git reset --hard HEAD~1" or by discarding the affected files. For more information, read the troubleshooting section in the README.`);
|
|
115
|
-
}
|
|
116
142
|
}
|
|
117
143
|
const status = runner.getStatus();
|
|
118
144
|
console.log(`
|
package/package.json
CHANGED
|
@@ -1,66 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
2
|
+
"name": "@public-ui/kolibri-cli",
|
|
3
|
+
"version": "1.7.0-rc.15",
|
|
4
|
+
"license": "EUPL-1.2",
|
|
5
|
+
"homepage": "https://public-ui.github.io",
|
|
6
|
+
"repository": "https://github.com/public-ui/kolibri",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/public-ui/kolibri/issues",
|
|
9
|
+
"email": "kolibri@itzbund.de"
|
|
10
|
+
},
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Informationstechnikzentrum Bund",
|
|
13
|
+
"email": "kolibri@itzbund.de"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"kolibri": "dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"description": "CLI for executing some helpful commands for KoliBri projects.",
|
|
19
|
+
"type": "commonjs",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"chalk": "4.1.2",
|
|
22
|
+
"commander": "11.0.0",
|
|
23
|
+
"deepmerge": "4.3.1",
|
|
24
|
+
"gradient-string": "2.0.2",
|
|
25
|
+
"loglevel": "1.8.1",
|
|
26
|
+
"prettier": "3.0.3",
|
|
27
|
+
"semver": "7.5.4"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@public-ui/components": "1.7.0-rc.15",
|
|
31
|
+
"@types/gradient-string": "1.1.3",
|
|
32
|
+
"@types/node": "20.6.5",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "6.7.2",
|
|
34
|
+
"@typescript-eslint/parser": "6.7.2",
|
|
35
|
+
"cpy-cli": "5.0.0",
|
|
36
|
+
"depcheck": "1.4.6",
|
|
37
|
+
"eslint": "8.50.0",
|
|
38
|
+
"eslint-config-prettier": "9.0.0",
|
|
39
|
+
"eslint-plugin-html": "7.1.0",
|
|
40
|
+
"eslint-plugin-jsdoc": "46.8.2",
|
|
41
|
+
"eslint-plugin-json": "3.1.0",
|
|
42
|
+
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
43
|
+
"eslint-plugin-no-loops": "0.3.0",
|
|
44
|
+
"eslint-plugin-react": "7.33.2",
|
|
45
|
+
"knip": "2.27.1",
|
|
46
|
+
"mocha": "10.2.0",
|
|
47
|
+
"nodemon": "3.0.1",
|
|
48
|
+
"rimraf": "3.0.2",
|
|
49
|
+
"ts-node": "10.9.1",
|
|
50
|
+
"typescript": "5.2.2"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist"
|
|
54
|
+
],
|
|
55
|
+
"scripts": {
|
|
56
|
+
"reset": "pnpm i @public-ui/components@1.1.7",
|
|
57
|
+
"depcheck": "depcheck --ignores=\"@public-ui/components,deepmerge,loglevel,mocha\"",
|
|
58
|
+
"format": "prettier -c src",
|
|
59
|
+
"lint": "eslint src && tsc --noEmit",
|
|
60
|
+
"start": "rimraf test && cpy \"../../samples/react/src/components\" test && ts-node src/index.ts migrate --ignore-uncommitted-changes --test-tasks test",
|
|
61
|
+
"restart": "pnpm reset && pnpm start",
|
|
62
|
+
"unused": "knip",
|
|
63
|
+
"watch": "nodemon --ignore package.json src/index.ts migrate --ignore-uncommitted-changes --test-tasks test"
|
|
64
|
+
}
|
|
65
|
+
}
|