tsoft-cli 1.4.2 → 2.0.0

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.
Files changed (72) hide show
  1. package/.editorconfig +11 -0
  2. package/.github/workflows/node.js.yml +25 -0
  3. package/.nvmrc +1 -0
  4. package/.prettierrc.json +8 -0
  5. package/.vscode/extensions.json +3 -0
  6. package/.vscode/settings.json +4 -0
  7. package/CHANGELOG.md +35 -4
  8. package/package.json +14 -25
  9. package/packages/cli/README.md +53 -0
  10. package/packages/cli/bin/dev.js +5 -0
  11. package/packages/cli/bin/run.cmd +3 -0
  12. package/packages/cli/bin/run.js +5 -0
  13. package/packages/cli/enums.ts +4 -0
  14. package/packages/cli/index.ts +11 -0
  15. package/packages/cli/package.json +59 -0
  16. package/packages/cli/tsconfig.json +9 -0
  17. package/packages/shared/index.ts +6 -0
  18. package/packages/shared/package.json +45 -0
  19. package/packages/shared/src/cli-progress.ts +3 -0
  20. package/packages/shared/src/commands/cli-all-commands.ts +6 -0
  21. package/packages/shared/src/commands/version-command.ts +12 -0
  22. package/packages/shared/src/consola.ts +1 -0
  23. package/packages/shared/src/open.ts +3 -0
  24. package/packages/shared/src/unzip.ts +15 -0
  25. package/packages/shared/tsconfig.json +9 -0
  26. package/packages/theme/bin/dev.js +5 -0
  27. package/packages/theme/bin/run.cmd +3 -0
  28. package/packages/theme/bin/run.js +5 -0
  29. package/packages/theme/index.ts +21 -0
  30. package/packages/theme/jest.config.ts +3 -0
  31. package/packages/theme/package.json +66 -0
  32. package/packages/theme/src/commands/theme/create.ts +51 -0
  33. package/packages/theme/src/commands/theme/delete-site.ts +30 -0
  34. package/packages/theme/src/commands/theme/delete-theme.ts +39 -0
  35. package/packages/theme/src/commands/theme/dev.ts +47 -0
  36. package/packages/theme/src/commands/theme/pull.ts +26 -0
  37. package/packages/theme/src/enums.ts +55 -0
  38. package/packages/theme/src/services/ClientCredentials.ts +127 -0
  39. package/packages/theme/src/services/Constants.ts +19 -0
  40. package/packages/theme/src/services/CreateTheme.ts +88 -0
  41. package/packages/theme/src/services/DeleteSite.ts +30 -0
  42. package/packages/theme/src/services/DeleteTheme.ts +46 -0
  43. package/packages/theme/src/services/FileManager.ts +62 -0
  44. package/packages/theme/src/services/Request.ts +18 -0
  45. package/packages/theme/src/services/StartTheme.ts +363 -0
  46. package/packages/theme/src/services/SyncTheme.ts +108 -0
  47. package/packages/theme/src/services/ThemeManager.ts +118 -0
  48. package/packages/theme/src/services/Tsoft.ts +151 -0
  49. package/packages/theme/src/services/types.ts +90 -0
  50. package/packages/theme/src/types.ts +20 -0
  51. package/packages/theme/src/utils/screen.ts +28 -0
  52. package/packages/theme/src/utils/utils.ts +83 -0
  53. package/packages/theme/tests/FileManager.test.js +90 -0
  54. package/packages/theme/tsconfig.json +9 -0
  55. package/pnpm-workspace.yaml +2 -0
  56. package/pull_request_template.md +5 -0
  57. package/scripts/prebuild.js +45 -0
  58. package/scripts/versions.js +70 -0
  59. package/tsconfig.build.json +21 -0
  60. package/bin/index.js +0 -77
  61. package/jest.config.js +0 -3
  62. package/src/Tsoft.js +0 -137
  63. package/src/commands/CreateCommand.js +0 -102
  64. package/src/commands/StartCommand.js +0 -280
  65. package/src/commands/SyncCommand.js +0 -97
  66. package/src/core/ClientCredentials.js +0 -107
  67. package/src/core/Constants.js +0 -19
  68. package/src/core/FileManager.js +0 -53
  69. package/src/core/Request.js +0 -41
  70. package/src/core/ThemeManager.js +0 -113
  71. package/src/core/Utils.js +0 -104
  72. package/tests/FileManager.test.js +0 -90
package/.editorconfig ADDED
@@ -0,0 +1,11 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+ quote_type = single
11
+ max_line_length = 125
@@ -0,0 +1,25 @@
1
+ name: T-Soft Cli
2
+
3
+ on:
4
+ push:
5
+ branches: ['main']
6
+ pull_request:
7
+ branches: ['main']
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ node-version: [18.x]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v3
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ cache: 'npm'
24
+ - run: npm install
25
+ - run: npm run build
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v18
@@ -0,0 +1,8 @@
1
+ {
2
+ "trailingComma": "all",
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "semi": false,
6
+ "printWidth": 125,
7
+ "bracketSpacing": true
8
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["esbenp.prettier-vscode"]
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "npm.packageManager": "pnpm"
4
+ }
package/CHANGELOG.md CHANGED
@@ -1,82 +1,113 @@
1
1
  # Changelog
2
2
 
3
3
  ## [1.2.0] - 2024-06-12
4
+
4
5
  ### Added
6
+
5
7
  - Yeni site ismi girildiğinde geçerli olup olmadığını kontrol eden özellik eklendi.
6
- - Kullanıcı komut satırı etkileşimleri için `enquirer` kütüphanesi kullanımı güncellendi.
8
+ - Kullanıcı komut satırı etkileşimleri için `@inquirer/prompts` kütüphanesi kullanımı güncellendi.
7
9
  - Dosya izleme ve tema güncelleme özellikleri geliştirildi.
8
10
 
9
11
  ### Changed
12
+
10
13
  - `ThemeManager` sınıfı geliştirildi ve yeni yöntemler eklendi.
11
14
  - `start.js` dosyasında önemli iyileştirmeler yapıldı.
12
15
  - `create.js` dosyasında kullanıcı girişleri doğrulandı ve daha kullanıcı dostu hale getirildi.
13
16
 
14
17
  ### Fixed
18
+
15
19
  - Birkaç hata düzeltildi ve genel kod kalitesi iyileştirildi.
16
20
 
17
21
  # Changelog
18
22
 
19
23
  ## [1.2.1] - 2024-06-13
24
+
20
25
  ### Added
26
+
21
27
  - T-Soft CLI'de yeni bir site oluşturma ve geçerliliğini kontrol etme özelliği eklendi.
22
28
 
23
29
  ### Changed
30
+
24
31
  - `start.js` ve `create.js` dosyalarında refaktörizasyon yapıldı.
25
32
  - T-Soft CLI ana menüsü, site ve tema seçimlerinin interaktif hale getirilmesi amacıyla güncellendi.
26
33
  - Tüm metinler Türkçeleştirildi ve kullanıcıya daha açıklayıcı mesajlar sağlandı.
27
34
 
28
35
  ### Fixed
36
+
29
37
  - Geliştirme ortamı başlatıldığında programın beklenmedik şekilde kapanmasına sebep olan hata giderildi.
30
38
  - T-Soft CLI'nın `start.js` dosyasında initialize fonksiyonunun doğru şekilde çalışmaması sorunu çözüldü.
31
39
 
32
40
  # Changelog
33
41
 
34
42
  ## [1.2.2] - 2024-06-14
43
+
35
44
  ### Added
45
+
36
46
  - Kurtarma anahtarı ile tema senkronizasyonu yapan `syncTheme` fonksiyonu eklendi.
37
47
  - `syncTheme` fonksiyonu zip dosyasını indirip açma işlemi gerçekleştiriyor.
38
48
  - Tema bilgilerini içeren `.theme` dosyası oluşturma ve `theme.env` dosyası yaratma işlemleri eklendi.
39
- - Kullanıcı komut satırı etkileşimleri için `enquirer` kütüphanesi kullanıldı.
49
+ - Kullanıcı komut satırı etkileşimleri için `@inquirer/prompts` kütüphanesi kullanıldı.
40
50
 
41
51
  ### Changed
52
+
42
53
  - `unzipFile` fonksiyonu eklendi, zip dosyalarını açmak için kullanılıyor.
43
54
  - `sync.js` dosyasında kullanıcıdan kurtarma anahtarı alınarak gerekli işlemlerin yapılması sağlandı.
44
55
 
45
56
  ### Fixed
57
+
46
58
  - Zip dosyasının indirildikten sonra otomatik olarak silinmesi sağlandı.
47
59
  - `sync.js` dosyasında oluşan hatalar giderildi ve kod kalitesi iyileştirildi.
48
60
 
49
61
  ## [1.2.3] - 2024-06-14
50
62
 
51
63
  ### Fixed
64
+
52
65
  - Yeni tema ekleme işlemi sırasında oluşan hatalar giderildi.
53
66
  - `start.js` `utils.js` ve `sync.js` dosyalarında iyileştirmeler yapıldı.
54
67
 
55
68
  # Changelog
56
69
 
57
70
  ## [1.4.0] - 2024-06-16
71
+
58
72
  ### Added
73
+
59
74
  - Zip dosyasının indirildiğinde ve çıkartıldığında oluşabilecek hatalar kontrol edilip anlamlı hata mesajları eklendi.
60
75
  - Kurtarma kodu girildikten ve dosyalar başarıyla senkronize edildikten sonra otomatik olarak geliştirme ortamını başlatma özelliği eklendi.
61
76
 
62
77
  ### Changed
78
+
63
79
  - Proje genelinde SoC (Separation of Concerns) prensiplerine uygun olarak sınıf tabanlı yapıya geçildi.
64
80
  - `ClientCredentials`, `FileManager`, `Request`, `ThemeManager`, ve `Utils` dosyaları sınıf yapısına dönüştürüldü.
65
- - `SyncCommand` dosyasındaki `syncTheme` fonksiyonu, kurtarma işlemi ve zip dosyası işlemlerini yönetmek için güncellendi.
66
- - `StartCommand` ile senkronize şekilde çalışacak şekilde `syncTheme` fonksiyonu güncellendi.
81
+ - `SyncTheme` dosyasındaki `syncTheme` fonksiyonu, kurtarma işlemi ve zip dosyası işlemlerini yönetmek için güncellendi.
82
+ - `StartTheme` ile senkronize şekilde çalışacak şekilde `syncTheme` fonksiyonu güncellendi.
67
83
 
68
84
  ### Fixed
85
+
69
86
  - Zip dosyasının indirilmesi ve çıkartılması sırasında oluşabilecek hatalar için ek kontrol sağlandı.
70
87
  - Kurtarma işlemi sırasında çok fazla deneme yapılırsa kullanıcıyı doğru şekilde bilgilendirme ve işlemi durdurma.
71
88
  - Geliştirme ortamını başlatma işlemi sırasında oluşabilecek hatalar giderildi.
72
89
  - Proje genelinde hata yönetimi ve kullanıcı bilgilendirme mesajları iyileştirildi.
73
90
 
74
91
  ## [1.4.1] - 2024-06-20
92
+
75
93
  ### Added
94
+
76
95
  - `p` tuşuna basıldığında tarayıcıda URL'yi açma özelliği eklendi. Temaların çalışma zamanında önizlemesini sağlanabilmektedir.
77
96
 
78
97
  ## [1.4.2] - 2024-06-21
98
+
79
99
  ### Changed
100
+
80
101
  - `Yeni Bir Tema Oluştur` seçeneği seçildiğinde, `.tsoft` dosyası olmayan dizinler listelenmeyecek şekilde güncellendi.
81
102
  - `createTheme` fonksiyonu, yeni bir site oluşturulduğunda `.tsoft` dosyasını da otomatik olarak oluşturacak şekilde güncellendi.
82
103
  - `Geliştirme ortamını başlat` seçeneği seçildiğinde, `.tsoft` dosyası olmayan dizinler listelenmeyecek şekilde güncellendi.
104
+
105
+ ## [1.4.3] - 2024-06-21
106
+
107
+ ### Changed
108
+
109
+ - `.theme` dosyası artık tema dosyaları ile birlikte yüklenmektedir. Bu sayade, temaların meta bilgileri güncel tutulmaktadır.
110
+
111
+ ### Fixed
112
+
113
+ - `Yeni bir site oluştur` seçeneği seçildiğinde, `createNewSite` fonksiyonu çalıştırıldığında oluşan hata giderildi.
package/package.json CHANGED
@@ -1,31 +1,20 @@
1
1
  {
2
2
  "name": "tsoft-cli",
3
- "version": "1.4.2",
4
- "description": "A theme development cli for developers who want to create themes for T-Soft.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "jest"
8
- },
9
- "keywords": [],
10
- "author": "",
3
+ "version": "2.0.0",
4
+ "description": "T-Soft CLI Application",
5
+ "author": "T-Soft",
11
6
  "license": "ISC",
12
- "bin": {
13
- "tsoft-cli": "./bin/index.js"
14
- },
15
- "dependencies": {
16
- "chokidar": "^3.6.0",
17
- "cli-progress": "^3.12.0",
18
- "commander": "^12.1.0",
19
- "enquirer": "^2.4.1",
20
- "figlet": "^1.7.0",
21
- "fs": "^0.0.1-security",
22
- "node-fetch": "^3.3.2",
23
- "open": "^10.1.0",
24
- "unzipper": "^0.12.1"
7
+ "type": "module",
8
+ "packageManager": "pnpm@9.9.0",
9
+ "scripts": {
10
+ "build": "pnpm prebuild && pnpm -r build && pnpm postbuild",
11
+ "prebuild": "node scripts/prebuild.js",
12
+ "postbuild": "node scripts/versions.js"
25
13
  },
26
- "type": "commonjs",
27
- "devDependencies": {
28
- "jest": "^29.7.0",
29
- "mock-fs": "^5.2.0"
14
+ "workspaces": [
15
+ "packages/*"
16
+ ],
17
+ "engines": {
18
+ "node": ">= 18"
30
19
  }
31
20
  }
@@ -0,0 +1,53 @@
1
+ # T-Soft CLI
2
+
3
+ T-Soft CLI, T-Soft temalarıyla çalışmak için geliştirilmiş bir komut satırı aracıdır. Bu kılavuz, T-Soft CLI'nin nasıl kullanılacağını adım adım açıklamaktadır.
4
+
5
+ ## Gereksinimler
6
+
7
+ - Node.js (v18.0.0 veya üstü)
8
+ - NPM veya Yarn
9
+
10
+ ## Kurulum
11
+
12
+ 1. Proje dosyalarını bilgisayarınıza indirin.
13
+ 2. Proje dizinine gidin ve gerekli bağımlılıkları yükleyin:
14
+
15
+ ```sh
16
+ npm install tsoft-cli
17
+ ```
18
+
19
+ veya
20
+
21
+ ```sh
22
+ yarn add tsoft-cli
23
+ ```
24
+
25
+ 3. Veya global olarak yükleyin:
26
+
27
+ ```sh
28
+ npm install -g tsoft-cli
29
+ ```
30
+
31
+ veya
32
+
33
+ ```sh
34
+ yarn global add tsoft-cli
35
+ ```
36
+
37
+ ## Başlatma
38
+
39
+ CLI uygulamasını başlatmak için aşağıdaki komutu kullanın:
40
+
41
+ ```sh
42
+ npx tsoft-cli
43
+ ```
44
+
45
+ veya global olarak yüklediyseniz:
46
+
47
+ ```sh
48
+ tsoft-cli
49
+ ```
50
+
51
+ ## İletişim ve Destek
52
+
53
+ Bu kılavuz, T-Soft CLI'nin temel kullanımını ve işlevlerini kapsar. Daha fazla bilgi için proje dosyalarına göz atabilirsiniz. İyi çalışmalar!
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
+
3
+ import { execute } from '@oclif/core'
4
+
5
+ await execute({ development: true, dir: import.meta.url })
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execute } from '@oclif/core'
4
+
5
+ await execute({ dir: import.meta.url })
@@ -0,0 +1,4 @@
1
+ import fs from 'node:fs'
2
+ import path from 'node:path'
3
+
4
+ export const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'))
@@ -0,0 +1,11 @@
1
+ import theme from '@tsoft-cli/theme'
2
+ import { CLIAllCommands, VersionCommand } from '@tsoft-cli/shared'
3
+ import { packageJson } from './enums.js'
4
+
5
+ VersionCommand.version = packageJson.version
6
+
7
+ export const COMMANDS = {
8
+ ...theme,
9
+ [CLIAllCommands.cliTopic]: CLIAllCommands,
10
+ [VersionCommand.cliTopic]: VersionCommand,
11
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "tsoft-cli",
3
+ "version": "2.0.0",
4
+ "description": "T-Soft CLI Application",
5
+ "author": "T-Soft",
6
+ "license": "ISC",
7
+ "type": "module",
8
+ "packageManager": "pnpm@9.9.0",
9
+ "main": "/build/index.js",
10
+ "types": "/build/index.d.ts",
11
+ "bin": {
12
+ "tsoft-cli": "./bin/run.js"
13
+ },
14
+ "scripts": {
15
+ "build": "tsc"
16
+ },
17
+ "dependencies": {
18
+ "@oclif/core": "4.0.21",
19
+ "@tsoft-cli/theme": "1.0.0",
20
+ "@tsoft-cli/shared": "1.0.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^22.5.2",
24
+ "ts-node": "^10.9.2",
25
+ "typescript": "^5.5.4"
26
+ },
27
+ "oclif": {
28
+ "bin": "tsoft-cli",
29
+ "dirname": "tsoft-cli",
30
+ "commands": {
31
+ "strategy": "explicit",
32
+ "target": "./build/index.js",
33
+ "identifier": "COMMANDS"
34
+ },
35
+ "topicSeparator": " ",
36
+ "topics": {
37
+ "theme": {
38
+ "description": "Tema işlemleri"
39
+ }
40
+ }
41
+ },
42
+ "files": [
43
+ "build"
44
+ ],
45
+ "exports": {
46
+ ".": {
47
+ "import": "./build/index.js",
48
+ "types": "./build/index.d.ts"
49
+ }
50
+ },
51
+ "engines": {
52
+ "node": ">= 18"
53
+ },
54
+ "homepage": "https://github.com/tekrom/tsoft-cli/tree/main/packages/cli",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/tekrom/tsoft-cli.git"
58
+ }
59
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "build"
5
+ },
6
+ "include": [
7
+ "**/*"
8
+ ]
9
+ }
@@ -0,0 +1,6 @@
1
+ export * from './src/commands/cli-all-commands.js'
2
+ export * from './src/commands/version-command.js'
3
+ export * from './src/unzip.js'
4
+ export * from './src/open.js'
5
+ export * from './src/cli-progress.js'
6
+ export * from './src/consola.js'
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@tsoft-cli/shared",
3
+ "version": "1.0.0",
4
+ "description": "T-Soft CLI utils.",
5
+ "author": "T-Soft",
6
+ "license": "ISC",
7
+ "type": "module",
8
+ "main": "/build/index.js",
9
+ "types": "/build/index.d.ts",
10
+ "scripts": {
11
+ "build": "tsc"
12
+ },
13
+ "dependencies": {
14
+ "@oclif/core": "4.0.21",
15
+ "@oclif/plugin-commands": "^4.0.15",
16
+ "cli-progress": "^3.12.0",
17
+ "consola": "^3.2.3",
18
+ "open": "^10.1.0",
19
+ "unzipper": "^0.12.1"
20
+ },
21
+ "devDependencies": {
22
+ "@types/cli-progress": "^3.11.6",
23
+ "@types/node": "^22.5.2",
24
+ "@types/unzipper": "^0.10.10",
25
+ "ts-node": "^10.9.2",
26
+ "typescript": "^5.5.4"
27
+ },
28
+ "files": [
29
+ "build"
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "import": "./build/index.js",
34
+ "types": "./build/index.d.ts"
35
+ }
36
+ },
37
+ "engines": {
38
+ "node": ">= 18"
39
+ },
40
+ "homepage": "https://github.com/tekrom/tsoft-cli/tree/main/packages/shared",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/tekrom/tsoft-cli.git"
44
+ }
45
+ }
@@ -0,0 +1,3 @@
1
+ import progress from 'cli-progress'
2
+
3
+ export const cliProgress = progress
@@ -0,0 +1,6 @@
1
+ import { commands } from '@oclif/plugin-commands'
2
+
3
+ export class CLIAllCommands extends commands.commands {
4
+ static cliTopic = 'commands' as const
5
+ static override description = 'Bütün komutları listele'
6
+ }
@@ -0,0 +1,12 @@
1
+ import { Command } from '@oclif/core'
2
+
3
+ export class VersionCommand extends Command {
4
+ static cliTopic: 'version' = 'version'
5
+ static version = ''
6
+ static override description = 'T-Soft CLI sürümü'
7
+
8
+ public async run(): Promise<void> {
9
+ await this.parse(VersionCommand)
10
+ console.log(VersionCommand.version)
11
+ }
12
+ }
@@ -0,0 +1 @@
1
+ export { consola } from 'consola'
@@ -0,0 +1,3 @@
1
+ import open from 'open'
2
+
3
+ export const openBrowser = open
@@ -0,0 +1,15 @@
1
+ import fs from 'node:fs'
2
+ import unzipper from 'unzipper'
3
+
4
+ export function unZIP(zipFilePath: string, extractToDir: string): Promise<boolean> {
5
+ return new Promise((resolve, reject) => {
6
+ fs.createReadStream(zipFilePath)
7
+ .pipe(unzipper.Extract({ path: extractToDir }))
8
+ .on('close', () => {
9
+ return resolve(true)
10
+ })
11
+ .on('error', () => {
12
+ return reject(false)
13
+ })
14
+ })
15
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "build"
5
+ },
6
+ "include": [
7
+ "**/*"
8
+ ]
9
+ }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
+
3
+ import { execute } from '@oclif/core'
4
+
5
+ await execute({ development: true, dir: import.meta.url })
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execute } from '@oclif/core'
4
+
5
+ await execute({ dir: import.meta.url })
@@ -0,0 +1,21 @@
1
+ import { CLIAllCommands, VersionCommand } from '@tsoft-cli/shared'
2
+ import ThemeCreate from './src/commands/theme/create.js'
3
+ import ThemeDev from './src/commands/theme/dev.js'
4
+ import ThemePull from './src/commands/theme/pull.js'
5
+ import ThemeDeleteSite from './src/commands/theme/delete-site.js'
6
+ import ThemeDeleteTheme from './src/commands/theme/delete-theme.js'
7
+ import { packageJson } from './src/enums.js'
8
+
9
+ VersionCommand.version = packageJson.version
10
+
11
+ export const COMMANDS = {
12
+ [CLIAllCommands.cliTopic]: CLIAllCommands,
13
+ [VersionCommand.cliTopic]: VersionCommand,
14
+ [`theme:${ThemeCreate.cliTopic}`]: ThemeCreate,
15
+ [`theme:${ThemeDev.cliTopic}`]: ThemeDev,
16
+ [`theme:${ThemePull.cliTopic}`]: ThemePull,
17
+ [`theme:${ThemeDeleteSite.cliTopic}`]: ThemeDeleteSite,
18
+ [`theme:${ThemeDeleteTheme.cliTopic}`]: ThemeDeleteTheme,
19
+ }
20
+
21
+ export default COMMANDS
@@ -0,0 +1,3 @@
1
+ export default {
2
+ testEnvironment: 'node',
3
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@tsoft-cli/theme",
3
+ "version": "1.0.0",
4
+ "description": "A theme development cli for developers who want to create themes for T-Soft.",
5
+ "author": "T-Soft",
6
+ "license": "ISC",
7
+ "type": "module",
8
+ "main": "/build/index.js",
9
+ "types": "/build/index.d.ts",
10
+ "bin": {
11
+ "tsoft-theme": "./bin/run.js"
12
+ },
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "test": "jest"
16
+ },
17
+ "dependencies": {
18
+ "@inquirer/prompts": "^5.5.0",
19
+ "@oclif/core": "4.0.21",
20
+ "@tsoft-cli/shared": "1.0.0",
21
+ "axios": "^1.7.7",
22
+ "chokidar": "^3.6.0",
23
+ "figlet": "^1.7.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/figlet": "^1.5.8",
27
+ "@types/node": "^22.5.2",
28
+ "jest": "^29.7.0",
29
+ "mock-fs": "^5.2.0",
30
+ "ts-node": "^10.9.2",
31
+ "typescript": "^5.5.4"
32
+ },
33
+ "oclif": {
34
+ "bin": "tsoft-theme",
35
+ "commands": {
36
+ "strategy": "explicit",
37
+ "target": "./build/index.js",
38
+ "identifier": "COMMANDS"
39
+ },
40
+ "dirname": "tsoft-theme",
41
+ "topicSeparator": " ",
42
+ "topics": {
43
+ "theme": {
44
+ "description": "Tema işlemleri"
45
+ }
46
+ }
47
+ },
48
+ "files": [
49
+ "bin",
50
+ "build"
51
+ ],
52
+ "exports": {
53
+ ".": {
54
+ "import": "./build/index.js",
55
+ "types": "./build/index.d.ts"
56
+ }
57
+ },
58
+ "engines": {
59
+ "node": ">= 18"
60
+ },
61
+ "homepage": "https://github.com/tekrom/tsoft-cli/tree/main/packages/theme",
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/tekrom/tsoft-cli.git"
65
+ }
66
+ }
@@ -0,0 +1,51 @@
1
+ import { Command } from '@oclif/core'
2
+ import { consola } from '@tsoft-cli/shared'
3
+ import { CreateTheme } from '../../services/CreateTheme.js'
4
+ import { getLocalSites, saveThemeData, saveThemeTxt, slugify } from '../../utils/utils.js'
5
+ import { clearScreen, displayAsciiArt } from '../../utils/screen.js'
6
+ import { StartTheme } from '../../services/StartTheme.js'
7
+ import { Tsoft } from '../../services/Tsoft.js'
8
+ import { menuSelections } from '../../enums.js'
9
+
10
+ export default class ThemeCreate extends Command {
11
+ static cliTopic = menuSelections.create.cliTopic
12
+ static override description = menuSelections.create.description
13
+
14
+ public async run(): Promise<void> {
15
+ await this.parse(ThemeCreate)
16
+
17
+ clearScreen()
18
+ await displayAsciiArt()
19
+
20
+ const createCommand = new CreateTheme()
21
+ const sites = getLocalSites()
22
+ const siteName = await createCommand.selectSite(sites)
23
+ if (!siteName) {
24
+ return
25
+ }
26
+
27
+ const { themeName, author, version } = await createCommand.getThemeDetails()
28
+ const themeNameSlug = slugify(themeName)
29
+ const themePath = await createCommand.createThemeDirectory(siteName, themeNameSlug)
30
+ saveThemeTxt(themePath, {
31
+ site: siteName,
32
+ name: themeName,
33
+ author: author,
34
+ version: version,
35
+ })
36
+
37
+ clearScreen()
38
+ consola.success(`Tema '${themeName}' başarıyla oluşturuldu.`)
39
+
40
+ const tsoft = new Tsoft(siteName)
41
+ const startTheme = new StartTheme(tsoft)
42
+ await startTheme.start(themeNameSlug, true)
43
+
44
+ saveThemeData(themePath, {
45
+ site: siteName,
46
+ name: themeName,
47
+ author: author,
48
+ version: version,
49
+ })
50
+ }
51
+ }