Skip to content

Commit

Permalink
feat: add OSS Index dependency provider
Browse files Browse the repository at this point in the history
Signed-off-by: Ilona Shishov <[email protected]>
  • Loading branch information
IlonaShishov committed Nov 22, 2023
1 parent 4e6229a commit dac9b69
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Update package with new version
id: bump
run: |
echo "version=$(npm version prerelease --no-git-tag-version --preid ea)" >> "$GITHUB_OUTPUT"
echo "version=$(npm version ${{ vars.VERSION_BUMPING_TYPE }} --no-git-tag-version --preid ea)" >> "$GITHUB_OUTPUT"
- name: Install project modules
run: npm ci
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
const response = await github.request('POST /repos/' + repo_name + '/releases', {
tag_name: '${{ steps.bump.outputs.version }}',
name: '${{ steps.bump.outputs.version }}',
prerelease: true,
prerelease: false,
generate_release_notes: true
})
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dist"
],
"dependencies": {
"@RHEcosystemAppEng/exhort-javascript-api": "^0.1.0",
"@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.0",
"@xml-tools/ast": "^5.0.5",
"@xml-tools/parser": "^1.0.11",
"json-to-ast": "^2.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export interface IDependency {
* Represents a dependency and implements the IDependency interface.
*/
export class Dependency implements IDependency {
public version: IPositionedString
public context: IPositionedContext
public version: IPositionedString;
public context: IPositionedContext;

constructor(
public name: IPositionedString
Expand Down
4 changes: 4 additions & 0 deletions src/componentAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ async function componentAnalysisService (fileType: string, contents: string): Pr
if (globalConfig.exhortSnykToken !== '') {
options['EXHORT_SNYK_TOKEN'] = globalConfig.exhortSnykToken;
}
if (globalConfig.exhortOSSIndexUser !== '' && globalConfig.exhortOSSIndexToken !== '') {
options['EXHORT_OSS_INDEX_USER'] = globalConfig.exhortOSSIndexUser;
options['EXHORT_OSS_INDEX_TOKEN'] = globalConfig.exhortOSSIndexToken;
}

const componentAnalysisJson = await exhort.componentAnalysis(fileType, contents, options); // Execute component analysis

Expand Down
6 changes: 6 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export class Config
utmSource: string;
exhortDevMode: string;
exhortSnykToken: string;
exhortOSSIndexUser: string;
exhortOSSIndexToken: string;
matchManifestVersions: string;
exhortMvnPath: string;
exhortNpmPath: string;
Expand All @@ -33,6 +35,8 @@ export class Config
this.utmSource = process.env.VSCEXT_UTM_SOURCE || '';
this.exhortDevMode = process.env.VSCEXT_EXHORT_DEV_MODE || 'false';
this.exhortSnykToken = process.env.VSCEXT_EXHORT_SNYK_TOKEN || '';
this.exhortOSSIndexUser = process.env.VSCEXT_EXHORT_OSS_INDEX_USER || '';
this.exhortOSSIndexToken = process.env.VSCEXT_EXHORT_OSS_INDEX_TOKEN || '';
this.matchManifestVersions = process.env.VSCEXT_MATCH_MANIFEST_VERSIONS || 'true';
this.exhortMvnPath = process.env.VSCEXT_EXHORT_MVN_PATH || 'mvn';
this.exhortNpmPath = process.env.VSCEXT_EXHORT_NPM_PATH || 'npm';
Expand All @@ -49,6 +53,8 @@ export class Config
*/
updateConfig( data: any ) {
this.exhortSnykToken = data.redHatDependencyAnalytics.exhortSnykToken;
this.exhortOSSIndexUser = data.redHatDependencyAnalytics.exhortOSSIndexUser;
this.exhortOSSIndexToken = data.redHatDependencyAnalytics.exhortOSSIndexToken;
this.matchManifestVersions = data.redHatDependencyAnalytics.matchManifestVersions ? 'true' : 'false';
this.exhortMvnPath = data.mvn.executable.path || 'mvn';
this.exhortNpmPath = data.npm.executable.path || 'npm';
Expand Down
2 changes: 1 addition & 1 deletion src/diagnosticsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */
'use strict';

import { Diagnostic, CodeAction } from 'vscode-languageserver';
import { Diagnostic } from 'vscode-languageserver';
import { DependencyMap, IDependencyProvider } from './collector';
import { componentAnalysisService, DependencyData } from './componentAnalysis';
import { Vulnerability } from './vulnerability';
Expand Down
1 change: 0 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* ------------------------------------------------------------------------------------------ */
'use strict';

import * as path from 'path';
import { TextDocumentSyncKind, Connection, DidChangeConfigurationNotification } from 'vscode-languageserver';
import { createConnection, TextDocuments, InitializeResult, CodeAction, ProposedFeatures } from 'vscode-languageserver/node';
import { TextDocument } from 'vscode-languageserver-textdocument';
Expand Down

0 comments on commit dac9b69

Please sign in to comment.