@public-ui/kolibri-cli 1.7.0-rc.1 → 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 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,13 +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 load all available migration tasks.
45
- 2. If the task in the correct version range, it will be executed them one by one. Otherwise it will be skipped.
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. Are there any pending tasks, the migration command will be executed again. Otherwise the migration is finished.
68
+ 4. If there are any pending tasks, the migration command will be executed again. Otherwise the migration is finished.
48
69
  5. Now you can check the result and commit the changes.
49
70
 
50
- > **Note:** You can reset the migration with `git reset --hard HEAD~1`.
71
+ > **Note:** You can reset the migration with `git reset --hard HEAD~1` or by discarding the affected files.
51
72
 
52
73
  #### Help
53
74
 
@@ -63,10 +84,10 @@ kolibri migrate <path>
63
84
 
64
85
  #### Options
65
86
 
66
- | Option | Description | Type | Default |
67
- | ------------------------------ | ------------------------------------------ | :--------------------: | :--------: |
68
- | `--ignore-uncommitted-changes` | Allows execution with uncommitted changes | boolean | false |
69
- | `--remove-mode` | Remove properties by comment out or delete | `delete` \| `prefixed` | `prefixed` |
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` |
70
91
 
71
92
  #### Configuration
72
93
 
@@ -142,4 +163,4 @@ You have always the possibility of a dry run. Because before the migration will
142
163
 
143
164
  After the migration you can check the result with `git status` and `git diff`.
144
165
 
145
- 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 Banner = gradient_string_1.default.atlas.multiline(`
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 | 1.7.0-rc.1
18
+ 🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | ${versionOfPublicUiKoliBriCli}
17
19
  `, {
18
20
  interpolation: 'hsv',
19
21
  });
20
- console.log(Banner);
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('1.7.0-rc.1');
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();
@@ -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,9 +21,9 @@ 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
- .option('--ignore-uncommitted-changes', 'Allows execution with uncommitted changes', false)
24
- .addOption(new commander_1.Option('--remove-mode <mode>', 'Remove with comment out or delete').choices(['comment', 'delete']).default('comment'))
25
- .option('--test-tasks', 'Run additional test tasks', false)
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())
26
27
  .action((baseDir, options) => {
27
28
  (0, child_process_1.exec)('git status --porcelain', (err, stdout) => {
28
29
  if (err) {
@@ -33,8 +34,8 @@ function default_1(program) {
33
34
  throw new Error('There are uncommitted changes');
34
35
  }
35
36
  (0, reuse_1.setRemoveMode)(options.removeMode);
36
- const versionOfPublicUiKoliBriCli = (0, reuse_1.readPackageJson)(path_1.default.resolve(__dirname, '..', '..')).version;
37
- const versionOfPublicUiComponents = (0, reuse_1.readPackageJson)(path_1.default.resolve(process.cwd(), 'node_modules/@public-ui/components')).version;
37
+ const versionOfPublicUiComponents = (0, reuse_1.getVersionOfPublicUiComponents)();
38
+ const versionOfPublicUiKoliBriCli = (0, reuse_1.getVersionOfPublicUiKoliBriCli)();
38
39
  console.log(`
39
40
  Current version of @public-ui/components: ${versionOfPublicUiComponents}
40
41
  Source folder to migrate: ${baseDir}
@@ -86,16 +87,11 @@ Modified files: ${reuse_1.MODIFIED_FILES.size}`);
86
87
  console.log(`- ${file}`);
87
88
  });
88
89
  console.log(`
89
- After the code migration has gone through, the code formatting may no longer
90
- 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.
91
91
 
92
- Afterwards, it may be that functions or themes in newer major versions have
93
- changed or are no longer included. This should be checked finally and corrected
94
- 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.
95
93
 
96
- Is anything wrong, you can reset the migration with "git reset --hard HEAD~1" and
97
- read the troubleshooting section in the readme.
98
- `);
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.`);
99
95
  }
100
96
  }
101
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,7 +59,6 @@ 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
  }
@@ -94,7 +91,6 @@ class TaskRunner {
94
91
  this.tasks.forEach((task) => {
95
92
  this.dependentTaskRun(task, task.getDependentTasks());
96
93
  });
97
- this.openRun = false;
98
94
  }
99
95
  getPendingMinVersion() {
100
96
  let version = this.cliVersion;
@@ -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.filterFilesByExt = void 0;
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
  /**
@@ -92,7 +92,7 @@ function kebabToCapitalCase(tag) {
92
92
  }
93
93
  exports.kebabToCapitalCase = kebabToCapitalCase;
94
94
  exports.MODIFIED_FILES = new Set();
95
- let REMOVE_MODE = 'comment';
95
+ let REMOVE_MODE = 'prefix';
96
96
  /**
97
97
  * Sets the remove mode.
98
98
  * @param {RemoveMode} mode The remove mode
@@ -109,3 +109,7 @@ function getRemoveMode() {
109
109
  return REMOVE_MODE;
110
110
  }
111
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;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REMOVE_MODE = void 0;
4
+ exports.REMOVE_MODE = ['delete', 'prefix'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/kolibri-cli",
3
- "version": "1.7.0-rc.1",
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",
@@ -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());
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TASK_STATUS = void 0;
4
- exports.TASK_STATUS = ['pending', 'running', 'done', 'failed'];
@@ -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;