Skip to content

Commit

Permalink
Tweak openssl1 detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bigorn0 committed Sep 26, 2023
1 parent e3a0b3a commit 1cdd75d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);

Expand Down
6 changes: 4 additions & 2 deletions rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ 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}`;
const nativeModuleScopedPackage = path.join(
ROOT_DIR,
'node_modules',
'@hackolade',
`${module.name}-${targetPlatform}-${targetArch}`,
`${prebuildModuleNameForTarget}`,
);
await rm(nativeModuleScopedPackage, { force: true, recursive: true });
await mkdir(nativeModuleScopedPackage, { force: true, recursive: true });
Expand Down

0 comments on commit 1cdd75d

Please sign in to comment.