oraksoft-node-tools 0.0.2 → 0.0.3

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 ADDED
@@ -0,0 +1,6 @@
1
+ # Development Ortamı
2
+ NODE_ENV=development
3
+ API_URL=http://localhost:3000
4
+ DB_HOST=localhost
5
+ DB_NAME=myapp_dev
6
+ DEBUG=true
package/.env.dev ADDED
@@ -0,0 +1,6 @@
1
+ # Development Ortamı
2
+ NODE_ENV=development
3
+ API_URL=http://localhost:3000
4
+ DB_HOST=localhost
5
+ DB_NAME=myapp_dev
6
+ DEBUG=true
package/.env.example ADDED
@@ -0,0 +1,10 @@
1
+ # FTP Deployment Ayarları
2
+ ftp_host=ftp.example.com
3
+ ftp_user=username
4
+ ftp_password=password
5
+ ftp_secure=false
6
+ local_file=deployphp25.tar.gz
7
+ remote_file=/public_html/deploy.tar.gz
8
+
9
+ # Bu dosyayı gerçek bilgilerinizle güncelleyin
10
+ # Bu dosya .gitignore'da olduğu için version control'e eklenmeyecek
package/.env.prod ADDED
@@ -0,0 +1,6 @@
1
+ # Production Ortamı
2
+ NODE_ENV=production
3
+ API_URL=https://api.myapp.com
4
+ DB_HOST=prod-db-server
5
+ DB_NAME=myapp_prod
6
+ DEBUG=false
@@ -0,0 +1,10 @@
1
+ # .env dosyalarına erişimi engelle
2
+ <Files ".env*">
3
+ Require all denied
4
+ </Files>
5
+
6
+ # Alternatif yöntem
7
+ <FilesMatch "^\.env">
8
+ Order allow,deny
9
+ Deny from all
10
+ </FilesMatch>
@@ -4,5 +4,7 @@
4
4
  "path": ".."
5
5
  }
6
6
  ],
7
- "settings": {}
7
+ "settings": {
8
+ "window.title": "node-tools"
9
+ }
8
10
  }
package/README.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  Node.js projeleriniz için kullanışlı CLI araçları koleksiyonu.
4
4
 
5
+ - [Oraksoft Node Tools](#oraksoft-node-tools)
6
+ - [Kurulum](#kurulum)
7
+ - [Global kurulum (önerilen)](#global-kurulum-önerilen)
8
+ - [Proje bazında kurulum](#proje-bazında-kurulum)
9
+ - [Konfigürasyon](#konfigürasyon)
10
+ - [Komutlar](#komutlar)
11
+ - [orak-copy-deps](#orak-copy-deps)
12
+ - [orak-deploy-ftp](#orak-deploy-ftp)
13
+ - [orak-deploy-zip](#orak-deploy-zip)
14
+ - [orak-env-change](#orak-env-change)
15
+ - [Kullanım Örnekleri](#kullanım-örnekleri)
16
+ - [1. Bağımlılık Kopyalama](#1-bağımlılık-kopyalama)
17
+ - [2. Deployment İşlemi](#2-deployment-i̇şlemi)
18
+ - [3. Ortam Değiştirme](#3-ortam-değiştirme)
19
+ - [Gereksinimler](#gereksinimler)
20
+ - [Lisans](#lisans)
21
+ - [Katkıda Bulunma](#katkıda-bulunma)
22
+ - [Sorun Bildirimi](#sorun-bildirimi)
23
+
24
+
5
25
  ## Kurulum
6
26
 
7
27
  ### Global kurulum (önerilen)
@@ -14,16 +34,39 @@ pnpm install -g oraksoft-node-tools
14
34
  pnpm install oraksoft-node-tools --save-dev
15
35
  ```
16
36
 
37
+ ## Konfigürasyon
38
+
39
+ Bu araçlar `orak-config.json` dosyasını kullanarak konfigüre edilir. Bu dosyayı proje kök dizininizde oluşturun:
40
+
41
+ ```json
42
+ {
43
+ "copyDepsModulesToCopy": [
44
+ {
45
+ "name": "module-name",
46
+ "file": "dist/module.js"
47
+ }
48
+ ],
49
+ "copyDepsLibFolder": "lib",
50
+ "copyDepsLibFolderEmpty": true,
51
+ "fiDeployZipContent": [
52
+ "src/",
53
+ "public/",
54
+ "package.json"
55
+ ],
56
+ "fiEnvChangeStatus": "dev"
57
+ }
58
+ ```
59
+
17
60
  ## Komutlar
18
61
 
19
- ### fi-copy-deps
62
+ ### orak-copy-deps
20
63
  Node.js bağımlılıklarınızı belirtilen klasöre kopyalar.
21
64
 
22
65
  ```bash
23
- fi-copy-deps
66
+ orak-copy-deps
24
67
  ```
25
68
 
26
- **Gerekli package.json ayarları:**
69
+ **Gerekli orak-config.json ayarları:**
27
70
  ```json
28
71
  {
29
72
  "copyDepsModulesToCopy": [
@@ -37,33 +80,36 @@ fi-copy-deps
37
80
  }
38
81
  ```
39
82
 
40
- ### fi-deploy-ftp
83
+ ### orak-deploy-ftp
41
84
  Dist klasöründeki dosyaları FTP sunucusuna yükler.
42
85
 
43
86
  ```bash
44
- fi-deploy-ftp
87
+ orak-deploy-ftp
45
88
  ```
46
89
 
47
- **Gerekli .env.oraksoft ayarları:**
48
- ```json
49
- {
50
- "ftp_host": "ftp.example.com",
51
- "ftp_user": "username",
52
- "ftp_password": "password",
53
- "ftp_secure": false,
54
- "localFilePath": "deployphp25.tar.gz",
55
- "remoteFilePath": "/path/to/remote/file.tar.gz"
56
- }
90
+ **Gerekli .env dosyası:**
91
+ ```env
92
+ ftp_host=ftp.example.com
93
+ ftp_user=username
94
+ ftp_password=password
95
+ ftp_secure=false
96
+ local_file=deployphp25.tar.gz
97
+ remote_file=/path/to/remote/file.tar.gz
57
98
  ```
58
99
 
59
- ### fi-deploy-zip
100
+ **❗ Güvenlik Notları:**
101
+ - `.env` dosyası zaten .gitignore'da bulunuyor
102
+ - Web sunucunuzda `.env` dosyalarına erişimi engelleyin (.htaccess)
103
+ - Dosya izinlerini kısıtlayın: `chmod 600 .env`
104
+
105
+ ### orak-deploy-zip
60
106
  Belirtilen dosya ve klasörleri tar.gz formatında arşivler.
61
107
 
62
108
  ```bash
63
- fi-deploy-zip
109
+ orak-deploy-zip
64
110
  ```
65
111
 
66
- **Gerekli package.json ayarları:**
112
+ **Gerekli orak-config.json ayarları:**
67
113
  ```json
68
114
  {
69
115
  "fiDeployZipContent": [
@@ -74,48 +120,49 @@ fi-deploy-zip
74
120
  }
75
121
  ```
76
122
 
77
- ### fi-env-change
123
+ ### orak-env-change
78
124
  Ortam dosyalarını (.env) değiştirir.
79
125
 
80
126
  ```bash
81
- fi-env-change dev
127
+ orak-env-change dev
82
128
  # veya
83
- fi-env-change production
129
+ orak-env-change production
84
130
  ```
85
131
 
86
- **Opsiyonel package.json ayarları:**
132
+ **Opsiyonel orak-config.json ayarları:**
87
133
  ```json
88
134
  {
89
135
  "fiEnvChangeStatus": "dev"
90
136
  }
91
137
  ```
92
138
 
93
- Bu durumda parametre vermeden `fi-env-change` komutunu çalıştırabilirsiniz.
139
+ Bu durumda parametre vermeden `orak-env-change` komutunu çalıştırabilirsiniz.
94
140
 
95
141
  ## Kullanım Örnekleri
96
142
 
97
143
  ### 1. Bağımlılık Kopyalama
98
144
  ```bash
99
- # package.json'da tanımlanan modülleri kopyala
100
- fi-copy-deps
145
+ # orak-config.json'da tanımlanan modülleri kopyala
146
+ orak-copy-deps
101
147
  ```
102
148
 
103
149
  ### 2. Deployment İşlemi
104
150
  ```bash
151
+ # .env dosyası oluşturun ve FTP bilgilerinizi ekleyin
105
152
  # Önce arşiv oluştur
106
- fi-deploy-zip
153
+ orak-deploy-zip
107
154
 
108
155
  # Sonra FTP'ye yükle
109
- fi-deploy-ftp
156
+ orak-deploy-ftp
110
157
  ```
111
158
 
112
159
  ### 3. Ortam Değiştirme
113
160
  ```bash
114
161
  # Development ortamına geç
115
- fi-env-change dev
162
+ orak-env-change dev
116
163
 
117
164
  # Production ortamına geç
118
- fi-env-change prod
165
+ orak-env-change prod
119
166
  ```
120
167
 
121
168
  ## Gereksinimler
@@ -137,4 +184,4 @@ MIT
137
184
 
138
185
  ## Sorun Bildirimi
139
186
 
140
- Sorunlarınızı [GitHub Issues](https://github.com/oraksoft/oraksoft-node-tools/issues) sayfasından bildirebilirsiniz.
187
+ Sorunlarınızı [GitHub Issues](https://github.com/oraksoftware/oraksoft-node-tools/issues) sayfasından bildirebilirsiniz.
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { copyDeps } from '../lib/copy-deps.js';
4
4
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { deployFtp } from '../lib/deploy-ftp.js';
4
4
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { deployZip } from '../lib/deploy-zip.js';
4
4
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { envChange } from '../lib/env-change.js';
4
4
 
@@ -0,0 +1,77 @@
1
+ import crypto from 'crypto';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ const ENCRYPTION_KEY = process.env.ORAK_ENCRYPTION_KEY; // 32 byte key
6
+ const ALGORITHM = 'aes-256-gcm';
7
+
8
+ export function encryptConfig(config) {
9
+ if (!ENCRYPTION_KEY) {
10
+ throw new Error('ORAK_ENCRYPTION_KEY environment variable gerekli');
11
+ }
12
+
13
+ const iv = crypto.randomBytes(16);
14
+ const cipher = crypto.createCipher(ALGORITHM, ENCRYPTION_KEY);
15
+
16
+ let encrypted = cipher.update(JSON.stringify(config), 'utf8', 'hex');
17
+ encrypted += cipher.final('hex');
18
+
19
+ const authTag = cipher.getAuthTag();
20
+
21
+ return {
22
+ encrypted,
23
+ iv: iv.toString('hex'),
24
+ authTag: authTag.toString('hex')
25
+ };
26
+ }
27
+
28
+ export function decryptConfig(encryptedData) {
29
+ if (!ENCRYPTION_KEY) {
30
+ throw new Error('ORAK_ENCRYPTION_KEY environment variable gerekli');
31
+ }
32
+
33
+ const decipher = crypto.createDecipher(ALGORITHM, ENCRYPTION_KEY);
34
+ decipher.setAuthTag(Buffer.from(encryptedData.authTag, 'hex'));
35
+
36
+ let decrypted = decipher.update(encryptedData.encrypted, 'hex', 'utf8');
37
+ decrypted += decipher.final('utf8');
38
+
39
+ return JSON.parse(decrypted);
40
+ }
41
+
42
+ export function saveEncryptedConfig(config, filePath) {
43
+ const encrypted = encryptConfig(config);
44
+ fs.writeFileSync(filePath, JSON.stringify(encrypted, null, 2));
45
+ }
46
+
47
+ export function loadEncryptedConfig(filePath) {
48
+ if (!fs.existsSync(filePath)) {
49
+ return null;
50
+ }
51
+
52
+ const encryptedData = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
53
+ return decryptConfig(encryptedData);
54
+ }
55
+
56
+ // Konfigürasyon oluşturma utility'si
57
+ export function createEncryptedConfig() {
58
+ const config = {
59
+ ftp_host: "ftp.example.com",
60
+ ftp_user: "username",
61
+ ftp_password: "password",
62
+ ftp_secure: false,
63
+ localFilePath: "deployphp25.tar.gz",
64
+ remoteFilePath: "/path/to/remote/file.tar.gz"
65
+ };
66
+
67
+ const projectRoot = process.cwd();
68
+ const configPath = path.join(projectRoot, '.config.oraksoft.encrypted');
69
+
70
+ try {
71
+ saveEncryptedConfig(config, configPath);
72
+ console.log('✅ Şifreli konfigürasyon oluşturuldu:', configPath);
73
+ console.log('📝 Konfigürasyonu düzenleyin ve ORAK_ENCRYPTION_KEY environment variable\'ını ayarlayın');
74
+ } catch (error) {
75
+ console.error('❌ Şifreli konfigürasyon oluşturulamadı:', error.message);
76
+ }
77
+ }
package/lib/copy-deps.js CHANGED
@@ -2,34 +2,43 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
 
4
4
  export function copyDeps() {
5
+ // Argüman kontrolü ve yardım mesajı
6
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
7
+ console.log('orak-copy-deps version 0.0.3');
8
+ console.log('Kullanım: orak-copy-deps');
9
+ console.log('Node.js bağımlılıklarınızı belirtilen klasöre kopyalar.');
10
+ console.log('Konfigürasyon: orak-config.json dosyasında "copyDepsModulesToCopy" ve "copyDepsLibFolder" ayarları gerekli.');
11
+ process.exit(0);
12
+ }
13
+
5
14
  // Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
6
15
  const projectRoot = process.cwd();
7
16
  const srcDir = path.join(projectRoot, 'node_modules');
8
17
 
9
- // package.json dosyasını oku
10
- const packageJsonPath = path.join(projectRoot, 'package.json');
18
+ // orak-config.json dosyasını oku
19
+ const configPath = path.join(projectRoot, 'orak-config.json');
11
20
 
12
- if (!fs.existsSync(packageJsonPath)) {
13
- console.error("Error: package.json dosyası bulunamadı. Bu komutu bir Node.js projesi klasöründe çalıştırın.");
21
+ if (!fs.existsSync(configPath)) {
22
+ console.error("Error: orak-config.json dosyası bulunamadı. Bu komutu proje kök dizininde çalıştırın.");
14
23
  process.exit(1);
15
24
  }
16
25
 
17
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
26
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
18
27
 
19
- if (!packageJson.copyDepsModulesToCopy || !Array.isArray(packageJson.copyDepsModulesToCopy)) {
20
- console.error("Error: 'copyDepsModulesToCopy' alanı package.json içinde bir dizi olarak tanımlanmalıdır.");
28
+ if (!config.copyDepsModulesToCopy || !Array.isArray(config.copyDepsModulesToCopy)) {
29
+ console.error("Error: 'copyDepsModulesToCopy' alanı orak-config.json içinde bir dizi olarak tanımlanmalıdır.");
21
30
  process.exit(1);
22
31
  }
23
32
 
24
- if (typeof packageJson.copyDepsLibFolder !== "string") {
25
- console.error("Error: 'copyDepsLibFolder' alanı package.json içinde bir string olarak tanımlanmalıdır.");
33
+ if (typeof config.copyDepsLibFolder !== "string") {
34
+ console.error("Error: 'copyDepsLibFolder' alanı orak-config.json içinde bir string olarak tanımlanmalıdır.");
26
35
  process.exit(1);
27
36
  }
28
37
 
29
38
  // copyDepsLibFolder dizinini belirle
30
- const destDir = path.join(projectRoot, packageJson.copyDepsLibFolder);
39
+ const destDir = path.join(projectRoot, config.copyDepsLibFolder);
31
40
 
32
- if (packageJson.copyDepsLibFolderEmpty) {
41
+ if (config.copyDepsLibFolderEmpty) {
33
42
  if (fs.existsSync(destDir)) {
34
43
  fs.rmSync(destDir, { recursive: true, force: true });
35
44
  console.log(`Deleted ${destDir} and its contents.`);
@@ -42,7 +51,7 @@ export function copyDeps() {
42
51
  }
43
52
 
44
53
  // 📌 Kopyalanacak dosyaları belirle
45
- const modulesToCopy = packageJson.copyDepsModulesToCopy;
54
+ const modulesToCopy = config.copyDepsModulesToCopy;
46
55
 
47
56
  modulesToCopy.forEach(({ name, file }) => {
48
57
  const modPath = path.join(srcDir, name, file); // Kaynak dosya
@@ -0,0 +1,79 @@
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.ftp_host;
25
+ ftpUser = ftpUser || oraksoftJson.ftp_user;
26
+ ftpPassword = ftpPassword || oraksoftJson.ftp_password;
27
+ ftpSecure = ftpSecure || oraksoftJson.ftp_secure || false;
28
+ localFilePath = localFilePath || oraksoftJson.localFilePath;
29
+ remoteFilePath = remoteFilePath || oraksoftJson.remoteFilePath;
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
+ }
package/lib/deploy-ftp.js CHANGED
@@ -3,25 +3,57 @@ import path from "path";
3
3
  import fs from 'fs';
4
4
 
5
5
  export async function deployFtp() {
6
- // Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
6
+ // Argüman kontrolü ve yardım mesajı
7
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
8
+ console.log('orak-deploy-ftp version 0.0.3');
9
+ console.log('Kullanım: orak-deploy-ftp');
10
+ console.log('Dist klasöründeki dosyaları FTP sunucusuna yükler.');
11
+ console.log('Konfigürasyon: .env dosyasında FTP bilgileri gerekli.');
12
+ process.exit(0);
13
+ }
14
+
7
15
  const projectRoot = process.cwd();
8
16
 
9
- // Arşivlenecek dosya ve klasörlerin yolları
10
- const oraksoftJsonPath = path.join(projectRoot, '.env.oraksoft');
17
+ // .env dosyasını oku
18
+ const envPath = path.join(projectRoot, '.env');
11
19
 
12
- if (!fs.existsSync(oraksoftJsonPath)) {
13
- console.error("Error: .env.oraksoft dosyası bulunamadı. Bu dosyayı oluşturup FTP bilgilerinizi ekleyin.");
20
+ if (!fs.existsSync(envPath)) {
21
+ console.error(`
22
+ ❌ .env dosyası bulunamadı!
23
+
24
+ .env dosyası oluşturun ve şu bilgileri ekleyin:
25
+ ftp_host=ftp.example.com
26
+ ftp_user=username
27
+ ftp_password=password
28
+ ftp_secure=false
29
+ local_file=deployphp25.tar.gz
30
+ remote_file=/path/to/remote/file.tar.gz
31
+ `);
14
32
  process.exit(1);
15
33
  }
16
34
 
17
- const oraksoftJson = JSON.parse(fs.readFileSync(oraksoftJsonPath, 'utf-8'));
35
+ // .env dosyasını parse et
36
+ const envContent = fs.readFileSync(envPath, 'utf-8');
37
+ const envVars = {};
38
+
39
+ envContent.split('\n').forEach(line => {
40
+ const trimmedLine = line.trim();
41
+ if (trimmedLine && !trimmedLine.startsWith('#')) {
42
+ const [key, ...valueParts] = trimmedLine.split('=');
43
+ if (key && valueParts.length > 0) {
44
+ envVars[key.trim()] = valueParts.join('=').trim();
45
+ }
46
+ }
47
+ });
48
+
49
+ const ftpHost = envVars.ftp_host;
50
+ const ftpUser = envVars.ftp_user;
51
+ const ftpPassword = envVars.ftp_password;
52
+ const ftpSecure = envVars.ftp_secure === 'true';
53
+ const localFileName = envVars.local_file;
54
+ const remoteFilePath1 = envVars.remote_file;
18
55
 
19
- let ftpHost = oraksoftJson.ftp_host;
20
- let ftpUser = oraksoftJson.ftp_user;
21
- let ftpPassword = oraksoftJson.ftp_password;
22
- let ftpSecure = oraksoftJson.ftp_secure || false;
23
- let localFilePath1 = path.join(projectRoot, "dist", oraksoftJson.localFilePath);
24
- let remoteFilePath1 = oraksoftJson.remoteFilePath;
56
+ let localFilePath1 = path.join(projectRoot, "dist", localFileName);
25
57
 
26
58
  if (!ftpHost || !ftpUser || !ftpPassword) {
27
59
  console.error("Error: FTP bilgileri eksik. .env.oraksoft dosyasında ftp_host, ftp_user ve ftp_password alanlarını kontrol edin.");
package/lib/deploy-zip.js CHANGED
@@ -3,64 +3,80 @@ import path from 'path';
3
3
  import * as tar from 'tar';
4
4
 
5
5
  export async function deployZip() {
6
- // Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
7
- const projectRoot = process.cwd();
6
+ // Argüman kontrolü ve yardım mesajı
7
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
8
+ console.log('orak-deploy-zip version 0.0.3');
9
+ console.log('Kullanım: orak-deploy-zip');
10
+ console.log('Belirtilen dosya ve klasörleri tar.gz formatında arşivler.');
11
+ console.log('Konfigürasyon: orak-config.json dosyasında "fiDeployZipContent" ayarı gerekli.');
12
+ process.exit(0);
13
+ }
8
14
 
9
- // Arşivlenecek dosya ve klasörlerin yolları
10
- const packageJsonPath = path.join(projectRoot, 'package.json');
11
-
12
- if (!fs.existsSync(packageJsonPath)) {
13
- console.error("Error: package.json dosyası bulunamadı. Bu komutu bir Node.js projesi klasöründe çalıştırın.");
14
- process.exit(1);
15
- }
15
+ // Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
16
+ const projectRoot = process.cwd();
16
17
 
17
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
18
+ // orak-config.json dosyasını oku
19
+ const configPath = path.join(projectRoot, 'orak-config.json');
18
20
 
19
- if (!packageJson.fiDeployZipContent || !Array.isArray(packageJson.fiDeployZipContent)) {
20
- console.error("Error: 'fiDeployZipContent' alanı package.json içinde bir dizi olarak tanımlanmalıdır.");
21
- process.exit(1);
22
- }
21
+ if (!fs.existsSync(configPath)) {
22
+ console.error("Error: orak-config.json dosyası bulunamadı. Bu komutu proje kök dizininde çalıştırın.");
23
+ process.exit(1);
24
+ }
23
25
 
24
- const filesToArchive = packageJson.fiDeployZipContent;
26
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
25
27
 
26
- // dist klasörü ve arşiv adı
27
- const distDir = path.resolve(projectRoot, 'dist');
28
- const archiveName = 'deployphp25.tar.gz';
29
- const archivePath = path.join(distDir, archiveName);
28
+ if (!config.fiDeployZipContent || !Array.isArray(config.fiDeployZipContent)) {
29
+ console.error("Error: 'fiDeployZipContent' alanı orak-config.json içinde bir dizi olarak tanımlanmalıdır.");
30
+ process.exit(1);
31
+ }
30
32
 
31
- // dist klasörü yoksa oluştur
32
- if (!fs.existsSync(distDir)) {
33
- fs.mkdirSync(distDir, { recursive: true });
34
- }
33
+ const filesToArchive = config.fiDeployZipContent;
35
34
 
36
- // Arşiv oluştur
37
- try {
38
- await tar.c(
39
- {
40
- gzip: true,
41
- file: archivePath,
42
- cwd: projectRoot,
43
- follow: true, // symlink/junction'ları takip et
44
- filter: (path, stat) => {
45
- // .git klasörlerini ve test dosyalarını hariç tut
46
- const normalizedPath = path.replace(/\\/g, '/');
47
- if (normalizedPath.includes('/.git/') || normalizedPath.includes('/.git') ||
48
- normalizedPath.includes('/tests/') || normalizedPath.includes('/tests') ||
49
- normalizedPath.includes('/fi-logs/') || normalizedPath.includes('/fi-logs') ||
50
- normalizedPath.includes('/.github/') || normalizedPath.includes('/.github') ||
51
- normalizedPath.endsWith('.md') || normalizedPath.endsWith('phpunit.xml.dist') ||
52
- normalizedPath.endsWith('.gitignore') || normalizedPath.endsWith('.gitattributes')) {
53
- console.log('Excluding:', path);
54
- return false;
55
- }
56
- return true;
57
- }
58
- },
59
- filesToArchive
60
- );
61
- console.log(`✅ Arşiv oluşturuldu: ${archivePath}`);
62
- } catch (err) {
63
- console.error('❌ Arşivleme hatası:', err);
64
- process.exit(1);
65
- }
35
+ // dist klasörü ve arşiv adı
36
+ const distDir = path.resolve(projectRoot, 'dist');
37
+ const archiveName = 'deployphp25.tar.gz';
38
+ const archivePath = path.join(distDir, archiveName);
39
+
40
+ // dist klasörü yoksa oluştur
41
+ if (!fs.existsSync(distDir)) {
42
+ fs.mkdirSync(distDir, { recursive: true });
43
+ }
44
+
45
+ // Arşiv oluştur
46
+ try {
47
+ await tar.c(
48
+ {
49
+ gzip: true,
50
+ file: archivePath,
51
+ cwd: projectRoot,
52
+ follow: true, // symlink/junction'ları takip et
53
+ filter: (path, stat) => {
54
+ // .git klasörlerini ve test dosyalarını hariç tut
55
+ const normalizedPath = path.replace(/\\/g, '/');
56
+ if (normalizedPath.includes('/.git/')
57
+ || normalizedPath.includes('/.git')
58
+ || normalizedPath.includes('/tests/')
59
+ || normalizedPath.includes('/tests')
60
+ || normalizedPath.includes('/fi-logs/')
61
+ || normalizedPath.includes('/fi-logs')
62
+ || normalizedPath.includes('/.github/')
63
+ || normalizedPath.includes('/.github')
64
+ || normalizedPath.endsWith('.md')
65
+ || normalizedPath.endsWith('phpunit.xml.dist')
66
+ || normalizedPath.endsWith('.gitignore')
67
+ || normalizedPath.endsWith('.gitattributes')
68
+ ) {
69
+ console.log('Excluding:', path);
70
+ return false;
71
+ }
72
+ return true;
73
+ }
74
+ },
75
+ filesToArchive
76
+ );
77
+ console.log(`✅ Arşiv oluşturuldu: ${archivePath}`);
78
+ } catch (err) {
79
+ console.error('❌ Arşivleme hatası:', err);
80
+ process.exit(1);
81
+ }
66
82
  }
package/lib/env-change.js CHANGED
@@ -9,31 +9,32 @@ export function envChange() {
9
9
  // process.argv[2] = ilk argüman
10
10
  const envArgument = process.argv[2];
11
11
 
12
- let txEnv = envArgument || packageJson.fiEnvChangeStatus;
13
-
14
12
  // Argüman kontrolü ve yardım mesajı
15
13
  if (process.argv.includes('--help') || process.argv.includes('-h')) {
16
- console.log('fi-env-change version 0.0.2');
17
- console.log('Kullanım: fi-env-change [ortam_adı]');
18
- console.log('Örnek: fi-env-change dev');
19
- console.log('Argüman verilmezse package.json\'daki fiEnvChangeStatus değeri kullanılır.');
14
+ console.log('orak-env-change version 0.0.3');
15
+ console.log('Kullanım: orak-env-change [ortam_adı]');
16
+ console.log('Örnek: orak-env-change dev');
17
+ console.log('Argüman verilmezse orak-config.json\'daki fiEnvChangeStatus değeri kullanılır.');
20
18
  process.exit(0);
21
19
  }
22
20
 
23
21
  // Çalışma dizinini tespit et (komutun çalıştırıldığı yer)
24
22
  const projectRoot = process.cwd();
25
23
 
26
- // Arşivlenecek dosya ve klasörlerin yolları
27
- const packageJsonPath = path.join(projectRoot, 'package.json');
24
+ // orak-config.json dosyasını oku
25
+ const configPath = path.join(projectRoot, 'orak-config.json');
28
26
 
29
- let packageJson = {};
30
- if (fs.existsSync(packageJsonPath)) {
31
- packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
27
+ let config = {};
28
+ if (fs.existsSync(configPath)) {
29
+ config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
32
30
  }
33
31
 
32
+ let txEnv = envArgument || config.fiEnvChangeStatus;
33
+
34
34
  if (!txEnv) {
35
- console.error('❌ Ortam adı belirtilmedi ve package.json\'da fiEnvChangeStatus bulunamadı.');
36
- console.log('Kullanım: fi-env-change [ortam_adı]');
35
+ console.error('❌ Ortam adı belirtilmedi ve orak-config.json\'da fiEnvChangeStatus bulunamadı.');
36
+ console.log('Kullanım: orak-env-change [ortam_adı]');
37
+ console.log('Alternatif: orak-config.json dosyasında "fiEnvChangeStatus" değeri tanımlayın.');
37
38
  process.exit(1);
38
39
  }
39
40
 
@@ -0,0 +1,16 @@
1
+ {
2
+ "copyDepsModulesToCopy": [
3
+ {
4
+ "name": "module-name",
5
+ "file": "dist/module.js"
6
+ }
7
+ ],
8
+ "copyDepsLibFolder": "lib",
9
+ "copyDepsLibFolderEmpty": true,
10
+ "fiDeployZipContent": [
11
+ "src/",
12
+ "public/",
13
+ "package.json"
14
+ ],
15
+ "fiEnvChangeStatus": "dev"
16
+ }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "oraksoft-node-tools",
3
- "version": "0.0.2",
4
- "description": "CLI araçları koleksiyonu - fi-copy-deps, fi-deploy-ftp, fi-deploy-zip ve fi-env-change komutları",
3
+ "version": "0.0.3",
4
+ "description": "CLI araçları koleksiyonu - orak-copy-deps, orak-deploy-ftp, orak-deploy-zip ve orak-env-change komutları",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
- "fi-copy-deps": "./bin/fi-copy-deps.js",
9
- "fi-deploy-ftp": "./bin/fi-deploy-ftp.js",
10
- "fi-deploy-zip": "./bin/fi-deploy-zip.js",
11
- "fi-env-change": "./bin/fi-env-change.js"
8
+ "orak-copy-deps": "./bin/orak-copy-deps.js",
9
+ "orak-deploy-ftp": "./bin/orak-deploy-ftp.js",
10
+ "orak-deploy-zip": "./bin/orak-deploy-zip.js",
11
+ "orak-env-change": "./bin/orak-env-change.js"
12
12
  },
13
13
  "keywords": [
14
14
  "cli",
@@ -32,12 +32,12 @@
32
32
  "preferGlobal": true,
33
33
  "repository": {
34
34
  "type": "git",
35
- "url": "git+https://github.com/engtuncay/oraksoft-node-tools.git"
35
+ "url": "git+https://github.com/oraksoftware/oraksoft-node-tools.git"
36
36
  },
37
37
  "bugs": {
38
- "url": "https://github.com/engtuncay/oraksoft-node-tools/issues"
38
+ "url": "https://github.com/oraksoftware/oraksoft-node-tools/issues"
39
39
  },
40
- "homepage": "https://github.com/engtuncay/oraksoft-node-tools#readme",
40
+ "homepage": "https://github.com/oraksoftware/oraksoft-node-tools#readme",
41
41
  "scripts": {
42
42
  "test": "echo \"Error: no test specified\" && exit 1",
43
43
  "build": "echo \"Build completed\""