@followthecode/cli 1.2.13 → 1.2.18
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 +31 -1
- package/bin/ftc.js +39 -1
- package/bin/linux-x64/ftc.cli +0 -0
- package/bin/osx-x64/ftc.cli +0 -0
- package/bin/win-x64/ftc.cli.exe +0 -0
- package/package.json +4 -2
- package/scripts/sync-version.js +77 -0
package/bin/ftc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/bin/bash
|
|
1
|
+
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
# FTC CLI Wrapper Script
|
|
4
4
|
# Este script executa o FTC CLI baseado na plataforma detectada
|
|
@@ -38,6 +38,33 @@ get_executable_path() {
|
|
|
38
38
|
esac
|
|
39
39
|
}
|
|
40
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
|
+
|
|
41
68
|
# Função para verificar se o executável existe
|
|
42
69
|
check_executable() {
|
|
43
70
|
local exec_path=$1
|
|
@@ -61,6 +88,9 @@ main() {
|
|
|
61
88
|
# Verifica se o executável existe
|
|
62
89
|
check_executable "$exec_path"
|
|
63
90
|
|
|
91
|
+
# Copia arquivo de configuração para o diretório atual
|
|
92
|
+
copy_config_file
|
|
93
|
+
|
|
64
94
|
# Executa o CLI
|
|
65
95
|
exec "$exec_path" "$@"
|
|
66
96
|
}
|
package/bin/ftc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
4
|
const path = require('path');
|
|
@@ -33,12 +33,50 @@ function checkExecutable() {
|
|
|
33
33
|
return execPath;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// Copia arquivo de configuração para o diretório atual
|
|
37
|
+
function copyConfigFile() {
|
|
38
|
+
try {
|
|
39
|
+
const currentDir = process.cwd();
|
|
40
|
+
const configDest = path.join(currentDir, 'appsettings.json');
|
|
41
|
+
|
|
42
|
+
// Se já existe no diretório atual, não copia
|
|
43
|
+
if (fs.existsSync(configDest)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Tenta diferentes locais para o arquivo de configuração
|
|
48
|
+
const possibleSources = [
|
|
49
|
+
path.join(__dirname, 'linux-x64', 'appsettings.json'),
|
|
50
|
+
path.join(__dirname, 'win-x64', 'appsettings.json'),
|
|
51
|
+
path.join(__dirname, 'osx-x64', 'appsettings.json'),
|
|
52
|
+
path.join(__dirname, '..', 'appsettings.json')
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
let configSource = null;
|
|
56
|
+
for (const source of possibleSources) {
|
|
57
|
+
if (fs.existsSync(source)) {
|
|
58
|
+
configSource = source;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (configSource) {
|
|
64
|
+
fs.copyFileSync(configSource, configDest);
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
// Ignora erros de cópia
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
36
71
|
// Função principal
|
|
37
72
|
function main() {
|
|
38
73
|
try {
|
|
39
74
|
// Verifica se o executável existe
|
|
40
75
|
const execPath = checkExecutable();
|
|
41
76
|
|
|
77
|
+
// Copia arquivo de configuração para o diretório atual
|
|
78
|
+
copyConfigFile();
|
|
79
|
+
|
|
42
80
|
// Define permissões de execução (Linux/macOS)
|
|
43
81
|
if (!isWindows) {
|
|
44
82
|
try {
|
package/bin/linux-x64/ftc.cli
CHANGED
|
Binary file
|
package/bin/osx-x64/ftc.cli
CHANGED
|
Binary file
|
package/bin/win-x64/ftc.cli.exe
CHANGED
|
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.18",
|
|
4
4
|
"description": "CLI tool for Git repository analysis and data collection",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"build:win": "dotnet publish ftc.cli.csproj -c Release -r win-x64 -o ./bin/win-x64",
|
|
18
18
|
"build:mac": "dotnet publish ftc.cli.csproj -c Release -r osx-x64 -o ./bin/osx-x64",
|
|
19
19
|
"build:linux": "dotnet publish ftc.cli.csproj -c Release -r linux-x64 -o ./bin/linux-x64",
|
|
20
|
-
"setup": "npm run copy-config && npm run set-permissions",
|
|
20
|
+
"setup": "npm run sync-version && npm run copy-config && npm run set-permissions",
|
|
21
|
+
"sync-version": "node scripts/sync-version.js",
|
|
21
22
|
"copy-config": "node scripts/copy-config.js",
|
|
22
23
|
"set-permissions": "node scripts/set-permissions.js",
|
|
23
24
|
"postinstall": "node scripts/post-install.js",
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"bin/linux-x64/appsettings.json",
|
|
77
78
|
"bin/linux-x64/libgit2-c058aa8.so",
|
|
78
79
|
"appsettings.json",
|
|
80
|
+
"scripts/sync-version.js",
|
|
79
81
|
"scripts/copy-config.js",
|
|
80
82
|
"scripts/set-permissions.js",
|
|
81
83
|
"scripts/install-wrapper.js",
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
console.log('🔄 Sincronizando versões...');
|
|
7
|
+
|
|
8
|
+
// Lê a versão do package.json
|
|
9
|
+
function getPackageVersion() {
|
|
10
|
+
const packagePath = path.join(__dirname, '..', 'package.json');
|
|
11
|
+
const package = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
12
|
+
return package.version;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Atualiza a versão no ftc.cli.csproj
|
|
16
|
+
function updateCsprojVersion(version) {
|
|
17
|
+
const csprojPath = path.join(__dirname, '..', 'ftc.cli.csproj');
|
|
18
|
+
let content = fs.readFileSync(csprojPath, 'utf8');
|
|
19
|
+
|
|
20
|
+
// Atualiza as tags de versão
|
|
21
|
+
content = content.replace(
|
|
22
|
+
/<Version>.*?<\/Version>/g,
|
|
23
|
+
`<Version>${version}</Version>`
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
content = content.replace(
|
|
27
|
+
/<AssemblyVersion>.*?<\/AssemblyVersion>/g,
|
|
28
|
+
`<AssemblyVersion>${version}.0</AssemblyVersion>`
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
content = content.replace(
|
|
32
|
+
/<FileVersion>.*?<\/FileVersion>/g,
|
|
33
|
+
`<FileVersion>${version}.0</FileVersion>`
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// Se as tags não existem, adiciona após UserSecretsId
|
|
37
|
+
if (!content.includes('<Version>')) {
|
|
38
|
+
content = content.replace(
|
|
39
|
+
/(<UserSecretsId>.*?<\/UserSecretsId>)/,
|
|
40
|
+
`$1\n <Version>${version}</Version>`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!content.includes('<AssemblyVersion>')) {
|
|
45
|
+
content = content.replace(
|
|
46
|
+
/(<Version>.*?<\/Version>)/,
|
|
47
|
+
`$1\n <AssemblyVersion>${version}.0</AssemblyVersion>`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!content.includes('<FileVersion>')) {
|
|
52
|
+
content = content.replace(
|
|
53
|
+
/(<AssemblyVersion>.*?<\/AssemblyVersion>)/,
|
|
54
|
+
`$1\n <FileVersion>${version}.0</FileVersion>`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fs.writeFileSync(csprojPath, content);
|
|
59
|
+
console.log(`✅ Versão ${version} sincronizada no ftc.cli.csproj`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Função principal
|
|
63
|
+
function main() {
|
|
64
|
+
try {
|
|
65
|
+
const version = getPackageVersion();
|
|
66
|
+
console.log(`📦 Versão do package.json: ${version}`);
|
|
67
|
+
|
|
68
|
+
updateCsprojVersion(version);
|
|
69
|
+
|
|
70
|
+
console.log('🎉 Sincronização concluída!');
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error('❌ Erro ao sincronizar versões:', error.message);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
main();
|