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.
@@ -1,79 +0,0 @@
1
- import { Client } from "basic-ftp";
2
- import path from "path";
3
- import fs from 'fs';
4
-
5
- export async function deployFtp() {
6
- const projectRoot = process.cwd();
7
-
8
- // Önce environment variables'ı kontrol et
9
- let ftpHost = process.env.ORAK_FTP_HOST;
10
- let ftpUser = process.env.ORAK_FTP_USER;
11
- let ftpPassword = process.env.ORAK_FTP_PASSWORD;
12
- let ftpSecure = process.env.ORAK_FTP_SECURE === 'true';
13
- let localFilePath = process.env.ORAK_LOCAL_FILE;
14
- let remoteFilePath = process.env.ORAK_REMOTE_FILE;
15
-
16
- // Eğer env variables yoksa, .env.oraksoft'a fallback et
17
- if (!ftpHost || !ftpUser || !ftpPassword) {
18
- const oraksoftJsonPath = path.join(projectRoot, '.env.oraksoft');
19
-
20
- if (fs.existsSync(oraksoftJsonPath)) {
21
- console.log("⚠️ Environment variables bulunamadı, .env.oraksoft dosyasından okuyorum...");
22
- const oraksoftJson = JSON.parse(fs.readFileSync(oraksoftJsonPath, 'utf-8'));
23
-
24
- ftpHost = ftpHost || oraksoftJson.osf_ftp_host;
25
- ftpUser = ftpUser || oraksoftJson.osf_ftp_user;
26
- ftpPassword = ftpPassword || oraksoftJson.osf_ftp_password;
27
- ftpSecure = ftpSecure || oraksoftJson.osf_ftp_secure || false;
28
- localFilePath = localFilePath || oraksoftJson.osf_ftp_local_file;
29
- remoteFilePath = remoteFilePath || oraksoftJson.osf_remote_file;
30
- }
31
- } else {
32
- console.log("✅ Environment variables kullanılıyor (güvenli)");
33
- }
34
-
35
- if (!ftpHost || !ftpUser || !ftpPassword) {
36
- console.error(`
37
- ❌ FTP bilgileri bulunamadı!
38
-
39
- Güvenli yöntem (önerilen):
40
- set ORAK_FTP_HOST=ftp.example.com
41
- set ORAK_FTP_USER=username
42
- set ORAK_FTP_PASSWORD=password
43
- set ORAK_FTP_SECURE=false
44
- set ORAK_LOCAL_FILE=deployphp25.tar.gz
45
- set ORAK_REMOTE_FILE=/path/to/remote/file.tar.gz
46
-
47
- Alternatif: .env.oraksoft dosyası oluşturun.
48
- `);
49
- process.exit(1);
50
- }
51
-
52
- const client = new Client();
53
- client.ftp.verbose = true;
54
-
55
- try {
56
- await client.access({
57
- host: ftpHost,
58
- user: ftpUser,
59
- password: ftpPassword,
60
- secure: ftpSecure
61
- });
62
-
63
- const fullLocalPath = path.join(projectRoot, "dist", localFilePath);
64
-
65
- if (!fs.existsSync(fullLocalPath)) {
66
- console.error(`Error: Yerel dosya bulunamadı: ${fullLocalPath}`);
67
- process.exit(1);
68
- }
69
-
70
- console.log(`Yükleniyor: ${fullLocalPath} -> ${remoteFilePath}`);
71
- await client.uploadFrom(fullLocalPath, remoteFilePath);
72
- console.log("✅ FTP yükleme tamamlandı!");
73
- }
74
- catch(err) {
75
- console.error("❌ FTP Hatası:", err);
76
- process.exit(1);
77
- }
78
- client.close();
79
- }
File without changes