Skip to content

Commit

Permalink
Fix component IRIs version to major version only
Browse files Browse the repository at this point in the history
* Set IRI version to major version only

* Simplified version in IRI

* Add semver dependency
  • Loading branch information
RubenEschauzier committed Sep 13, 2023
1 parent 680bf08 commit 42f0ce8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/jbr/lib/task/ExperimentLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import {
ParameterPropertyHandlerRange,
} from 'componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange';
import * as fs from 'fs-extra';
import { major } from 'semver';
import type { CombinationProvider } from '../..';
import { createExperimentPaths } from '../cli/CliHelpers';
import { ErrorHandled } from '../cli/ErrorHandled';
import type { Experiment } from '../experiment/Experiment';
import type { ExperimentHandler } from '../experiment/ExperimentHandler';
import type { HookHandler } from '../hook/HookHandler';
import type { IExperimentPaths } from './ITaskContext';

const pJson = require('../../package.json');

/**
Expand All @@ -23,8 +25,11 @@ export class ExperimentLoader {
public static readonly COMBINATIONS_NAME = 'jbr-combinations.json';
public static readonly PACKAGEJSON_NAME = 'package.json';
public static readonly PREPAREDMARKER_PATH = [ 'generated', '.prepared' ];
public static readonly IRI_EXPERIMENT_HANDLER = `https://linkedsoftwaredependencies.org/bundles/npm/jbr/^${pJson.version}/components/experiment/ExperimentHandler.jsonld#ExperimentHandler`;
public static readonly IRI_HOOK_HANDLER = `https://linkedsoftwaredependencies.org/bundles/npm/jbr/^${pJson.version}/components/hook/HookHandler.jsonld#HookHandler`;
public static readonly IRI_EXPERIMENT_HANDLER = `https://linkedsoftwaredependencies.org/bundles/npm/jbr/` +
`^${major(pJson.version)}.0.0/components/experiment/ExperimentHandler.jsonld#ExperimentHandler`;

public static readonly IRI_HOOK_HANDLER = `https://linkedsoftwaredependencies.org/bundles/npm/jbr/` +
`^${major(pJson.version)}.0.0/components/hook/HookHandler.jsonld#HookHandler`;

private readonly componentsManager: ComponentsManager<any>;

Expand Down
2 changes: 2 additions & 0 deletions packages/jbr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@types/cross-spawn": "^6.0.2",
"@types/dockerode": "^3.2.3",
"@types/fs-extra": "^9.0.11",
"@types/semver": "^7.5.1",
"@types/tar": "^4.0.5",
"@types/yargs": "^17.0.0",
"cli-progress": "^3.9.0",
Expand All @@ -75,6 +76,7 @@
"dockerode": "^3.3.0",
"fs-extra": "^10.0.0",
"ora": "^5.4.0",
"semver": "^7.5.4",
"tar": "^6.1.7",
"winston": "^3.3.3",
"yargs": "^17.0.0"
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3810,7 +3810,7 @@
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a"
integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==

"@types/semver@^7.3.12", "@types/semver@^7.3.4":
"@types/semver@^7.3.12", "@types/semver@^7.3.4", "@types/semver@^7.5.1":
version "7.5.1"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.1.tgz#0480eeb7221eb9bc398ad7432c9d7e14b1a5a367"
integrity sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==
Expand Down

0 comments on commit 42f0ce8

Please sign in to comment.