latinfo 0.15.0 → 0.16.0
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/dist/index.js +43 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const local_search_1 = require("./local-search");
|
|
|
47
47
|
const client_search_1 = require("./client-search");
|
|
48
48
|
const odis_search_1 = require("./odis-search");
|
|
49
49
|
const mphf_search_1 = require("./mphf-search");
|
|
50
|
-
const VERSION = '0.
|
|
50
|
+
const VERSION = '0.16.0';
|
|
51
51
|
const API_URL = process.env.LATINFO_API_URL || 'https://api.latinfo.dev';
|
|
52
52
|
const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID || 'Ov23li5fcQaiCsVtaMKK';
|
|
53
53
|
const CONFIG_DIR = path_1.default.join(os_1.default.homedir(), '.latinfo');
|
|
@@ -2041,15 +2041,15 @@ async function pipeStage(args) {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
|
-
// 3b. Install Python deps on Linux Mint (
|
|
2044
|
+
// 3b. Install Python deps on Linux Mint (try multiple methods)
|
|
2045
2045
|
const pyDepsMatch = yamlContent.match(/python_dependencies:\n([\s\S]*?)(?=\n\w|\n$|$)/);
|
|
2046
2046
|
if (pyDepsMatch) {
|
|
2047
2047
|
const pyDeps = pyDepsMatch[1].split('\n').map(l => l.replace(/^\s*-\s*/, '').trim()).filter(Boolean);
|
|
2048
2048
|
if (pyDeps.length > 0) {
|
|
2049
|
+
const pkgs = pyDeps.join(' ');
|
|
2049
2050
|
console.log(`[pipe] Installing Python deps on Linux Mint: ${pyDeps.join(', ')}...`);
|
|
2050
2051
|
try {
|
|
2051
|
-
|
|
2052
|
-
run(`ssh ${RUNNER} "cd ${remoteRepo} && (test -d .venv || python3 -m venv .venv) && .venv/bin/pip install ${pyDeps.join(' ')}"`, { stdio: 'inherit' });
|
|
2052
|
+
run(`ssh ${RUNNER} "python3 -m pip install --break-system-packages ${pkgs} 2>/dev/null || pip3 install --break-system-packages ${pkgs} 2>/dev/null || python3 -m pip install --user ${pkgs} 2>/dev/null || pip3 install ${pkgs}"`, { stdio: 'inherit' });
|
|
2053
2053
|
}
|
|
2054
2054
|
catch {
|
|
2055
2055
|
console.error('[pipe] Failed to install Python deps on Linux Mint');
|
|
@@ -2060,7 +2060,7 @@ async function pipeStage(args) {
|
|
|
2060
2060
|
// 4. Run import on Linux Mint
|
|
2061
2061
|
console.log(`[pipe] Running import on Linux Mint...`);
|
|
2062
2062
|
try {
|
|
2063
|
-
run(`ssh ${RUNNER} "cd ${remoteRepo} && set -a && source .env 2>/dev/null; source .dev.vars 2>/dev/null;
|
|
2063
|
+
run(`ssh ${RUNNER} "cd ${remoteRepo} && set -a && source .env 2>/dev/null; source .dev.vars 2>/dev/null; set +a && R2_BUCKET_NAME=latinfo-data npx tsx src/imports/${sourceName}.ts"`, {
|
|
2064
2064
|
stdio: 'inherit',
|
|
2065
2065
|
});
|
|
2066
2066
|
}
|
|
@@ -2282,9 +2282,41 @@ async function pipePublish(args) {
|
|
|
2282
2282
|
console.error(`[pipe] Failed to generate sources.ts`);
|
|
2283
2283
|
process.exit(1);
|
|
2284
2284
|
}
|
|
2285
|
-
// 2.
|
|
2285
|
+
// 2. Auto-update import.yml matrix
|
|
2286
|
+
console.log(`[pipe] Updating import.yml...`);
|
|
2287
|
+
const importYmlPath = path_1.default.join(repo, '.github', 'workflows', 'import.yml');
|
|
2288
|
+
if (fs_1.default.existsSync(importYmlPath)) {
|
|
2289
|
+
let yml = fs_1.default.readFileSync(importYmlPath, 'utf-8');
|
|
2290
|
+
// Add to options list if not present
|
|
2291
|
+
if (!yml.includes(`- ${sourceName}`)) {
|
|
2292
|
+
yml = yml.replace(/( +- all\n)/, ` - ${sourceName}\n$1`);
|
|
2293
|
+
}
|
|
2294
|
+
// Add to matrix includes if not present
|
|
2295
|
+
if (!yml.includes(`source: ${sourceName}`)) {
|
|
2296
|
+
const yamlContent = fs_1.default.readFileSync(path_1.default.join(repo, 'sources', `${sourceName}.yaml`), 'utf-8');
|
|
2297
|
+
const importScriptMatch = yamlContent.match(/import_script:\s*(.+)/);
|
|
2298
|
+
const script = importScriptMatch ? importScriptMatch[1].trim() : `src/imports/${sourceName}.ts`;
|
|
2299
|
+
const schedule = yamlContent.includes('schedule: daily') || yamlContent.includes('schedule: weekly');
|
|
2300
|
+
const needsBrowser = yamlContent.includes('playwright');
|
|
2301
|
+
let matrixEntry = `\n - source: ${sourceName}\n`;
|
|
2302
|
+
matrixEntry += ` script: ${script}\n`;
|
|
2303
|
+
matrixEntry += ` timeout: 15\n`;
|
|
2304
|
+
matrixEntry += ` daily: ${schedule}\n`;
|
|
2305
|
+
if (needsBrowser)
|
|
2306
|
+
matrixEntry += ` needs_browser: true\n`;
|
|
2307
|
+
matrixEntry += ` smoke_url: ""\n`;
|
|
2308
|
+
matrixEntry += ` smoke_field: ""\n`;
|
|
2309
|
+
// Insert before co-rues-registry (last entry) or at end of matrix
|
|
2310
|
+
const coRuesMatch = yml.match(/(\n +- source: co-rues-registry)/);
|
|
2311
|
+
if (coRuesMatch && coRuesMatch.index) {
|
|
2312
|
+
yml = yml.slice(0, coRuesMatch.index) + matrixEntry + yml.slice(coRuesMatch.index);
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
fs_1.default.writeFileSync(importYmlPath, yml);
|
|
2316
|
+
}
|
|
2317
|
+
// 3. Git add + commit + push
|
|
2286
2318
|
console.log(`[pipe] Committing to repo...`);
|
|
2287
|
-
const files = [`sources/${sourceName}.yaml`, 'src/sources.ts'];
|
|
2319
|
+
const files = [`sources/${sourceName}.yaml`, 'src/sources.ts', '.github/workflows/import.yml'];
|
|
2288
2320
|
const scriptPath = path_1.default.join(repo, 'src', 'imports', `${sourceName}.ts`);
|
|
2289
2321
|
const yamlContent = fs_1.default.readFileSync(path_1.default.join(repo, 'sources', `${sourceName}.yaml`), 'utf-8');
|
|
2290
2322
|
const importScriptMatch = yamlContent.match(/import_script:\s*(.+)/);
|
|
@@ -2473,6 +2505,10 @@ NAMING
|
|
|
2473
2505
|
{country}-{institution}-{dataset}, all lowercase english.
|
|
2474
2506
|
Examples: pe-sunat-padron, pe-osce-sanctioned, co-rues-registry
|
|
2475
2507
|
|
|
2508
|
+
LANGUAGE
|
|
2509
|
+
All code, documentation, field names, dataset names, and commit messages
|
|
2510
|
+
must be in English. No Spanish, Portuguese, or other languages.
|
|
2511
|
+
|
|
2476
2512
|
ENVIRONMENT
|
|
2477
2513
|
LATINFO_ADMIN_SECRET Auto-detected from ~/.latinfo/admin.secret or .dev.vars
|
|
2478
2514
|
LATINFO_REPO_PATH Auto-detected from cwd`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latinfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Tax registry & procurement API for Latin America. Query RUC, DNI, NIT, licitaciones from Peru & Colombia. Offline MPHF search, full OCDS data, updated daily.",
|
|
5
5
|
"homepage": "https://latinfo.dev",
|
|
6
6
|
"repository": {
|