From 1cdd75d25d0ccc32e7dfeec41448a7099a1a37d8 Mon Sep 17 00:00:00 2001 From: Ugo Bechameil Date: Tue, 26 Sep 2023 11:17:27 +0200 Subject: [PATCH] Tweak openssl1 detection --- lib/publish.js | 6 +++--- rebuild.js | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/publish.js b/lib/publish.js index c99a8ff..b0f05b3 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -213,11 +213,11 @@ export async function checkPackageVersionAlreadyExists({token, packageName, vers // having the scope in the package name results always in NOT FOUND 404 const name = packageName.replaceAll(/@hackolade\//gi, ''); + log('--> checking package %o has version %o already published to GitHub packages', packageName, version); + try{ const client = getGithubClient(token); - - // https://docs.github.com/en/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-an-organization const response = await client.packages.getAllPackageVersionsForPackageOwnedByOrg({ package_type: 'npm', @@ -239,7 +239,7 @@ export async function checkPackageVersionAlreadyExists({token, packageName, vers } export async function checkPackageVersionExistsFromPath({packagePath, token}){ - + log('--> use package.json file at %o to check if version %o already exists on Github Packages for module %o', packagePath, version, packageName); const pkg = await readFile(path.join(packagePath, 'package.json')); const {name, version} = JSON.parse(pkg); diff --git a/rebuild.js b/rebuild.js index 874aabe..b467765 100644 --- a/rebuild.js +++ b/rebuild.js @@ -47,9 +47,11 @@ if (platform() === 'win32') { // Detect Ubuntu version to know if we need to specifically build modules for Openssl 1 like Couchbase const ubuntuReleaseFile = await readFile(path.resolve('/etc/os-release')); -const mustBuildForOpenSSL1 = ubuntuReleaseFile.toString('UTF8').split('\n').filter(line => line.includes('VERSION_ID=20.04')).length > 0; +const mustBuildForOpenSSL1 = ubuntuReleaseFile.toString('UTF8').split('\n').filter(line => line.includes('VERSION_ID=20.04')).length > 0 || []; const modulesToBuildOnlyForOpenSSL1 = modulesToBuild.filter(module => module.name === 'couchbase'); +log('must build for Openssl1: %O', ubuntuReleaseFile); + for (const { module, targetPlatform, targetArch } of mustBuildForOpenSSL1 ? modulesToBuildOnlyForOpenSSL1: modulesToBuild) { const prebuildModuleNameForTarget = `${module.name}-${targetPlatform}-${targetArch}`; @@ -57,7 +59,7 @@ for (const { module, targetPlatform, targetArch } of mustBuildForOpenSSL1 ? modu ROOT_DIR, 'node_modules', '@hackolade', - `${module.name}-${targetPlatform}-${targetArch}`, + `${prebuildModuleNameForTarget}`, ); await rm(nativeModuleScopedPackage, { force: true, recursive: true }); await mkdir(nativeModuleScopedPackage, { force: true, recursive: true });