t1kit 0.1.0 → 0.1.1
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/bin/t1kit.mjs +9 -9
- package/migrate-semantic-theme-ts/README.md +15 -15
- package/migrate-semantic-theme-ts/index.mjs +15 -15
- package/package.json +31 -31
- package/src/cli.mjs +35 -35
- package/src/commands/index.mjs +6 -6
- package/src/commands/semantic-migrate/command.mjs +214 -216
- package/src/commands/semantic-migrate/files.mjs +21 -21
- package/src/commands/semantic-migrate/host-tests.mjs +118 -118
- package/src/commands/semantic-migrate/submodule.mjs +208 -181
- package/src/commands/semantic-migrate/transforms.mjs +374 -29
package/bin/t1kit.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { runCli } from '../src/cli.mjs';
|
|
3
|
-
|
|
4
|
-
try {
|
|
5
|
-
await runCli(process.argv.slice(2));
|
|
6
|
-
} catch (error) {
|
|
7
|
-
console.error(error.message);
|
|
8
|
-
process.exitCode = 1;
|
|
9
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runCli } from '../src/cli.mjs';
|
|
3
|
+
|
|
4
|
+
try {
|
|
5
|
+
await runCli(process.argv.slice(2));
|
|
6
|
+
} catch (error) {
|
|
7
|
+
console.error(error.message);
|
|
8
|
+
process.exitCode = 1;
|
|
9
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# migrate-semantic-theme-ts
|
|
2
|
-
|
|
3
|
-
Совместимый со старым запуском вход в команду `semantic-migrate`:
|
|
4
|
-
|
|
5
|
-
```sh
|
|
6
|
-
node ../scripts/migrate-semantic-theme-ts/index.mjs --dry-run
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
После публикации npm-пакета:
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
npx t1kit semantic-migrate --dry-run
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
[Описание команды и её параметров](../src/commands/semantic-migrate/README.md).
|
|
1
|
+
# migrate-semantic-theme-ts
|
|
2
|
+
|
|
3
|
+
Совместимый со старым запуском вход в команду `semantic-migrate`:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
node ../scripts/migrate-semantic-theme-ts/index.mjs --dry-run
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
После публикации npm-пакета:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npx t1kit semantic-migrate --dry-run
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
[Описание команды и её параметров](../src/commands/semantic-migrate/README.md).
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { pathToFileURL } from 'node:url';
|
|
3
|
-
import { run } from '../src/commands/semantic-migrate/command.mjs';
|
|
4
|
-
|
|
5
|
-
export { parseArgs } from '../src/commands/semantic-migrate/command.mjs';
|
|
6
|
-
export { componentTreeUsesPopup } from '../src/commands/semantic-migrate/host-tests.mjs';
|
|
7
|
-
|
|
8
|
-
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
9
|
-
try {
|
|
10
|
-
await run(process.argv.slice(2));
|
|
11
|
-
} catch (error) {
|
|
12
|
-
console.error(error.message);
|
|
13
|
-
process.exitCode = 1;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import { run } from '../src/commands/semantic-migrate/command.mjs';
|
|
4
|
+
|
|
5
|
+
export { parseArgs } from '../src/commands/semantic-migrate/command.mjs';
|
|
6
|
+
export { componentTreeUsesPopup } from '../src/commands/semantic-migrate/host-tests.mjs';
|
|
7
|
+
|
|
8
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
9
|
+
try {
|
|
10
|
+
await run(process.argv.slice(2));
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error(error.message);
|
|
13
|
+
process.exitCode = 1;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "t1kit",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI tools for T1 frontend projects",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "UNLICENSED",
|
|
7
|
-
"bin": {
|
|
8
|
-
"t1kit": "bin/t1kit.mjs"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"bin/",
|
|
12
|
-
"src/",
|
|
13
|
-
"!src/**/*.test.mjs",
|
|
14
|
-
"migrate-semantic-theme-ts/"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"test": "node --test",
|
|
18
|
-
"prepublishOnly": "npm test"
|
|
19
|
-
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=22"
|
|
22
|
-
},
|
|
23
|
-
"repository": {
|
|
24
|
-
"type": "git",
|
|
25
|
-
"url": "https://git-02.t1-group.ru/frontend/tools/scripts.git"
|
|
26
|
-
},
|
|
27
|
-
"publishConfig": {
|
|
28
|
-
"access": "public",
|
|
29
|
-
"registry": "https://registry.npmjs.org/"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "t1kit",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "CLI tools for T1 frontend projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"bin": {
|
|
8
|
+
"t1kit": "bin/t1kit.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"src/",
|
|
13
|
+
"!src/**/*.test.mjs",
|
|
14
|
+
"migrate-semantic-theme-ts/"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node --test",
|
|
18
|
+
"prepublishOnly": "npm test"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=22"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://git-02.t1-group.ru/frontend/tools/scripts.git"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"registry": "https://registry.npmjs.org/"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/cli.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { commands } from './commands/index.mjs';
|
|
3
|
-
|
|
4
|
-
export const runCli = async argv => {
|
|
5
|
-
const [name, ...args] = argv;
|
|
6
|
-
|
|
7
|
-
if (!name || name === '--help' || name === '-h') {
|
|
8
|
-
console.log(`t1kit
|
|
9
|
-
|
|
10
|
-
Использование:
|
|
11
|
-
npx t1kit <command> [options]
|
|
12
|
-
|
|
13
|
-
Команды:
|
|
14
|
-
${Object.entries(commands).map(([name, command]) => ` ${name} ${command.description}`).join('\n')}
|
|
15
|
-
|
|
16
|
-
npx t1kit <command> --help
|
|
17
|
-
npx t1kit --version`);
|
|
18
|
-
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (name === '--version' || name === '-v') {
|
|
23
|
-
const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
24
|
-
|
|
25
|
-
console.log(version);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!Object.hasOwn(commands, name)) {
|
|
30
|
-
throw new Error(`Неизвестная команда: ${name}. Доступные команды: ${Object.keys(commands).join(', ')}. Справка: npx t1kit --help`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const command = await commands[name].load();
|
|
34
|
-
await command.run(args);
|
|
35
|
-
};
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { commands } from './commands/index.mjs';
|
|
3
|
+
|
|
4
|
+
export const runCli = async argv => {
|
|
5
|
+
const [name, ...args] = argv;
|
|
6
|
+
|
|
7
|
+
if (!name || name === '--help' || name === '-h') {
|
|
8
|
+
console.log(`t1kit
|
|
9
|
+
|
|
10
|
+
Использование:
|
|
11
|
+
npx t1kit <command> [options]
|
|
12
|
+
|
|
13
|
+
Команды:
|
|
14
|
+
${Object.entries(commands).map(([name, command]) => ` ${name} ${command.description}`).join('\n')}
|
|
15
|
+
|
|
16
|
+
npx t1kit <command> --help
|
|
17
|
+
npx t1kit --version`);
|
|
18
|
+
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (name === '--version' || name === '-v') {
|
|
23
|
+
const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
24
|
+
|
|
25
|
+
console.log(version);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!Object.hasOwn(commands, name)) {
|
|
30
|
+
throw new Error(`Неизвестная команда: ${name}. Доступные команды: ${Object.keys(commands).join(', ')}. Справка: npx t1kit --help`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const command = await commands[name].load();
|
|
34
|
+
await command.run(args);
|
|
35
|
+
};
|
package/src/commands/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const commands = {
|
|
2
|
-
'semantic-migrate': {
|
|
3
|
-
description: 'Миграция с front-semantic-theme на front-semantic-theme-ts',
|
|
4
|
-
load: () => import('./semantic-migrate/command.mjs'),
|
|
5
|
-
},
|
|
6
|
-
};
|
|
1
|
+
export const commands = {
|
|
2
|
+
'semantic-migrate': {
|
|
3
|
+
description: 'Миграция с front-semantic-theme на front-semantic-theme-ts',
|
|
4
|
+
load: () => import('./semantic-migrate/command.mjs'),
|
|
5
|
+
},
|
|
6
|
+
};
|