oraksoft-node-tools 0.1.18 → 0.1.38

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.
@@ -0,0 +1,4 @@
1
+ {
2
+ "oa1TxVersion": "0.1.37",
3
+ "oa1TxUrl": "https://entegre.oraksoft.tr/deploy_0_1_37_4yqzxeio.tar.gz"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "oa1TxVersion": "0.1.25",
3
+ "oa1RemoteFile": "temp/test-0_1_25_c2jsfdui.txt"
4
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
File without changes
File without changes
package/README.md CHANGED
@@ -93,14 +93,23 @@ orak-deploy-ftp [--profile <name>] [--v]
93
93
 
94
94
  **Gerekli .env.orakconfig dosyası:**
95
95
 
96
- ```env
96
+ ```bash
97
97
  osf_ftp_host=ftp.example.com
98
98
  osf_ftp_user=username
99
99
  osf_ftp_password=password
100
100
  osf_ftp_secure=false
101
+
102
+ ```
103
+
104
+ **Gerekli orak-config.json dosyası:**
105
+
106
+ ```bash
101
107
  osf_ftp_local_file=deploy.tar.gz
102
108
  osf_ftp_remote_path=public_html
103
- ```
109
+ osf_ftp_remote_abs_path=https://entegre.oraksoft.tr/
110
+
111
+ ```
112
+
104
113
 
105
114
  - `osf_ftp_host`: FTP sunucusunun adresi
106
115
  - `osf_ftp_user`: FTP kullanıcı adı
@@ -108,27 +117,31 @@ osf_ftp_remote_path=public_html
108
117
  - `osf_ftp_secure`: `true` FTPS kullanır, `false` FTP kullanır (varsayılan: `false`)
109
118
  - `osf_ftp_local_file`: Yüklenmek istenen dosyanın proje köküne göre yolu (**uzantılı** olarak yazın, ör: `deploy.tar.gz`)
110
119
  - `osf_ftp_remote_path`: Uzak sunucudaki hedef klasör yolu (varsayılan: `/`)
111
- - Dosya adı otomatik olarak `osf_ftp_local_file`'ın son bölümünden alınır
120
+ - - `osf_ftp_remote_url`: meta dosyasına konulacak url adresi, buraya dosya adı eklenir
121
+
122
+ Not: Dosya adı otomatik olarak `osf_ftp_local_file`'ın son bölümünden alınır
112
123
 
113
124
  Ek opsiyonlar:
114
125
 
115
- - `--profile <name>`: Belirtilen profil için önce `osf_ftp_local_file_<name>` (veya `orak-config.json` içinde aynı anahtar) aranır. Örnek: `--profile test` -> `osf_ftp_local_file_test`. Konsolda: `test profil uygulandı.`
126
+ - `--profile <profil_name>`: Belirtilen profil için önce `osf_ftp_local_file_<profil_name>` (veya `orak-config.json` içinde aynı anahtar) aranır. Örnek: `--profile test` -> `osf_ftp_local_file_test`. Konsolda: `test profil uygulandı.`
116
127
 
117
128
  - `--v`: Paket sürümünü (`package.json` içindeki `version`) dosya adına ekler. Noktalar `_` ile değiştirilecek (örn. `1.2.3` -> `1_2_3`) ve çok parçalı uzantılar korunacaktır (`deploy.tar.gz` -> `deploy-1_2_3.tar.gz`). Konsolda: `📦 Versiyon eklendi: 1_2_3` ve `📄 Güncel dosya adı: ...`
118
129
 
130
+ - `--meta`: Meta bilgi json dosyasını üretir
131
+
119
132
  **❗ Güvenlik Notları:**
120
133
  - `.env.orakconfig` dosyası zaten .gitignore'da bulunuyor
121
134
  - Web sunucunuzda `.env.orakconfig` dosyalarına erişimi engelleyin (.htaccess)
122
135
  - Dosya izinlerini kısıtlayın: `chmod 600 .env.orakconfig`
123
136
 
124
- 📝 `osf_ftp_host, osf_ftp_local_file` ve `osf_ftp_remote_path` değerleri `orak-config.json` içinde de tanımlanabilir. `.env.orakconfig`'de yoksa `orak-config.json`'a bakar. Profil kullanılıyorsa `osf_ftp_local_file_<profile>` anahtarı da desteklenir.
137
+ 📝 Profil kullanılıyorsa `osf_ftp_local_file_<profile>` anahtarı ile aranır.
125
138
 
126
139
  ### orak-zip-content
127
140
 
128
- Belirtilen dosya ve klasörleri tar.gz formatında arşivler.
141
+ Belirtilen dosya ve klasörleri tar.gz veya ZIP formatında arşivler.
129
142
 
130
143
  ```bash
131
- orak-zip-content [--profile <name>] [--v]
144
+ orak-zip-content [--profile <name>] [--v] [--zip]
132
145
  ```
133
146
 
134
147
  **Gerekli orak-config.json ayarları:**
@@ -141,7 +154,7 @@ orak-zip-content [--profile <name>] [--v]
141
154
  ```
142
155
 
143
156
  - `zip_content`: Arşive dahil edilecek dosya ve klasörler
144
- - `zip_content_out_file`: Oluşturulacak arşiv dosyasının tam yolu (**uzantısız**; `.tar.gz` kod tarafından eklenir)
157
+ - `zip_content_out_file`: Oluşturulacak arşiv dosyasının tam yolu (**uzantısız**; `.tar.gz` veya `.zip` kod tarafından eklenir)
145
158
 
146
159
  Ek opsiyonlar:
147
160
 
@@ -149,12 +162,26 @@ Ek opsiyonlar:
149
162
 
150
163
  - `--v`: Paket sürümünü (`package.json` içindeki `version`) dosya adına ekler; noktalar `_` ile değişir ve dosya uzantısı korunur (örn. `.orak-dist/deploy` -> `.orak-dist/deploy-1_2_3.tar.gz`). Konsolda: `📦 Versiyon eklendi: 1_2_3`
151
164
 
165
+ - `--zip, -z`: ZIP formatında arşiv oluşturur. Varsayılan format tar.gz'dir (örn: `.orak-dist/deploy` -> `.orak-dist/deploy-1_2_3.zip`).
166
+
167
+ **Kullanım Örnekleri:**
168
+ ```bash
169
+ # tar.gz formatında arşiv oluştur
170
+ orak-zip-content -v
171
+
172
+ # ZIP formatında arşiv oluştur
173
+ orak-zip-content -z -v
174
+
175
+ # Profil ile ZIP formatında
176
+ orak-zip-content --zip --profile production -v
177
+ ```
178
+
152
179
  ### orak-zip-package
153
180
 
154
- Belirtilen dosya ve klasörleri tar.gz formatında paket arşivi olarak oluşturur.
181
+ Belirtilen dosya ve klasörleri tar.gz veya ZIP formatında paket arşivi olarak oluşturur.
155
182
 
156
183
  ```bash
157
- orak-zip-package [--profile <name>] [--v]
184
+ orak-zip-package [--profile <name>] [--v] [--zip]
158
185
  ```
159
186
 
160
187
  **Gerekli orak-config.json ayarları:**
@@ -167,7 +194,7 @@ orak-zip-package [--profile <name>] [--v]
167
194
  ```
168
195
 
169
196
  - `zip_package`: Paket arşivine dahil edilecek dosya ve klasörler
170
- - `zip_package_out_file`: Oluşturulacak paket arşiv dosyasının tam yolu (**uzantısız**; `.tar.gz` kod tarafından eklenir)
197
+ - `zip_package_out_file`: Oluşturulacak paket arşiv dosyasının tam yolu (**uzantısız**; `.tar.gz` veya `.zip` kod tarafından eklenir)
171
198
 
172
199
  Ek opsiyonlar:
173
200
 
@@ -175,6 +202,20 @@ Ek opsiyonlar:
175
202
 
176
203
  - `--v`: Paket sürümünü (`package.json` içindeki `version`) dosya adına ekler; noktalar `_` ile değişir ve dosya uzantısı korunur (örn. `.orak-dist/deploy1` -> `.orak-dist/deploy1-1_2_3.tar.gz`).
177
204
 
205
+ - `--zip, -z`: ZIP formatında paket arşivi oluşturur. Varsayılan format tar.gz'dir (örn: `.orak-dist/deploy1` -> `.orak-dist/deploy1-1_2_3.zip`).
206
+
207
+ **Kullanım Örnekleri:**
208
+ ```bash
209
+ # tar.gz formatında paket oluştur
210
+ orak-zip-package -v
211
+
212
+ # ZIP formatında paket oluştur
213
+ orak-zip-package -z -v
214
+
215
+ # Profil ile ZIP formatında
216
+ orak-zip-package --zip --profile production -v
217
+ ```
218
+
178
219
  ### orak-env-change
179
220
  Ortam dosyalarını (.env) değiştirir.
180
221
 
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { deployFtpFiles } from '../lib/deploy-ftp-files.js';
4
+
5
+ deployFtpFiles();
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { deployZipContent } from '../lib/zip-content.js';
3
+ import { makeZipContent } from '../lib/zip-content.js';
4
4
 
5
- deployZipContent();
5
+ makeZipContent();
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { zipPackage } from '../lib/zip-package.js';
3
+ import { makeZipPackage } from '../lib/zip-package.js';
4
4
 
5
- zipPackage();
5
+ makeZipPackage();
package/jsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2020",
4
+ "module": "commonjs",
5
+ "checkJs": true,
6
+ "allowJs": true,
7
+ "moduleResolution": "node",
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "*": ["node_modules/*", "lib/*"]
11
+ }
12
+ },
13
+ "exclude": [
14
+ "node_modules",
15
+ "**/dist",
16
+ "**/build"
17
+ ]
18
+ }
package/lib/copy-deps.js CHANGED
@@ -3,88 +3,94 @@ import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { parseArgs } from './args-parser.js';
5
5
 
6
+ // @ts-ignore
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = path.dirname(__filename);
8
9
 
9
10
  export function copyDeps() {
10
- const args = parseArgs();
11
-
12
- // Argüman kontrolü ve yardım mesajı
13
- if (args.help || args.h) {
14
- // package.json'dan versiyon al
15
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
16
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
17
-
18
- console.log(`orak-copy-deps version ${packageJson.version}`);
19
- console.log('Kullanım: orak-copy-deps');
20
- console.log('Node.js bağımlılıklarınızı belirtilen klasöre kopyalar.');
21
- console.log('Konfigürasyon: orak-config.json dosyasında "copyDepsModulesToCopy" ve "copyDepsLibFolder" ayarları gerekli.');
22
- process.exit(0);
23
- }
11
+ const args = parseArgs();
24
12
 
25
- // Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
26
- const projectRoot = process.cwd();
27
- const srcDir = path.join(projectRoot, 'node_modules');
13
+ // Argüman kontrolü ve yardım mesajı
14
+ if (args.help || args.h) {
15
+ // package.json'dan versiyon al
16
+ const packageJsonPath = path.join(__dirname, '..', 'package.json');
17
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
28
18
 
29
- // orak-config.json dosyasını oku
30
- const configPath = path.join(projectRoot, 'orak-config.json');
31
-
32
- if (!fs.existsSync(configPath)) {
33
- console.error("Error: orak-config.json dosyası bulunamadı. Bu komutu proje kök dizininde çalıştırın.");
34
- process.exit(1);
35
- }
19
+ console.log(`orak-copy-deps version ${packageJson.version}`);
20
+ console.log('Kullanım: orak-copy-deps');
21
+ console.log('Node.js bağımlılıklarınızı belirtilen klasöre kopyalar.');
22
+ console.log('Konfigürasyon: orak-config.json dosyasında "copyDepsModulesToCopy" ve "copyDepsLibFolder" ayarları gerekli.');
23
+ process.exit(0);
24
+ }
25
+
26
+ // Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
27
+ const projectRoot = process.cwd();
28
+ const srcDir = path.join(projectRoot, 'node_modules');
29
+
30
+ // orak-config.json dosyasını oku
31
+ const configPath = path.join(projectRoot, 'orak-config.json');
32
+
33
+ if (!fs.existsSync(configPath)) {
34
+ console.error("Error: orak-config.json dosyası bulunamadı. Bu komutu proje kök dizininde çalıştırın.");
35
+ process.exit(1);
36
+ }
37
+
38
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
36
39
 
37
- const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
40
+ if (!config.copyDepsModulesToCopy || !Array.isArray(config.copyDepsModulesToCopy)) {
41
+ console.error("Error: 'copyDepsModulesToCopy' alanı orak-config.json içinde bir dizi olarak tanımlanmalıdır.");
42
+ process.exit(1);
43
+ }
38
44
 
39
- if (!config.copyDepsModulesToCopy || !Array.isArray(config.copyDepsModulesToCopy)) {
40
- console.error("Error: 'copyDepsModulesToCopy' alanı orak-config.json içinde bir dizi olarak tanımlanmalıdır.");
41
- process.exit(1);
45
+ if (typeof config.copyDepsLibFolder !== "string") {
46
+ console.error("Error: 'copyDepsLibFolder' alanı orak-config.json içinde bir string olarak tanımlanmalıdır.");
47
+ process.exit(1);
48
+ }
49
+
50
+ // copyDepsLibFolder dizinini belirle
51
+ const destDir = path.join(projectRoot, config.copyDepsLibFolder);
52
+
53
+ if (config.copyDepsLibFolderEmpty) {
54
+ if (fs.existsSync(destDir)) {
55
+ fs.rmSync(destDir, { recursive: true, force: true });
56
+ console.log(`Deleted ${destDir} and its contents.`);
42
57
  }
58
+ }
59
+
60
+ // Klasörü oluştur
61
+ if (!fs.existsSync(destDir)) {
62
+ fs.mkdirSync(destDir, { recursive: true });
63
+ }
64
+
65
+ // ** Kopyalanacak dosyaları belirle **
66
+ const modulesToCopy = config.copyDepsModulesToCopy;
67
+
68
+ modulesToCopy.forEach(({ name, file, destFolder }) => {
69
+ const modPath = path.join(srcDir, name, file); // Kaynak dosya
70
+ let moduleDestDir = path.join(destDir, name); // Hedef bağımlılık klasörü
43
71
 
44
- if (typeof config.copyDepsLibFolder !== "string") {
45
- console.error("Error: 'copyDepsLibFolder' alanı orak-config.json içinde bir string olarak tanımlanmalıdır.");
46
- process.exit(1);
72
+ if(destFolder){
73
+ moduleDestDir = path.join(destDir, name, destFolder); // Hedef bağımlılık klasörü
47
74
  }
48
75
 
49
- // copyDepsLibFolder dizinini belirle
50
- const destDir = path.join(projectRoot, config.copyDepsLibFolder);
76
+ let destPath = path.join(moduleDestDir, path.basename(file)); // Hedef dosya
51
77
 
52
- if (config.copyDepsLibFolderEmpty) {
53
- if (fs.existsSync(destDir)) {
54
- fs.rmSync(destDir, { recursive: true, force: true });
55
- console.log(`Deleted ${destDir} and its contents.`);
56
- }
78
+ // Hedef bağımlılık klasörünü oluştur
79
+ if (!fs.existsSync(moduleDestDir)) {
80
+ fs.mkdirSync(moduleDestDir, { recursive: true });
57
81
  }
58
82
 
59
- // Klasörü oluştur
60
- if (!fs.existsSync(destDir)) {
61
- fs.mkdirSync(destDir, { recursive: true });
83
+ if (!fs.existsSync(destPath)) { // Eğer dosya yoksa kopyala
84
+ if (fs.existsSync(modPath)) {
85
+ fs.cpSync(modPath, destPath, { recursive: false });
86
+ console.log(`✅ Copied: ${modPath} → ${destPath}`);
87
+ } else {
88
+ console.error(`❌ Error: ${modPath} not found!`);
89
+ }
90
+ } else {
91
+ console.log(`⚠️ Skipped (already exists): ${destPath}`);
62
92
  }
93
+ });
63
94
 
64
- // 📌 Kopyalanacak dosyaları belirle
65
- const modulesToCopy = config.copyDepsModulesToCopy;
66
-
67
- modulesToCopy.forEach(({ name, file }) => {
68
- const modPath = path.join(srcDir, name, file); // Kaynak dosya
69
- const moduleDestDir = path.join(destDir, name); // Hedef bağımlılık klasörü
70
- const destPath = path.join(moduleDestDir, path.basename(file)); // Hedef dosya
71
-
72
- // Hedef bağımlılık klasörünü oluştur
73
- if (!fs.existsSync(moduleDestDir)) {
74
- fs.mkdirSync(moduleDestDir, { recursive: true });
75
- }
76
-
77
- if (!fs.existsSync(destPath)) { // Eğer dosya yoksa kopyala
78
- if (fs.existsSync(modPath)) {
79
- fs.cpSync(modPath, destPath, { recursive: false });
80
- console.log(`✅ Copied: ${modPath} → ${destPath}`);
81
- } else {
82
- console.error(`❌ Error: ${modPath} not found!`);
83
- }
84
- } else {
85
- console.log(`⚠️ Skipped (already exists): ${destPath}`);
86
- }
87
- });
88
-
89
- console.log("🎉 Dependency sync process completed!");
95
+ console.log("🎉 Dependency sync process completed!");
90
96
  }
package/lib/deploy-ftp.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import { Client } from "basic-ftp";
2
- import path from "path";
2
+ import path, { parse } from "path";
3
3
  import fs from 'fs';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { parseArgs } from './args-parser.js';
6
+ import { addVersionToFilename, appendRandomToFilename, parseEnvContent, parseFileNameAndExtension } from "./osf-node-utils.js";
6
7
 
8
+ // @ts-ignore
7
9
  const __filename = fileURLToPath(import.meta.url);
8
10
  const __dirname = path.dirname(__filename);
9
11
 
@@ -13,10 +15,9 @@ export async function deployFtp() {
13
15
  // Argüman kontrolü ve yardım mesajı
14
16
  if (args.help || args.h) {
15
17
  // package.json'dan versiyon al
16
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
17
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
18
-
19
- console.log(`orak-deploy-ftp version ${packageJson.version}`);
18
+ const pathPackageJsonLib = path.join(__dirname, '..', 'package.json');
19
+ const objPackageJsonLib = JSON.parse(fs.readFileSync(pathPackageJsonLib, 'utf-8'));
20
+ console.log(`orak-deploy-ftp version ${objPackageJsonLib.version}`);
20
21
  console.log('Kullanım: orak-deploy-ftp');
21
22
  console.log('Dist klasöründeki dosyaları FTP sunucusuna yükler.');
22
23
  console.log('Konfigürasyon: .env dosyasında FTP bilgileri gerekli.');
@@ -39,25 +40,13 @@ osf_ftp_host=ftp.example.com
39
40
  osf_ftp_user=username
40
41
  osf_ftp_password=password
41
42
  osf_ftp_secure=false
42
- osf_ftp_local_file=deploy.tar.gz
43
- osf_ftp_remote_path=public_html
44
43
  `);
45
44
  process.exit(1);
46
45
  }
47
46
 
48
47
  // .env.xx dosyasını parse et
49
48
  const envContent = fs.readFileSync(envPath, 'utf-8');
50
- const envVars = {};
51
-
52
- envContent.split('\n').forEach(line => {
53
- const trimmedLine = line.trim();
54
- if (trimmedLine && !trimmedLine.startsWith('#')) {
55
- const [key, ...valueParts] = trimmedLine.split('=');
56
- if (key && valueParts.length > 0) {
57
- envVars[key.trim()] = valueParts.join('=').trim();
58
- }
59
- }
60
- });
49
+ const envVars = parseEnvContent(envContent);
61
50
 
62
51
  let ftpHost = envVars.osf_ftp_host;
63
52
  const ftpUser = envVars.osf_ftp_user;
@@ -66,73 +55,69 @@ osf_ftp_remote_path=public_html
66
55
 
67
56
  // osf_ftp_local_file support with profile suffix (osf_ftp_local_file_{profile})
68
57
  let localFileKey = 'osf_ftp_local_file';
69
- if (args.profile) {
70
- console.log(`${args.profile} profil uygulandı.`);
58
+ let remotePathKey = 'osf_ftp_remote_path';
59
+
60
+ if (args.profile || args.p) {
61
+ args.profile = args.profile || args.p;
62
+ console.log(`🔖 Profil kullanılıyor: ${args.profile}`);
71
63
  localFileKey = localFileKey + '_' + args.profile;
64
+ remotePathKey = remotePathKey + '_' + args.profile;
72
65
  }
73
- let localFileName = envVars[localFileKey] ?? envVars.osf_ftp_local_file;
74
- let remotePath = envVars.osf_ftp_remote_path; // || '/';
75
-
76
- if (!ftpHost || !localFileName || !remotePath) {
77
- const pathOrakConfigJson = path.join(projectRoot, 'orak-config.json');
78
- if (fs.existsSync(pathOrakConfigJson)) {
79
- //orak-config.json dosyasını oku
80
- const jsonOrakConfig = JSON.parse(fs.readFileSync(pathOrakConfigJson, 'utf-8'));
81
- ftpHost = ftpHost ?? jsonOrakConfig.osf_ftp_host;
82
- localFileName = localFileName ?? (jsonOrakConfig[localFileKey] ?? jsonOrakConfig.osf_ftp_local_file);
83
- remotePath = remotePath ?? jsonOrakConfig.osf_ftp_remote_path;
84
- //remotePath = remotePath ?? '/';
85
- }
66
+
67
+ //let localFileName = envVars[localFileKey]; // ?? envVars.osf_ftp_local_file;
68
+ //let remotePath = envVars[remotePathKey]; // || '/';
69
+
70
+ const pathOrakConfigJson = path.join(projectRoot, 'orak-config.json');
71
+
72
+ if (!fs.existsSync(pathOrakConfigJson)) {
73
+ console.error(`
74
+ orak-config.json dosyası bulunamadı!
75
+
76
+ .orak-config.json dosyası oluşturun ve şu bilgileri ekleyin:
77
+ ${localFileKey}=<local_file>
78
+ ${remotePathKey}=<remote_path>
79
+ `);
80
+ process.exit(1);
86
81
  }
87
82
 
83
+ const objOrakConfig = JSON.parse(fs.readFileSync(pathOrakConfigJson, 'utf-8'));
84
+
85
+ //orak-config.json dosyasını oku
86
+ let localFileName = objOrakConfig[localFileKey];
87
+ let remotePath = objOrakConfig[remotePathKey];
88
+
89
+ const pathPackageJsonCurrProj = path.join(projectRoot, 'package.json');
90
+ const objPackageJsonCurrProj = JSON.parse(fs.readFileSync(pathPackageJsonCurrProj, 'utf-8'));
91
+
88
92
  // Eğer --v verilmişse filename uzantısının öncesine versiyon ekle (örn: test-1_2_3.txt veya deploy-1_2_3.tar.gz)
89
93
  if (args.v && localFileName) {
90
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
91
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
92
- const txVersion = packageJson.version.replace(/\./g, '_');
93
-
94
- const parsed = path.parse(localFileName);
95
- const base = parsed.base; // filename with possible multi-part ext
96
-
97
- // Desteklenen çok parçalı uzantılar
98
- const multiExts = ['.tar.gz', '.tar.bz2', '.tar.xz', '.tar.lz', '.tar.Z', '.tgz'];
99
- let ext = parsed.ext;
100
- let nameNoExt = parsed.name;
101
-
102
- for (const me of multiExts) {
103
- if (base.endsWith(me)) {
104
- ext = me;
105
- nameNoExt = base.slice(0, -me.length);
106
- break;
107
- }
108
- }
109
-
110
- const sep = nameNoExt.endsWith('-') || nameNoExt.endsWith('_') ? '' : '-';
111
- const newBase = nameNoExt + sep + txVersion;
112
- localFileName = parsed.dir ? path.join(parsed.dir, newBase + ext) : newBase + ext;
113
94
 
95
+ const txVersion = objPackageJsonCurrProj.version; //.replace(/\./g, '_');
96
+ localFileName = addVersionToFilename(localFileName, txVersion);
97
+
114
98
  console.log(`📦 Versiyon eklendi: ${txVersion}`);
115
99
  console.log(`📄 Güncel dosya adı: ${localFileName}`);
116
100
  }
117
101
 
118
- let localFilePath1 = path.join(projectRoot, localFileName); //"dist"
119
- let remoteFilePath1 = path.posix.join(remotePath, path.basename(localFileName));
102
+ let localFilePath = path.join(projectRoot, localFileName); //"dist"
103
+ // Dosya adının sonuna rastgele karakter ekle (güvenlik için)
104
+ let remoteFilePath = path.posix.join(remotePath, appendRandomToFilename(path.basename(localFileName)));
120
105
 
121
- console.log(`Yerel dosya: ${localFilePath1}`);
122
- console.log(`Remote adres: ${remoteFilePath1}`);
106
+ console.log(`Yerel dosya: ${localFilePath}`);
107
+ console.log(`Remote adres: ${remoteFilePath}`);
123
108
 
124
109
  if (!ftpHost || !ftpUser || !ftpPassword) {
125
110
  console.error("Error: FTP bilgileri eksik. .env.orakconfig dosyasında osf_ftp_host, osf_ftp_user ve osf_ftp_password alanlarını kontrol edin.");
126
111
  process.exit(1);
127
112
  }
128
113
 
129
- if (!remoteFilePath1) {
130
- console.error("Error: FTP bilgileri eksik. .env.orakconfig dosyasında osf_ftp_remote_path alanını kontrol edin.");
114
+ if (!remoteFilePath) {
115
+ console.error("Error: orak-config.json dosyasında osf_ftp_remote_path alanını kontrol edin.");
131
116
  process.exit(1);
132
117
  }
133
118
 
134
- if (!localFilePath1) {
135
- console.error("Error: FTP bilgileri eksik. .env.orakconfig dosyasında osf_ftp_local_file alanını kontrol edin.");
119
+ if (!localFilePath) {
120
+ console.error("Error: orak-config.json dosyasında osf_ftp_local_file alanını kontrol edin.");
136
121
  process.exit(1);
137
122
  }
138
123
 
@@ -147,9 +132,6 @@ osf_ftp_remote_path=public_html
147
132
  secure: ftpSecure
148
133
  });
149
134
 
150
- const localFilePath = localFilePath1;
151
- const remoteFilePath = remoteFilePath1;
152
-
153
135
  if (!fs.existsSync(localFilePath)) {
154
136
  console.error(`Error: Yerel dosya bulunamadı: ${localFilePath}`);
155
137
  process.exit(1);
@@ -158,10 +140,46 @@ osf_ftp_remote_path=public_html
158
140
  console.log(`Yükleniyor: ${localFilePath} -> ${remoteFilePath}`);
159
141
  await client.uploadFrom(localFilePath, remoteFilePath);
160
142
  console.log("✅ FTP yükleme tamamlandı!");
143
+ console.log(`✅ Lokal: ${localFilePath}`);
144
+ console.log(`✅ Remote: ${remoteFilePath}`);
145
+
146
+ // --meta argümanı verilirse yükleme bilgilerini içeren bir JSON dosyası oluştur ve FTP'ye yükler
147
+ if (args.meta) {
148
+
149
+ let objFile = parseFileNameAndExtension(remoteFilePath);
150
+
151
+ let txUrl = objOrakConfig.osf_ftp_remote_url + objFile.name + objFile.ext;
152
+
153
+ let objFileInfo = {
154
+ "oa1TxVersion": objPackageJsonCurrProj.version,
155
+ "oa1TxUrl": txUrl,
156
+ };
157
+
158
+ console.log(`📄 Url : ${txUrl}`);
159
+
160
+ let metaFileName = 'app-deploy-info.jsn';
161
+ // objFileInfo bilgi uploadInfo olarak kaydet
162
+ const pathMetaFile = path.join(projectRoot, '.orak-dist', metaFileName);
163
+ fs.writeFileSync(pathMetaFile, JSON.stringify(objFileInfo, null, 2), 'utf-8');
164
+ //console.log(`📁 FTP yükleme bilgisi kaydedildi: ${uploadInfoPath}`);
165
+
166
+ // app-deploy-info.json dosyası da upload edilir
167
+ await client.uploadFrom(pathMetaFile, path.posix.join(remotePath, metaFileName));
168
+ console.log(`📁 FTP'ye ${metaFileName} dosyası yüklendi: ${path.posix.join(remotePath, metaFileName)}`);
169
+
170
+ }
171
+
172
+
161
173
  }
162
174
  catch (err) {
163
175
  console.error("❌ FTP Hatası:", err);
164
176
  process.exit(1);
165
177
  }
166
178
  client.close();
179
+
180
+
181
+
182
+
183
+
184
+
167
185
  }
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { copyDeps } from './copy-deps.js';
2
2
  export { deployFtp } from './deploy-ftp.js';
3
- export { zipPackage } from './zip-package.js';
4
- export { zipContent } from './zip-content.js';
3
+ export { makeZipPackage } from './zip-package.js';
4
+ export { makeZipContent } from './zip-content.js';
5
5
  export { envChange } from './env-change.js';