Skip to content

Commit

Permalink
🌱 Refactor shared package imports (#100)
Browse files Browse the repository at this point in the history
The `@shared/types` package does not actually exist. It was only working
because there was a vestigial reference for it in the `package-lock.json` file
from before the shared workspace package was renamed from 
`@shared/types` to `@editor-extensions/shared`.  `@shared/types` was
pointing to the shared workspace.

Fixes:
  - Remove the `@shared/types` reference in the lock file
  - Refactor all of the imports to pull from the current npm package name

Signed-off-by: Scott J Dickerson <[email protected]>
  • Loading branch information
sjd78 authored Nov 15, 2024
1 parent 477eda8 commit 42c2515
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 40 deletions.
8 changes: 1 addition & 7 deletions package-lock.json

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

30 changes: 15 additions & 15 deletions shared/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@editor-extensions/shared",
"version": "1.0.0",
"private": true,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc -b tsconfig.json",
"clean": "rimraf dist",
"prebuild": "npm run clean"
},
"devDependencies": {
"rimraf": "^5.0.0",
"typescript": "^5.0.0"
}
}
"name": "@editor-extensions/shared",
"version": "0.0.1",
"private": true,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc -b tsconfig.json",
"clean": "rimraf dist",
"prebuild": "npm run clean"
},
"devDependencies": {
"rimraf": "^5.0.0",
"typescript": "^5.0.0"
}
}
3 changes: 1 addition & 2 deletions vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,7 @@
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@shared/types": "^1.0.0",
"babel-loader": "^9.2.1",
"diff": "^7.0.0"
}
}
}
2 changes: 1 addition & 1 deletion vscode/src/client/analyzerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChildProcessWithoutNullStreams, exec, spawn } from "child_process";
import * as vscode from "vscode";
import * as os from "os";
import * as fs from "fs";
import { Incident, RuleSet } from "@shared/types";
import { Incident, RuleSet } from "@editor-extensions/shared";

import path from "path";

Expand Down
2 changes: 1 addition & 1 deletion vscode/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
loadSolution,
loadStaticResults,
} from "./data";
import { GetSolutionResult, RuleSet } from "@shared/types";
import { GetSolutionResult, RuleSet } from "@editor-extensions/shared";
import {
applyAll,
revertAll,
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/data/analyzerResults.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from "vscode";
import * as fs from "fs";
import * as yaml from "js-yaml";
import { RuleSet, Category, Incident } from "@shared/types";
import { RuleSet, Category, Incident } from "@editor-extensions/shared";

//Assuming that output is in form of yaml
export function readYamlFile(filePath: string): RuleSet[] | undefined {
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/data/loadResults.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetSolutionResult, RuleSet } from "@shared/types";
import { GetSolutionResult, RuleSet } from "@editor-extensions/shared";
import { processIncidents } from "./analyzerResults";
import { ExtensionState } from "src/extensionState";
import { writeDataFile } from "./storage";
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/data/loadStaticResults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from "vscode";
import { RuleSet } from "@shared/types";
import { RuleSet } from "@editor-extensions/shared";
import { loadStateFromDataFolder, readDataFiles } from "./storage";

export const loadStaticResults = async () => {
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/data/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from "path";
import * as vscode from "vscode";
import fs from "fs";

import { RuleSet, GetSolutionResult } from "@shared/types";
import { RuleSet, GetSolutionResult } from "@editor-extensions/shared";
import {
isAnalysis,
isSolution,
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/data/virtualStorage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetSolutionResult } from "@shared/types";
import { GetSolutionResult } from "@editor-extensions/shared";
import { Uri, window, workspace } from "vscode";
import { ExtensionState } from "src/extensionState";
import * as Diff from "diff";
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/extensionState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MemFS } from "./data/fileSystemProvider";
import { KonveyorGUIWebviewViewProvider } from "./KonveyorGUIWebviewViewProvider";
import * as vscode from "vscode";
import { LocalChange } from "./data/virtualStorage";
import { RuleSet } from "@shared/types";
import { RuleSet } from "@editor-extensions/shared";

export class SharedState {
private state: Map<string, any> = new Map();
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/test/analyzerResults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as assert from "assert";
import { DiagnosticSeverity } from "vscode";
import * as path from "path";
import { processIncidents, readYamlFile } from "../data/analyzerResults";
import { RuleSet } from "@shared/types";
import { RuleSet } from "@editor-extensions/shared";

suite("Extension Test Suite", () => {
test("processIncidents should populate diagnostics correctly", () => {
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/utilities/typeGuards.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetSolutionResult, RuleSet } from "@shared/types";
import { GetSolutionResult, RuleSet } from "@editor-extensions/shared";
import { Uri } from "vscode";

const isString = (obj: unknown): obj is string => typeof obj === "string";
Expand Down
5 changes: 2 additions & 3 deletions webview-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"@patternfly/react-core": "6.0.0-prerelease.15",
"@patternfly/react-icons": "^5.4.0",
"@patternfly/react-table": "^5.4.1",
"vscode-webview": "^1.0.1-beta.1",
"@shared/types": "^1.0.0"
"vscode-webview": "^1.0.1-beta.1"
},
"devDependencies": {
"@types/vscode-webview": "^1.57.5",
Expand All @@ -25,4 +24,4 @@
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "4.9.5"
}
}
}
2 changes: 1 addition & 1 deletion webview-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { vscode } from "./utils/vscode";
import GuidedApproachWizard from "./components/GuidedApproachWizard";
import ProgressIndicator from "./components/ProgressIndicator";
import ViolationIncidentsList from "./components/ViolationIncidentsList";
import { Incident, RuleSet } from "@shared/types";
import { Incident, RuleSet } from "@editor-extensions/shared";

const App: React.FC = () => {
const [analysisResults, setAnalysisResults] = useState<RuleSet[] | null>();
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/components/GuidedApproachWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from "@patternfly/react-core";
import ViolationIncidentsList from "./ViolationIncidentsList";
import { vscode } from "../utils/vscode";
import { Incident, Violation } from "@shared/types/src/types";
import { Incident, Violation } from "@editor-extensions/shared/src/types";

interface GuidedApproachWizardProps {
violations: Violation[];
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/components/ViolationIncidentsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
FileIcon,
EllipsisVIcon,
} from "@patternfly/react-icons";
import { Incident, Violation } from "@shared/types";
import { Incident, Violation } from "@editor-extensions/shared";

type SortOption = "description" | "incidentCount" | "severity";

Expand Down

0 comments on commit 42c2515

Please sign in to comment.