@followthecode/cli 1.2.28 → 1.2.30
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/bin/ftc +119 -97
- package/bin/linux-x64/ftc.cli +0 -0
- package/bin/linux-x64/libgit2-3f4182d.so +0 -0
- package/bin/osx-x64/ftc.cli +0 -0
- package/bin/osx-x64/libgit2-3f4182d.dylib +0 -0
- package/bin/win-x64/ftc.cli.exe +0 -0
- package/bin/win-x64/git2-3f4182d.dll +0 -0
- package/package.json +4 -3
- package/scripts/post-install.js +26 -0
package/bin/ftc
CHANGED
|
@@ -1,99 +1,121 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# FTC CLI Wrapper Script
|
|
4
|
-
# Este script executa o FTC CLI baseado na plataforma detectada
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
# Função para detectar a plataforma
|
|
9
|
-
detect_platform() {
|
|
10
|
-
case "$(uname -s)" in
|
|
11
|
-
Linux*) echo "linux";;
|
|
12
|
-
Darwin*) echo "osx";;
|
|
13
|
-
CYGWIN*) echo "win";;
|
|
14
|
-
MINGW*) echo "win";;
|
|
15
|
-
MSYS*) echo "win";;
|
|
16
|
-
*) echo "unknown";;
|
|
17
|
-
esac
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
# Função para obter o caminho do executável
|
|
21
|
-
get_executable_path() {
|
|
22
|
-
local platform=$1
|
|
23
|
-
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
24
|
-
|
|
25
|
-
case "$platform" in
|
|
26
|
-
"linux")
|
|
27
|
-
echo "$script_dir/linux-x64/ftc.cli"
|
|
28
|
-
;;
|
|
29
|
-
"osx")
|
|
30
|
-
echo "$script_dir/osx-x64/ftc.cli"
|
|
31
|
-
;;
|
|
32
|
-
"win")
|
|
33
|
-
echo "$script_dir/win-x64/ftc.cli.exe"
|
|
34
|
-
;;
|
|
35
|
-
*)
|
|
36
|
-
echo "unknown"
|
|
37
|
-
;;
|
|
38
|
-
esac
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
# Função para copiar arquivo de configuração
|
|
42
|
-
copy_config_file() {
|
|
43
|
-
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
44
|
-
local current_dir="$(pwd)"
|
|
45
|
-
local config_dest="$current_dir/appsettings.json"
|
|
46
|
-
|
|
47
|
-
# Se já existe no diretório atual, não copia
|
|
48
|
-
if [ -f "$config_dest" ]; then
|
|
49
|
-
return
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# Tenta diferentes locais para o arquivo de configuração
|
|
53
|
-
local possible_sources=(
|
|
54
|
-
"$script_dir/linux-x64/appsettings.json"
|
|
55
|
-
"$script_dir/win-x64/appsettings.json"
|
|
56
|
-
"$script_dir/osx-x64/appsettings.json"
|
|
57
|
-
"$script_dir/../appsettings.json"
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
for source in "${possible_sources[@]}"; do
|
|
61
|
-
if [ -f "$source" ]; then
|
|
62
|
-
cp "$source" "$config_dest" 2>/dev/null || true
|
|
63
|
-
break
|
|
64
|
-
fi
|
|
65
|
-
done
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
# Função para verificar se o executável existe
|
|
69
|
-
check_executable() {
|
|
70
|
-
local exec_path=$1
|
|
71
|
-
|
|
72
|
-
if [ ! -f "$exec_path" ]; then
|
|
73
|
-
echo "❌ Executável FTC CLI não encontrado!" >&2
|
|
74
|
-
echo " Procurado em: $exec_path" >&2
|
|
75
|
-
echo "💡 Execute 'npm run build' para compilar o projeto." >&2
|
|
76
|
-
exit 1
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
# Define permissões de execução
|
|
80
|
-
chmod +x "$exec_path" 2>/dev/null || true
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
# Função principal
|
|
84
|
-
main() {
|
|
85
|
-
local platform=$(detect_platform)
|
|
86
|
-
local exec_path=$(get_executable_path "$platform")
|
|
87
|
-
|
|
88
|
-
# Verifica se o executável existe
|
|
89
|
-
check_executable "$exec_path"
|
|
90
|
-
|
|
91
|
-
# Copia arquivo de configuração para o diretório atual
|
|
92
|
-
copy_config_file
|
|
93
|
-
|
|
94
|
-
#
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
2
|
+
|
|
3
|
+
# FTC CLI Wrapper Script
|
|
4
|
+
# Este script executa o FTC CLI baseado na plataforma detectada
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Função para detectar a plataforma
|
|
9
|
+
detect_platform() {
|
|
10
|
+
case "$(uname -s)" in
|
|
11
|
+
Linux*) echo "linux";;
|
|
12
|
+
Darwin*) echo "osx";;
|
|
13
|
+
CYGWIN*) echo "win";;
|
|
14
|
+
MINGW*) echo "win";;
|
|
15
|
+
MSYS*) echo "win";;
|
|
16
|
+
*) echo "unknown";;
|
|
17
|
+
esac
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# Função para obter o caminho do executável
|
|
21
|
+
get_executable_path() {
|
|
22
|
+
local platform=$1
|
|
23
|
+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
24
|
+
|
|
25
|
+
case "$platform" in
|
|
26
|
+
"linux")
|
|
27
|
+
echo "$script_dir/linux-x64/ftc.cli"
|
|
28
|
+
;;
|
|
29
|
+
"osx")
|
|
30
|
+
echo "$script_dir/osx-x64/ftc.cli"
|
|
31
|
+
;;
|
|
32
|
+
"win")
|
|
33
|
+
echo "$script_dir/win-x64/ftc.cli.exe"
|
|
34
|
+
;;
|
|
35
|
+
*)
|
|
36
|
+
echo "unknown"
|
|
37
|
+
;;
|
|
38
|
+
esac
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Função para copiar arquivo de configuração
|
|
42
|
+
copy_config_file() {
|
|
43
|
+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
44
|
+
local current_dir="$(pwd)"
|
|
45
|
+
local config_dest="$current_dir/appsettings.json"
|
|
46
|
+
|
|
47
|
+
# Se já existe no diretório atual, não copia
|
|
48
|
+
if [ -f "$config_dest" ]; then
|
|
49
|
+
return
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Tenta diferentes locais para o arquivo de configuração
|
|
53
|
+
local possible_sources=(
|
|
54
|
+
"$script_dir/linux-x64/appsettings.json"
|
|
55
|
+
"$script_dir/win-x64/appsettings.json"
|
|
56
|
+
"$script_dir/osx-x64/appsettings.json"
|
|
57
|
+
"$script_dir/../appsettings.json"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
for source in "${possible_sources[@]}"; do
|
|
61
|
+
if [ -f "$source" ]; then
|
|
62
|
+
cp "$source" "$config_dest" 2>/dev/null || true
|
|
63
|
+
break
|
|
64
|
+
fi
|
|
65
|
+
done
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
# Função para verificar se o executável existe
|
|
69
|
+
check_executable() {
|
|
70
|
+
local exec_path=$1
|
|
71
|
+
|
|
72
|
+
if [ ! -f "$exec_path" ]; then
|
|
73
|
+
echo "❌ Executável FTC CLI não encontrado!" >&2
|
|
74
|
+
echo " Procurado em: $exec_path" >&2
|
|
75
|
+
echo "💡 Execute 'npm run build' para compilar o projeto." >&2
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Define permissões de execução
|
|
80
|
+
chmod +x "$exec_path" 2>/dev/null || true
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Função principal
|
|
84
|
+
main() {
|
|
85
|
+
local platform=$(detect_platform)
|
|
86
|
+
local exec_path=$(get_executable_path "$platform")
|
|
87
|
+
|
|
88
|
+
# Verifica se o executável existe
|
|
89
|
+
check_executable "$exec_path"
|
|
90
|
+
|
|
91
|
+
# Copia arquivo de configuração para o diretório atual
|
|
92
|
+
copy_config_file
|
|
93
|
+
|
|
94
|
+
# Configura LD_LIBRARY_PATH para Linux
|
|
95
|
+
if [ "$platform" = "linux" ]; then
|
|
96
|
+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
97
|
+
local lib_dir="$script_dir/linux-x64"
|
|
98
|
+
|
|
99
|
+
if [ -d "$lib_dir" ]; then
|
|
100
|
+
export LD_LIBRARY_PATH="$lib_dir:$LD_LIBRARY_PATH"
|
|
101
|
+
echo "🔧 Configurando LD_LIBRARY_PATH: $lib_dir" >&2
|
|
102
|
+
|
|
103
|
+
# Verifica se as dependências básicas estão disponíveis
|
|
104
|
+
if ! ldconfig -p | grep -q "libssl" 2>/dev/null; then
|
|
105
|
+
echo "⚠️ libssl não encontrado. Execute: sudo apt-get install -y libssl-dev" >&2
|
|
106
|
+
fi
|
|
107
|
+
if ! ldconfig -p | grep -q "libcurl" 2>/dev/null; then
|
|
108
|
+
echo "⚠️ libcurl não encontrado. Execute: sudo apt-get install -y libcurl4-openssl-dev" >&2
|
|
109
|
+
fi
|
|
110
|
+
if ! ldconfig -p | grep -q "libz" 2>/dev/null; then
|
|
111
|
+
echo "⚠️ libz não encontrado. Execute: sudo apt-get install -y zlib1g-dev" >&2
|
|
112
|
+
fi
|
|
113
|
+
fi
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# Executa o CLI
|
|
117
|
+
exec "$exec_path" "$@"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# Executa a função principal com todos os argumentos
|
|
99
121
|
main "$@"
|
package/bin/linux-x64/ftc.cli
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/osx-x64/ftc.cli
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/win-x64/ftc.cli.exe
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@followthecode/cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.30",
|
|
4
4
|
"description": "CLI tool for Git repository analysis and data collection",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -70,12 +70,13 @@
|
|
|
70
70
|
"bin/ftc",
|
|
71
71
|
"bin/win-x64/ftc.cli.exe",
|
|
72
72
|
"bin/win-x64/appsettings.json",
|
|
73
|
-
"bin/win-x64/git2-
|
|
73
|
+
"bin/win-x64/git2-3f4182d.dll",
|
|
74
74
|
"bin/osx-x64/ftc.cli",
|
|
75
75
|
"bin/osx-x64/appsettings.json",
|
|
76
|
+
"bin/osx-x64/libgit2-3f4182d.dylib",
|
|
76
77
|
"bin/linux-x64/ftc.cli",
|
|
77
78
|
"bin/linux-x64/appsettings.json",
|
|
78
|
-
"bin/linux-x64/libgit2-
|
|
79
|
+
"bin/linux-x64/libgit2-3f4182d.so",
|
|
79
80
|
"appsettings.json",
|
|
80
81
|
"scripts/sync-version.js",
|
|
81
82
|
"scripts/copy-config.js",
|
package/scripts/post-install.js
CHANGED
|
@@ -30,6 +30,32 @@ function checkAndInstallNativeDependencies() {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// Verifica se a biblioteca do LibGit2Sharp está presente
|
|
34
|
+
const libgit2Path = path.join(__dirname, '..', 'bin', 'linux-x64', 'libgit2-3f4182d.so');
|
|
35
|
+
if (fs.existsSync(libgit2Path)) {
|
|
36
|
+
console.log('✅ Biblioteca LibGit2Sharp encontrada');
|
|
37
|
+
|
|
38
|
+
// Tenta definir LD_LIBRARY_PATH para incluir o diretório da biblioteca
|
|
39
|
+
const libDir = path.join(__dirname, '..', 'bin', 'linux-x64');
|
|
40
|
+
const currentLdPath = process.env.LD_LIBRARY_PATH || '';
|
|
41
|
+
const newLdPath = currentLdPath ? `${libDir}:${currentLdPath}` : libDir;
|
|
42
|
+
|
|
43
|
+
console.log(`📋 Configurando LD_LIBRARY_PATH: ${newLdPath}`);
|
|
44
|
+
|
|
45
|
+
// Salva a configuração em um arquivo para ser carregado pelo wrapper
|
|
46
|
+
const wrapperConfig = `#!/bin/bash
|
|
47
|
+
export LD_LIBRARY_PATH="${newLdPath}:\$LD_LIBRARY_PATH"
|
|
48
|
+
exec "$@"
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
const wrapperPath = path.join(__dirname, '..', 'bin', 'ftc-wrapper.sh');
|
|
52
|
+
fs.writeFileSync(wrapperPath, wrapperConfig);
|
|
53
|
+
fs.chmodSync(wrapperPath, 0o755);
|
|
54
|
+
console.log('✅ Wrapper de biblioteca criado');
|
|
55
|
+
} else {
|
|
56
|
+
console.log('❌ Biblioteca LibGit2Sharp não encontrada');
|
|
57
|
+
}
|
|
58
|
+
|
|
33
59
|
if (missingLibs.length > 0) {
|
|
34
60
|
console.log('⚠️ Algumas dependências nativas estão faltando. Tentando instalar...');
|
|
35
61
|
|