@public-ui/kolibri-cli 1.7.0-rc.16 → 1.7.0-rc.17

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.
@@ -3,18 +3,20 @@ 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
- const node_child_process_1 = __importDefault(require("node:child_process"));
6
+ const chalk_1 = __importDefault(require("chalk"));
7
7
  const child_process_1 = require("child_process");
8
8
  const commander_1 = require("commander");
9
9
  const fs_1 = __importDefault(require("fs"));
10
+ const node_child_process_1 = __importDefault(require("node:child_process"));
10
11
  const path_1 = __importDefault(require("path"));
11
12
  const semver_1 = __importDefault(require("semver"));
12
13
  const task_runner_1 = require("./runner/task-runner");
14
+ const tasks_1 = require("./runner/tasks");
13
15
  const test_1 = require("./runner/tasks/test");
14
16
  const v1_1 = require("./runner/tasks/v1");
17
+ const assets_1 = require("./runner/tasks/v1/assets");
15
18
  const reuse_1 = require("./shares/reuse");
16
19
  const types_1 = require("./types");
17
- const tasks_1 = require("./runner/tasks");
18
20
  /**
19
21
  * This function is used to register the migrate command.
20
22
  * @param {Command} program The program object to register the command
@@ -61,6 +63,7 @@ Source folder to migrate: ${baseDir}
61
63
  const runner = new task_runner_1.TaskRunner(baseDir, versionOfPublicUiKoliBriCli, versionOfPublicUiComponents, config);
62
64
  runner.registerTasks(tasks_1.commonTasks);
63
65
  runner.registerTasks(v1_1.v1Tasks);
66
+ runner.registerTasks((0, assets_1.getAssetTasks)(baseDir));
64
67
  if (options.testTasks) {
65
68
  runner.registerTasks(test_1.testTasks);
66
69
  }
@@ -77,7 +80,7 @@ Source folder to migrate: ${baseDir}
77
80
  fs_1.default.writeFileSync(path_1.default.resolve(process.cwd(), 'package.json'), packageJson);
78
81
  runner.setProjectVersion(version);
79
82
  console.log(`- Update @public-ui/* to version ${version}`);
80
- (0, child_process_1.exec)((0, reuse_1.getPackageManagerInstallCommand)(), (err) => {
83
+ (0, child_process_1.exec)((0, reuse_1.getPackageManagerCommand)('install'), (err) => {
81
84
  if (err) {
82
85
  console.error(`exec error: ${err.message}`);
83
86
  return;
@@ -92,7 +95,7 @@ Source folder to migrate: ${baseDir}
92
95
  fs_1.default.writeFileSync(path_1.default.resolve(process.cwd(), 'package.json'), packageJson);
93
96
  runner.setProjectVersion(version);
94
97
  console.log(`- Update @public-ui/* to version ${version}`);
95
- (0, child_process_1.exec)((0, reuse_1.getPackageManagerInstallCommand)(), (err) => {
98
+ (0, child_process_1.exec)((0, reuse_1.getPackageManagerCommand)('install'), (err) => {
96
99
  if (err) {
97
100
  console.error(`exec error: ${err.message}`);
98
101
  return;
@@ -117,7 +120,7 @@ Modified files: ${reuse_1.MODIFIED_FILES.size}`);
117
120
  reuse_1.MODIFIED_FILES.forEach((file) => {
118
121
  console.log(`- ${file}`);
119
122
  });
120
- if (options.format) {
123
+ if (reuse_1.MODIFIED_FILES.size > 0 && options.format) {
121
124
  console.log(`
122
125
  We try to format the modified files with prettier...`);
123
126
  try {
@@ -131,14 +134,18 @@ We try to format the modified files with prettier...`);
131
134
  }
132
135
  console.log();
133
136
  }
134
- console.log(`
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
137
+ console.log(chalk_1.default.cyan(`
138
+ ${chalk_1.default.bold.bgCyan(`The migration is complete.`)} Please check the modified files and commit them if necessary.`));
139
+ console.log(chalk_1.default.magenta(`
140
+ Despite the best possible preparation of migration steps, we will certainly not be able to fully migrate every individual source code in the project. After running the migration tool, please see where you may still need to help yourself and feel free to provide feedback on what we can improve.
141
+
142
+ After all the changes are made, the modified files are formatted using Prettier.
136
143
 
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 $)
144
+ 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: ${chalk_1.default.italic.white(`_label={\`I am {count} years old.\`}`)} -> ${chalk_1.default.italic.white(`_label={\`I am \${count} years old.\`}`)} (add a $)
138
145
 
139
146
  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.
140
147
 
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.`);
148
+ If something is wrong, the migration can be reverted with ${chalk_1.default.italic.white(`git reset --hard HEAD~1`)} or by discarding the affected files. For more information, read the troubleshooting section in the README.`));
142
149
  }
143
150
  const status = runner.getStatus();
144
151
  console.log(`
@@ -53,6 +53,10 @@ class TaskRunner {
53
53
  }
54
54
  registerTasks(tasks) {
55
55
  tasks.forEach((task) => {
56
+ const dependentTasks = task.getDependentTasks();
57
+ if (dependentTasks.length > 0) {
58
+ this.registerTasks(dependentTasks);
59
+ }
56
60
  if (semver_1.default.gtr(this.projectVersion, task.getVersionRange(), {
57
61
  includePrerelease: true,
58
62
  })) {
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecTask = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const abstract_task_1 = require("../../abstract-task");
6
+ class ExecTask extends abstract_task_1.AbstractTask {
7
+ constructor(identifier, title, command, versionRange, dependentTasks, options) {
8
+ super(identifier, title, [], versionRange, dependentTasks, options);
9
+ this.command = command;
10
+ }
11
+ static getInstance(command, versionRange, dependentTasks = [], options = {}) {
12
+ const identifier = `exec-${command}`;
13
+ const title = `Exec ${command}.`;
14
+ if (!this.instances.has(identifier)) {
15
+ this.instances.set(identifier, new ExecTask(identifier, title, command, versionRange, dependentTasks, options));
16
+ }
17
+ return this.instances.get(identifier);
18
+ }
19
+ run() {
20
+ try {
21
+ (0, child_process_1.execSync)(this.command, {
22
+ encoding: 'utf8',
23
+ });
24
+ }
25
+ catch (error) {
26
+ console.warn(error);
27
+ }
28
+ }
29
+ }
30
+ exports.ExecTask = ExecTask;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HandleDependencyTask = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const abstract_task_1 = require("../../abstract-task");
6
+ const reuse_1 = require("../../../shares/reuse");
7
+ class HandleDependencyTask extends abstract_task_1.AbstractTask {
8
+ constructor(identifier, title, command, dependencies, // Map<string, string | null>
9
+ devDependencies, // Map<string, string | null>
10
+ versionRange, dependentTasks, options) {
11
+ super(identifier, title, [], versionRange, dependentTasks, options);
12
+ this.command = command;
13
+ this.dependencies = dependencies;
14
+ this.devDependencies = devDependencies;
15
+ }
16
+ static getInstance(command, dependencies, devDependencies, versionRange, dependentTasks = [], options = {}) {
17
+ const identifier = `${command}-${Object.keys(dependencies !== null && dependencies !== void 0 ? dependencies : {}).join(',')}-${Object.keys(devDependencies !== null && devDependencies !== void 0 ? devDependencies : {}).join(',')}`;
18
+ const title = `${command === 'add' ? 'Add' : command === 'install' ? 'Install' : 'Remove'} dependency "${Object.keys(dependencies !== null && dependencies !== void 0 ? dependencies : {}).join(', ')}" and devDependency "${Object.keys(devDependencies !== null && devDependencies !== void 0 ? devDependencies : {}).join(', ')}".`;
19
+ if (!this.instances.has(identifier)) {
20
+ this.instances.set(identifier, new HandleDependencyTask(identifier, title, command, dependencies, devDependencies, versionRange, dependentTasks, options));
21
+ }
22
+ return this.instances.get(identifier);
23
+ }
24
+ run() {
25
+ var _a, _b, _c, _d;
26
+ if (Object.keys((_a = this.dependencies) !== null && _a !== void 0 ? _a : {}).length > 0) {
27
+ let command = `${(0, reuse_1.getPackageManagerCommand)(this.command)}`;
28
+ Object.keys((_b = this.dependencies) !== null && _b !== void 0 ? _b : {}).forEach((dependency) => {
29
+ command += ` ${dependency}@${this.dependencies[dependency]}`;
30
+ });
31
+ try {
32
+ (0, child_process_1.execSync)(command, {
33
+ encoding: 'utf8',
34
+ });
35
+ }
36
+ catch (error) {
37
+ console.warn(error);
38
+ }
39
+ }
40
+ if (Object.keys((_c = this.devDependencies) !== null && _c !== void 0 ? _c : {}).length > 0) {
41
+ let command = `${(0, reuse_1.getPackageManagerCommand)(this.command)} -D`;
42
+ Object.keys((_d = this.devDependencies) !== null && _d !== void 0 ? _d : {}).forEach((dependency) => {
43
+ command += ` ${dependency}`;
44
+ });
45
+ try {
46
+ (0, child_process_1.execSync)(command, {
47
+ encoding: 'utf8',
48
+ });
49
+ }
50
+ catch (error) {
51
+ console.warn(error);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ exports.HandleDependencyTask = HandleDependencyTask;
@@ -0,0 +1,47 @@
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.JsonTask = void 0;
7
+ const deepmerge_1 = __importDefault(require("deepmerge"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const reuse_1 = require("../../../shares/reuse");
11
+ const abstract_task_1 = require("../../abstract-task");
12
+ class JsonTask extends abstract_task_1.AbstractTask {
13
+ constructor(identifier, key, json, versionRange, dependentTasks = [], options = {}) {
14
+ super(identifier, `Reconfigure "${key}" in package.json of your project.`, [], versionRange, dependentTasks, options);
15
+ this.json = json;
16
+ if (typeof key !== 'string') {
17
+ throw (0, reuse_1.logAndCreateError)(`Key of task "${this.identifier}" is not a string.`);
18
+ }
19
+ try {
20
+ JSON.stringify(json);
21
+ }
22
+ catch (_a) {
23
+ throw (0, reuse_1.logAndCreateError)(`Value of task "${this.identifier}" is not able to stringify (JSON).`);
24
+ }
25
+ }
26
+ static getInstance(key, json, versionRange, dependentTasks = [], options = {}) {
27
+ const identifier = `package.json-reconfigure-${key}`;
28
+ if (!this.instances.has(identifier)) {
29
+ this.instances.set(identifier, new JsonTask(identifier, key, json, versionRange, dependentTasks, options));
30
+ }
31
+ return this.instances.get(identifier);
32
+ }
33
+ run() {
34
+ const configPath = path_1.default.join(process.cwd(), 'package.json');
35
+ if (fs_1.default.existsSync(configPath)) {
36
+ try {
37
+ const fileContent = (0, deepmerge_1.default)(JSON.parse(fs_1.default.readFileSync(configPath, 'utf8')), this.json);
38
+ fs_1.default.writeFileSync(configPath, JSON.stringify(fileContent, null, 2));
39
+ reuse_1.MODIFIED_FILES.add(configPath);
40
+ }
41
+ catch (e) {
42
+ // empty
43
+ }
44
+ }
45
+ }
46
+ }
47
+ exports.JsonTask = JsonTask;
@@ -46,6 +46,7 @@ class LabelExpertSlot extends abstract_task_1.AbstractTask {
46
46
  const newContent = content
47
47
  // Replacements
48
48
  .replace(this.componentRegExp, removeLineBreaksAndSpaces)
49
+ // @todo: We could add a $ before all { inside the innerText ($2)
49
50
  .replace(this.componentRegExp, `$1 ${this.propertyInCamelCase}={\`$2\`}/>`);
50
51
  if (content !== newContent) {
51
52
  reuse_1.MODIFIED_FILES.add(file);
@@ -59,6 +60,7 @@ class LabelExpertSlot extends abstract_task_1.AbstractTask {
59
60
  const newContent = content
60
61
  // Replacements
61
62
  .replace(this.customElementRegExp, removeLineBreaksAndSpaces)
63
+ // @todo: We could add a $ before all { inside the innerText ($2)
62
64
  .replace(this.customElementRegExp, `$1 ${this.property}={\`$2\`}/>`);
63
65
  if (content !== newContent) {
64
66
  reuse_1.MODIFIED_FILES.add(file);
@@ -0,0 +1,36 @@
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.MergeHtmlTask = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const reuse_1 = require("../../../shares/reuse");
9
+ const abstract_task_1 = require("../../abstract-task");
10
+ class MergeHtmlTask extends abstract_task_1.AbstractTask {
11
+ constructor(identifier, title, path, filename, html, versionRange, dependentTasks, options) {
12
+ super(identifier, title, [], versionRange, dependentTasks, options);
13
+ this.path = path;
14
+ this.filename = filename;
15
+ this.html = html;
16
+ }
17
+ static getInstance(key, path, filename, html, versionRange, dependentTasks = [], options = {}) {
18
+ const identifier = `merge-html-${key}-in-${filename}`;
19
+ const title = `Merge html (${key}) in ${filename}.`;
20
+ if (!this.instances.has(identifier)) {
21
+ this.instances.set(identifier, new MergeHtmlTask(identifier, title, path, filename, html, versionRange, dependentTasks, options));
22
+ }
23
+ return this.instances.get(identifier);
24
+ }
25
+ run() {
26
+ if (fs_1.default.existsSync(this.path)) {
27
+ const content = fs_1.default.readFileSync(this.path, 'utf8');
28
+ if (!content.includes(this.html)) {
29
+ fs_1.default.writeFileSync(this.path, content.replace(/(>)([^<]+<\/head>)/, `$1
30
+ ${this.html}$2`));
31
+ reuse_1.MODIFIED_FILES.add(this.path);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ exports.MergeHtmlTask = MergeHtmlTask;
@@ -0,0 +1,40 @@
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.NpmRcAddRuleTask = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const reuse_1 = require("../../../shares/reuse");
10
+ const abstract_task_1 = require("../../abstract-task");
11
+ class NpmRcAddRuleTask extends abstract_task_1.AbstractTask {
12
+ constructor(identifier, rule, versionRange, dependentTasks = [], options = {}) {
13
+ super(identifier, `Add the rule "${rule}" to the .npmrc of your project.`, [], versionRange, dependentTasks, options);
14
+ this.rule = rule;
15
+ if (typeof rule !== 'string') {
16
+ throw (0, reuse_1.logAndCreateError)(`Definition of task "${this.identifier}" is not a string.`);
17
+ }
18
+ }
19
+ static getInstance(rule, versionRange, dependentTasks = [], options = {}) {
20
+ const identifier = `.npmrc-add-rule-${rule}`;
21
+ if (!this.instances.has(identifier)) {
22
+ this.instances.set(identifier, new NpmRcAddRuleTask(identifier, rule, versionRange, dependentTasks, options));
23
+ }
24
+ return this.instances.get(identifier);
25
+ }
26
+ run() {
27
+ const npmrcPath = path_1.default.join(process.cwd(), '.npmrc');
28
+ const lineToAdd = this.rule.trim();
29
+ if (!fs_1.default.existsSync(npmrcPath)) {
30
+ fs_1.default.writeFileSync(npmrcPath, lineToAdd + '\n');
31
+ }
32
+ else {
33
+ const fileContent = fs_1.default.readFileSync(npmrcPath, 'utf8');
34
+ if (!fileContent.split('\n').includes(lineToAdd)) {
35
+ fs_1.default.appendFileSync(npmrcPath, '\n' + lineToAdd);
36
+ }
37
+ }
38
+ }
39
+ }
40
+ exports.NpmRcAddRuleTask = NpmRcAddRuleTask;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoveTask = void 0;
4
+ const ExecTask_1 = require("./ExecTask");
5
+ class RemoveTask extends ExecTask_1.ExecTask {
6
+ constructor(identifier, title, path, versionRange, dependentTasks, options) {
7
+ super(identifier, title, `npx rimraf "${path}"`, versionRange, dependentTasks, options);
8
+ }
9
+ static getInstance(path, versionRange, dependentTasks = [], options = {}) {
10
+ const identifier = `remove-${path}`;
11
+ const title = `Remove ${path}.`;
12
+ if (!this.instances.has(identifier)) {
13
+ this.instances.set(identifier, new RemoveTask(identifier, title, path, versionRange, dependentTasks, options));
14
+ }
15
+ return this.instances.get(identifier);
16
+ }
17
+ }
18
+ exports.RemoveTask = RemoveTask;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.TsConfigReconfigureTask = void 0;
7
+ const deepmerge_1 = __importDefault(require("deepmerge"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
4
10
  const reuse_1 = require("../../../shares/reuse");
5
11
  const abstract_task_1 = require("../../abstract-task");
6
12
  class TsConfigReconfigureTask extends abstract_task_1.AbstractTask {
@@ -29,16 +35,17 @@ class TsConfigReconfigureTask extends abstract_task_1.AbstractTask {
29
35
  /**
30
36
  * The tsconfig.json shows an error, if we add `@public-ui/components` to the `types` property list.
31
37
  */
32
- // const configPath = path.join(process.cwd(), 'tsconfig.json');
33
- // if (fs.existsSync(configPath)) {
34
- // try {
35
- // const fileContent = merge(JSON.parse(fs.readFileSync(configPath, 'utf8')) as Record<string, unknown>, this.config);
36
- // fs.writeFileSync(configPath, JSON.stringify(fileContent, null, 2));
37
- // MODIFIED_FILES.add(configPath);
38
- // } catch (e) {
39
- // // empty
40
- // }
41
- // }
38
+ const configPath = path_1.default.join(process.cwd(), 'tsconfig.json');
39
+ if (fs_1.default.existsSync(configPath)) {
40
+ try {
41
+ const fileContent = (0, deepmerge_1.default)(JSON.parse(fs_1.default.readFileSync(configPath, 'utf8')), this.config);
42
+ fs_1.default.writeFileSync(configPath, JSON.stringify(fileContent, null, 2));
43
+ reuse_1.MODIFIED_FILES.add(configPath);
44
+ }
45
+ catch (e) {
46
+ // empty
47
+ }
48
+ }
42
49
  }
43
50
  }
44
51
  exports.TsConfigReconfigureTask = TsConfigReconfigureTask;
@@ -2,13 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.commonTasks = void 0;
4
4
  const GitIgnoreAddRuleTask_1 = require("./common/GitIgnoreAddRuleTask");
5
+ const NpmRcAddRuleTask_1 = require("./common/NpmRcAddRuleTask");
5
6
  const TsConfigReconfigureTask_1 = require("./common/TsConfigReconfigureTask");
6
7
  const VsCodeSettingsReconfigureTask_1 = require("./common/VsCodeSettingsReconfigureTask");
7
8
  exports.commonTasks = [];
8
9
  exports.commonTasks.push(GitIgnoreAddRuleTask_1.GitIgnoreAddRuleTask.getInstance('.kolibri.migrate.json', '*'));
10
+ exports.commonTasks.push(NpmRcAddRuleTask_1.NpmRcAddRuleTask.getInstance('save-exact=true', '*'));
9
11
  exports.commonTasks.push(VsCodeSettingsReconfigureTask_1.VsCodeSettingsReconfigureTask.getInstance('html.customData', ['./node_modules/@public-ui/components/vscode-custom-data.json'], '*'));
10
- exports.commonTasks.push(TsConfigReconfigureTask_1.TsConfigReconfigureTask.getInstance('compilerOptions.types', {
12
+ // unused
13
+ TsConfigReconfigureTask_1.TsConfigReconfigureTask.getInstance('compilerOptions.types', {
11
14
  compilerOptions: {
12
15
  types: ['@public-ui/components'],
13
16
  },
14
- }, '*'));
17
+ }, '*');
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAssetTasks = void 0;
4
+ const reuse_1 = require("../../../shares/reuse");
5
+ const ExecTask_1 = require("../common/ExecTask");
6
+ const HandleDependencyTask_1 = require("../common/HandleDependencyTask");
7
+ const JsonTask_1 = require("../common/JsonTask");
8
+ const MergeHtmlTask_1 = require("../common/MergeHtmlTask");
9
+ const RemoveTask_1 = require("../common/RemoveTask");
10
+ const getAssetTasks = (baseDir) => {
11
+ const assetTasks = [];
12
+ const indexHtml = (0, reuse_1.findIndexHtml)(baseDir);
13
+ if (indexHtml) {
14
+ const removeDeps = HandleDependencyTask_1.HandleDependencyTask.getInstance('remove', {}, {
15
+ 'cpy-cli': '5.0.0',
16
+ rimraf: '3.0.2',
17
+ }, '^1');
18
+ const installDeps = HandleDependencyTask_1.HandleDependencyTask.getInstance('add', {}, {
19
+ 'cpy-cli': '5.0.0',
20
+ rimraf: '3.0.2',
21
+ }, '^1', [removeDeps]);
22
+ const addScript = JsonTask_1.JsonTask.getInstance('scripts.postinstall', {
23
+ scripts: {
24
+ postinstall: `cpy "node_modules/@public-ui/components/assets/**/*" "${indexHtml}/assets" --dot`,
25
+ },
26
+ }, '^1', [installDeps]);
27
+ const htmlTask = MergeHtmlTask_1.MergeHtmlTask.getInstance('codicon', (0, reuse_1.resolveIndexHtmlPath)([indexHtml]), 'index.html', '<link rel="stylesheet" href="assets/codicons/codicon.css" />', '^1', [addScript]);
28
+ const removeTask = RemoveTask_1.RemoveTask.getInstance('public/assets/codicons', '^1', [htmlTask]);
29
+ const execTask = ExecTask_1.ExecTask.getInstance(`npx cpy "node_modules/@public-ui/components/assets/**/*" "${indexHtml}/assets" --dot`, '^1', [removeTask]);
30
+ assetTasks.push(execTask);
31
+ }
32
+ return assetTasks;
33
+ };
34
+ exports.getAssetTasks = getAssetTasks;
@@ -14,11 +14,14 @@ const button_link_1 = require("./button-link");
14
14
  const card_1 = require("./card");
15
15
  const details_1 = require("./details");
16
16
  const icon_1 = require("./icon");
17
+ const input_1 = require("./input");
17
18
  const input_checkbox_1 = require("./input-checkbox");
18
19
  const input_color_1 = require("./input-color");
19
20
  const input_date_1 = require("./input-date");
20
21
  const input_email_1 = require("./input-email");
22
+ const input_file_1 = require("./input-file");
21
23
  const input_number_1 = require("./input-number");
24
+ const input_password_1 = require("./input-password");
22
25
  const input_radio_1 = require("./input-radio");
23
26
  const input_range_1 = require("./input-range");
24
27
  const input_text_1 = require("./input-text");
@@ -39,9 +42,6 @@ const table_1 = require("./table");
39
42
  const tabs_1 = require("./tabs");
40
43
  const toast_1 = require("./toast");
41
44
  const version_1 = require("./version");
42
- const input_1 = require("./input");
43
- const input_file_1 = require("./input-file");
44
- const input_password_1 = require("./input-password");
45
45
  exports.v1Tasks = [];
46
46
  exports.v1Tasks.push(abbr_1.AbbrRenamePropertyAlignToTooltipAlign);
47
47
  exports.v1Tasks.push(abbr_1.AbbrRenamePropertyTitleToLabel);
@@ -106,12 +106,12 @@ exports.v1Tasks.push(link_1.LinkRenamePropertyAriaCurrentToListenAriaCurrent);
106
106
  exports.v1Tasks.push(link_1.LinkRenamePropertyIconOnlyToHideLabel);
107
107
  exports.v1Tasks.push(logo_1.LogoRenamePropertyAbbrToOrg);
108
108
  exports.v1Tasks.push(modal_1.ModalRenamePropertyAriaLabelToLabel);
109
- exports.v1Tasks.push(nav_1.NavRemovePropertyHasCompactButton);
109
+ // v1Tasks.push(NavRemovePropertyHasCompactButton);
110
110
  exports.v1Tasks.push(nav_1.NavRemovePropertyVariant);
111
111
  exports.v1Tasks.push(nav_1.NavRenamePropertyAriaLabelToLabel);
112
112
  exports.v1Tasks.push(nav_1.NavRenamePropertyCompactToHideLabel);
113
- exports.v1Tasks.push(nav_1.NavRenamePropertyCompactToHideLabel);
114
113
  exports.v1Tasks.push(pagination_1.PaginationRenamePropertyCountToTotal);
114
+ exports.v1Tasks.push(pagination_1.PaginationRenamePropertyTotalToMax);
115
115
  exports.v1Tasks.push(progress_1.ProgressRenamePropertyTypeToVariant);
116
116
  exports.v1Tasks.push(quote_1.QuoteRenamePropertyCaptionToLabel);
117
117
  exports.v1Tasks.push(select_1.SelectRenamePropertyHeightToRows);
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavRemovePropertyVariant = exports.NavRemovePropertyHasCompactButton = exports.NavRenamePropertyCompactToHideLabel = exports.NavRenamePropertyAriaLabelToLabel = void 0;
3
+ exports.NavRemovePropertyVariant = exports.NavRenamePropertyCompactToHideLabel = exports.NavRenamePropertyAriaLabelToLabel = void 0;
4
4
  const RemovePropertyNameTask_1 = require("../common/RemovePropertyNameTask");
5
5
  const RenamePropertyNameTask_1 = require("../common/RenamePropertyNameTask");
6
6
  exports.NavRenamePropertyAriaLabelToLabel = RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance('kol-nav', '_aria-label', '_label', '^1');
7
7
  exports.NavRenamePropertyCompactToHideLabel = RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance('kol-nav', '_compact', '_hide-label', '^1');
8
- exports.NavRemovePropertyHasCompactButton = RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-nav', '_has-compact-button', '^1');
8
+ // export const NavRemovePropertyHasCompactButton = RemovePropertyNameTask.getInstance('kol-nav', '_has-compact-button', '^1');
9
+ RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-nav', '_has-compact-button', '^1');
9
10
  exports.NavRemovePropertyVariant = RemovePropertyNameTask_1.RemovePropertyNameTask.getInstance('kol-nav', '_variant', '^1');
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaginationRenamePropertyCountToTotal = void 0;
3
+ exports.PaginationRenamePropertyTotalToMax = exports.PaginationRenamePropertyCountToTotal = void 0;
4
4
  const RenamePropertyNameTask_1 = require("../common/RenamePropertyNameTask");
5
5
  exports.PaginationRenamePropertyCountToTotal = RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance('kol-pagination', '_count', '_total', '^1');
6
+ exports.PaginationRenamePropertyTotalToMax = RenamePropertyNameTask_1.RenamePropertyNameTask.getInstance('kol-pagination', '_total', '_max', '^1', [
7
+ exports.PaginationRenamePropertyCountToTotal,
8
+ ]);
@@ -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.getVersionOfPublicUiKoliBriCli = exports.getVersionOfPublicUiComponents = exports.getContentOfProjectPkgJson = exports.getRemoveMode = exports.setRemoveMode = exports.MODIFIED_FILES = exports.kebabToCamelCase = exports.kebabToCapitalCase = exports.isPropertyKebabCaseRegExp = exports.isTagKebabCaseRegExp = exports.isKebabCaseRegExp = exports.getPackageManagerInstallCommand = exports.filterFilesByExt = exports.logAndCreateError = void 0;
6
+ exports.findIndexHtml = exports.resolveIndexHtmlPath = exports.getVersionOfPublicUiKoliBriCli = exports.getVersionOfPublicUiComponents = exports.getContentOfProjectPkgJson = exports.getRemoveMode = exports.setRemoveMode = exports.MODIFIED_FILES = exports.kebabToCamelCase = exports.kebabToCapitalCase = exports.isPropertyKebabCaseRegExp = exports.isTagKebabCaseRegExp = exports.isKebabCaseRegExp = exports.getPackageManagerCommand = exports.filterFilesByExt = exports.logAndCreateError = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -80,23 +80,24 @@ function readPackageJson(offsetPath) {
80
80
  }
81
81
  /**
82
82
  * This function is used to get the package manager install command.
83
+ * @param {PackageManagerCommand} command The package manager command
83
84
  * @param {string} baseDir The base directory to start searching for the package manager
84
85
  * @returns {string} The package manager install command
85
86
  */
86
- function getPackageManagerInstallCommand(baseDir = process.cwd()) {
87
+ function getPackageManagerCommand(command, baseDir = process.cwd()) {
87
88
  if (fs_1.default.existsSync(path_1.default.resolve(baseDir, 'pnpm-lock.yaml')))
88
- return 'pnpm i --prefer-offline';
89
+ return `pnpm ${command}`;
89
90
  if (fs_1.default.existsSync(path_1.default.resolve(baseDir, 'yarn.lock')))
90
- return 'yarn';
91
+ return `yarn ${command}`;
91
92
  if (fs_1.default.existsSync(path_1.default.resolve(baseDir, 'package-lock.json')))
92
- return 'npm i';
93
+ return `npm ${command}`;
93
94
  baseDir = path_1.default.resolve(baseDir, '..');
94
95
  if (baseDir === '/') {
95
96
  throw logAndCreateError('Package manager could not detected.');
96
97
  }
97
- return getPackageManagerInstallCommand(baseDir);
98
+ return getPackageManagerCommand(command, baseDir);
98
99
  }
99
- exports.getPackageManagerInstallCommand = getPackageManagerInstallCommand;
100
+ exports.getPackageManagerCommand = getPackageManagerCommand;
100
101
  exports.isKebabCaseRegExp = /^((data-removed-)?[a-z]+(-[a-z]+)*)?$/;
101
102
  exports.isTagKebabCaseRegExp = /^kol-[a-z]+(-[a-z]+)*$/;
102
103
  exports.isPropertyKebabCaseRegExp = /^(data-removed-)?_[a-z]+(-[a-z]+)*$/;
@@ -169,3 +170,15 @@ const getVersionOfPublicUiKoliBriCli = () => {
169
170
  }
170
171
  };
171
172
  exports.getVersionOfPublicUiKoliBriCli = getVersionOfPublicUiKoliBriCli;
173
+ const INDEX_HTML_LOCATIONS = ['./', 'public'];
174
+ const resolvePath = (paths, offset = process.cwd()) => path_1.default.resolve(offset, ...paths);
175
+ const resolveIndexHtmlPath = (paths) => resolvePath([...paths, 'index.html']);
176
+ exports.resolveIndexHtmlPath = resolveIndexHtmlPath;
177
+ const existsIndexHtml = (location) => fs_1.default.existsSync((0, exports.resolveIndexHtmlPath)([location]));
178
+ const findIndexHtml = (baseDir) => {
179
+ if (existsIndexHtml(baseDir)) {
180
+ return baseDir;
181
+ }
182
+ return INDEX_HTML_LOCATIONS.find(existsIndexHtml);
183
+ };
184
+ exports.findIndexHtml = findIndexHtml;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/kolibri-cli",
3
- "version": "1.7.0-rc.16",
3
+ "version": "1.7.0-rc.17",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": "https://github.com/public-ui/kolibri",
@@ -27,11 +27,11 @@
27
27
  "semver": "7.5.4"
28
28
  },
29
29
  "devDependencies": {
30
- "@public-ui/components": "1.7.0-rc.16",
30
+ "@public-ui/components": "1.7.0-rc.17",
31
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",
32
+ "@types/node": "20.7.1",
33
+ "@typescript-eslint/eslint-plugin": "6.7.3",
34
+ "@typescript-eslint/parser": "6.7.3",
35
35
  "cpy-cli": "5.0.0",
36
36
  "depcheck": "1.4.6",
37
37
  "eslint": "8.50.0",
@@ -42,7 +42,7 @@
42
42
  "eslint-plugin-jsx-a11y": "6.7.1",
43
43
  "eslint-plugin-no-loops": "0.3.0",
44
44
  "eslint-plugin-react": "7.33.2",
45
- "knip": "2.27.1",
45
+ "knip": "2.30.0",
46
46
  "mocha": "10.2.0",
47
47
  "nodemon": "3.0.1",
48
48
  "rimraf": "3.0.2",
@@ -57,7 +57,7 @@
57
57
  "depcheck": "depcheck --ignores=\"@public-ui/components,deepmerge,loglevel,mocha\"",
58
58
  "format": "prettier -c src",
59
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",
60
+ "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",
61
61
  "restart": "pnpm reset && pnpm start",
62
62
  "unused": "knip",
63
63
  "watch": "nodemon --ignore package.json src/index.ts migrate --ignore-uncommitted-changes --test-tasks test"