oraksoft-node-tools 0.1.5 → 0.1.6
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/.env +2 -2
- package/README.md +2 -1
- package/bin/orak-env-dev-change.js +1 -1
- package/lib/deploy-ftp.js +5 -15
- package/lib/deploy-zip.js +23 -1
- package/orak-config.json +0 -1
- package/package.json +1 -1
package/.env
CHANGED
package/README.md
CHANGED
|
@@ -96,10 +96,11 @@ osf_ftp_user=username
|
|
|
96
96
|
osf_ftp_password=password
|
|
97
97
|
osf_ftp_secure=false
|
|
98
98
|
osf_local_file=orak-deploy-zip.tar.gz
|
|
99
|
-
|
|
99
|
+
osf_remote_path=/public_html
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
- `osf_local_file` belirtilmezse, `orak-config.json`'daki `fiDeployZipFile` değeri kullanılır
|
|
103
|
+
- `osf_remote_path` uzak sunucudaki hedef klasör yolunu belirtir, dosya adı otomatik olarak `osf_local_file`'dan alınır
|
|
103
104
|
|
|
104
105
|
**❗ Güvenlik Notları:**
|
|
105
106
|
- `.env` dosyası zaten .gitignore'da bulunuyor
|
package/lib/deploy-ftp.js
CHANGED
|
@@ -22,17 +22,6 @@ export async function deployFtp() {
|
|
|
22
22
|
|
|
23
23
|
const projectRoot = process.cwd();
|
|
24
24
|
|
|
25
|
-
// orak-config.json dosyasını oku
|
|
26
|
-
const configPath = path.join(projectRoot, 'orak-config.json');
|
|
27
|
-
let deployZipFile = 'deploy';
|
|
28
|
-
|
|
29
|
-
if (fs.existsSync(configPath)) {
|
|
30
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
31
|
-
if (config.fiDeployZipFile) {
|
|
32
|
-
deployZipFile = config.fiDeployZipFile;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
25
|
// .env dosyasını oku
|
|
37
26
|
const envPath = path.join(projectRoot, '.env');
|
|
38
27
|
|
|
@@ -45,8 +34,8 @@ osf_ftp_host=ftp.example.com
|
|
|
45
34
|
osf_ftp_user=username
|
|
46
35
|
osf_ftp_password=password
|
|
47
36
|
osf_ftp_secure=false
|
|
48
|
-
osf_local_file
|
|
49
|
-
|
|
37
|
+
osf_local_file=deploy.tar.gz
|
|
38
|
+
osf_remote_path=/public_html
|
|
50
39
|
`);
|
|
51
40
|
process.exit(1);
|
|
52
41
|
}
|
|
@@ -69,10 +58,11 @@ osf_remote_file=/path/to/remote/file.tar.gz
|
|
|
69
58
|
const ftpUser = envVars.osf_ftp_user;
|
|
70
59
|
const ftpPassword = envVars.osf_ftp_password;
|
|
71
60
|
const ftpSecure = envVars.osf_ftp_secure === 'true';
|
|
72
|
-
const localFileName = envVars.osf_local_file ||
|
|
73
|
-
const
|
|
61
|
+
const localFileName = envVars.osf_local_file || 'deploy.tar.gz';
|
|
62
|
+
const remotePath = envVars.osf_remote_path || '/';
|
|
74
63
|
|
|
75
64
|
let localFilePath1 = path.join(projectRoot, "dist", localFileName);
|
|
65
|
+
let remoteFilePath1 = path.posix.join(remotePath, localFileName);
|
|
76
66
|
|
|
77
67
|
if (!ftpHost || !ftpUser || !ftpPassword) {
|
|
78
68
|
console.error("Error: FTP bilgileri eksik. .env.oraksoft dosyasında osf_ftp_host, osf_ftp_user ve osf_ftp_password alanlarını kontrol edin.");
|
package/lib/deploy-zip.js
CHANGED
|
@@ -23,6 +23,29 @@ export async function deployZip() {
|
|
|
23
23
|
// Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
|
|
24
24
|
const projectRoot = process.cwd();
|
|
25
25
|
|
|
26
|
+
// .env dosyasını oku
|
|
27
|
+
const envPath = path.join(projectRoot, '.env');
|
|
28
|
+
let archiveName = 'deploy.tar.gz';
|
|
29
|
+
|
|
30
|
+
if (fs.existsSync(envPath)) {
|
|
31
|
+
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
32
|
+
const envVars = {};
|
|
33
|
+
|
|
34
|
+
envContent.split('\n').forEach(line => {
|
|
35
|
+
const trimmedLine = line.trim();
|
|
36
|
+
if (trimmedLine && !trimmedLine.startsWith('#')) {
|
|
37
|
+
const [key, ...valueParts] = trimmedLine.split('=');
|
|
38
|
+
if (key && valueParts.length > 0) {
|
|
39
|
+
envVars[key.trim()] = valueParts.join('=').trim();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (envVars.osf_local_file) {
|
|
45
|
+
archiveName = envVars.osf_local_file;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
26
49
|
// orak-config.json dosyasını oku
|
|
27
50
|
const configPath = path.join(projectRoot, 'orak-config.json');
|
|
28
51
|
|
|
@@ -42,7 +65,6 @@ export async function deployZip() {
|
|
|
42
65
|
|
|
43
66
|
// dist klasörü ve arşiv adı
|
|
44
67
|
const distDir = path.resolve(projectRoot, 'dist');
|
|
45
|
-
const archiveName = config.fiDeployZipFile ? `${config.fiDeployZipFile}.tar.gz` : 'deploy.tar.gz';
|
|
46
68
|
const archivePath = path.join(distDir, archiveName);
|
|
47
69
|
|
|
48
70
|
// dist klasörü yoksa oluştur
|
package/orak-config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oraksoft-node-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "CLI araçları koleksiyonu - orak-copy-deps, orak-deploy-ftp, orak-deploy-zip, orak-env-change ve orak-env-dev-change komutları",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|