Skip to content

Commit

Permalink
Remove unused NPM libraries from package.json (microsoft#771)
Browse files Browse the repository at this point in the history
* Remove unused FontAwesome free icons

Signed-off-by: Mick Vleeshouwer <[email protected]>

* Remove unused imports, comment unused code

Signed-off-by: Mick Vleeshouwer <[email protected]>

* Remove jquery

Signed-off-by: Mick Vleeshouwer <[email protected]>

* Remove unused serialize-javascript

Signed-off-by: Mick Vleeshouwer <[email protected]>

* Move yarn to dev dependencies

Signed-off-by: Mick Vleeshouwer <[email protected]>

* Move rimraf to devDependencies

Signed-off-by: Mick Vleeshouwer <[email protected]>

Co-authored-by: stew-ro <[email protected]>
  • Loading branch information
iMicknl and stew-ro authored Nov 16, 2020
1 parent 4fcd7ff commit 457ee9a
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 46 deletions.
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@
"reactstrap": "^8.2.0",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"rimraf": "^3.0.2",
"serialize-javascript": "^5.0.1",
"shortid": "^2.2.15",
"utif": "^3.1.0",
"vott-react": "^0.2.12",
"yarn": "^1.22.4"
"vott-react": "^0.2.12"
},
"scripts": {
"start": "env-cmd -f .env.electron nf start -p 3000",
Expand Down Expand Up @@ -84,7 +81,6 @@
]
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.12.0",
"@types/axios": "^0.14.0",
"@types/enzyme": "^3.10.4",
"@types/history": "^4.7.3",
Expand All @@ -106,7 +102,6 @@
"enzyme-adapter-react-16": "^1.15.1",
"eslint-utils": "^1.4.3",
"foreman": "^3.0.1",
"jquery": "^3.5.0",
"kind-of": "^6.0.3",
"mime": "^2.4.6",
"minimist": "^1.2.2",
Expand All @@ -117,11 +112,13 @@
"redux-immutable-state-invariant": "^2.1.0",
"redux-logger": "^3.0.6",
"redux-mock-store": "^1.5.4",
"rimraf": "^3.0.2",
"ts-loader": "^7.0.1",
"tslint": "^6.1.1",
"typescript": "^3.9.5",
"webpack-cli": "^3.3.11",
"webpack-merge": "^4.2.2"
"webpack-merge": "^4.2.2",
"yarn": "^1.22.10"
},
"engines": {
"node": ">=12.13.1",
Expand Down
1 change: 0 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
import "../node_modules/@fortawesome/fontawesome-free/css/all.css";
import "./assets/css/bootstrap-theme-slate.css";
import "./index.scss";
import App from "./App";
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/pages/editorPage/tableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const TableView: React.FunctionComponent<ITableViewProps> = (props) => {
if (table !== null) {
tableBody = [];
const rows = table["rows"];
const columns = table["columns"];
// const columns = table["columns"];
for (let i = 0; i < rows; i++) {
const tableRow = [];
tableBody.push(<tr key={i}>{tableRow}</tr>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
TooltipHost
} from "@fluentui/react";
import Fill from "ol/style/Fill";
import Icon from "ol/style/Icon";
import Stroke from "ol/style/Stroke";
import Style from "ol/style/Style";
import React from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/pages/train/trainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {constants} from "../../../../common/constants";
import {isElectron} from "../../../../common/hostProcess";
import {interpolate, strings} from "../../../../common/strings";
import {getGreenWithWhiteBackgroundTheme, getPrimaryGreenTheme} from "../../../../common/themes";
import {AssetLabelingState, AssetState, FieldType, IApplicationState, IAppSettings, IAssetMetadata, IConnection, IProject, IRecentModel} from "../../../../models/applicationState";
import {AssetLabelingState, FieldType, IApplicationState, IAppSettings, IAssetMetadata, IConnection, IProject, IRecentModel} from "../../../../models/applicationState";
import IApplicationActions, * as applicationActions from "../../../../redux/actions/applicationActions";
import IAppTitleActions, * as appTitleActions from "../../../../redux/actions/appTitleActions";
import IProjectActions, * as projectActions from "../../../../redux/actions/projectActions";
Expand Down
20 changes: 9 additions & 11 deletions src/redux/actions/projectActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import {
IProject,
ITag,
ISecurityToken,
AssetState,
AssetLabelingState,
} from "../../models/applicationState";
import { createAction, createPayloadAction, IPayloadAction } from "./actionCreators";
import { appInfo } from "../../common/appInfo";
Expand All @@ -35,7 +33,7 @@ export default interface IProjectActions {
addAssetToProject(project: IProject, fileName: string, buffer: Buffer, analyzeResult: any): Promise<IAsset>;
deleteAsset(project: IProject, assetMetadata: IAssetMetadata): Promise<void>;
loadAssets(project: IProject): Promise<IAsset[]>;
refreshAsset(project: IProject, assetName: string):Promise<void>;
refreshAsset(project: IProject, assetName: string): Promise<void>;
loadAssetMetadata(project: IProject, asset: IAsset): Promise<IAssetMetadata>;
saveAssetMetadata(project: IProject, assetMetadata: IAssetMetadata): Promise<IAssetMetadata>;
saveAssetMetadataAndCleanEmptyLabel(project: IProject, assetMetadata: IAssetMetadata): Promise<IAssetMetadata>;
Expand Down Expand Up @@ -158,7 +156,7 @@ export function deleteProject(project: IProject)

if (!projectToken) {
dispatch(deleteProjectAction(project));
throw new AppError(ErrorCode.SecurityTokenNotFound, interpolate(strings.errors.projectDeleteErrorSecurityTokenNotFound.message, {project}));
throw new AppError(ErrorCode.SecurityTokenNotFound, interpolate(strings.errors.projectDeleteErrorSecurityTokenNotFound.message, { project }));
}

const decryptedProject = await projectService.load(project, projectToken);
Expand Down Expand Up @@ -235,11 +233,11 @@ function areAssetsEqual(assets: IAsset[], projectAssets: { [index: string]: IAss
return JSON.stringify(assetsMap) === JSON.stringify(projectAssets);
}

export function refreshAsset(project: IProject, assetName:string):(dispatch:Dispatch) => Promise<void> {
return async (dispatch:Dispatch) =>{
export function refreshAsset(project: IProject, assetName: string): (dispatch: Dispatch) => Promise<void> {
return async (dispatch: Dispatch) => {
const assetService = new AssetService(project);
const asset = await assetService.getAsset( assetName);
dispatch(refreshAssetAction( asset));
const asset = await assetService.getAsset(assetName);
dispatch(refreshAssetAction(asset));
}
}

Expand Down Expand Up @@ -280,11 +278,11 @@ export function saveAssetMetadata(
export function saveAssetMetadataAndCleanEmptyLabel(
project: IProject,
assetMetadata: IAssetMetadata): (dispatch: Dispatch) => Promise<IAssetMetadata> {
const newAssetMetadata: IAssetMetadata = { ...(_.cloneDeep(assetMetadata)), version: appInfo.version};
const newAssetMetadata: IAssetMetadata = { ...(_.cloneDeep(assetMetadata)), version: appInfo.version };

return async (dispatch: Dispatch) => {
const assetService = new AssetService(project);
const savedMetadata = await assetService.save(newAssetMetadata,true);
const savedMetadata = await assetService.save(newAssetMetadata, true);
dispatch(saveAssetMetadataAction(savedMetadata));

return { ...savedMetadata };
Expand Down Expand Up @@ -475,7 +473,7 @@ export const deleteProjectAssetAction =
createPayloadAction<IDeleteProjectAssetAction>(ActionTypes.DELETE_PROJECT_ASSET_SUCCESS);

export const refreshAssetAction =
createPayloadAction<IRefreshAssetAction>(ActionTypes.REFRESH_ASSET_SUCCESS);
createPayloadAction<IRefreshAssetAction>(ActionTypes.REFRESH_ASSET_SUCCESS);
/**
* Instance of Load Asset Metadata action
*/
Expand Down
3 changes: 1 addition & 2 deletions src/redux/reducers/currentProjectReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.

import {ActionTypes} from "../actions/actionTypes";
import {AssetLabelingState, AssetState, IProject, ITag} from "../../models/applicationState";
import {IProject, ITag} from "../../models/applicationState";
import {AnyAction} from "../actions/actionCreators";
import _ from "lodash";
// tslint:disable-next-line:no-var-requires
Expand Down Expand Up @@ -43,7 +43,6 @@ export const reducer = (state: IProject = null, action: AnyAction): IProject =>
...state,
assets:{...state.assets, [action.payload.id]: action.payload},
};
break;
case ActionTypes.DELETE_PROJECT_ASSET_SUCCESS:
case ActionTypes.LOAD_PROJECT_ASSETS_SUCCESS:
let assets = {};
Expand Down
2 changes: 1 addition & 1 deletion src/services/assetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const imageMimes: IMime[] = [
},
];
// We can expand this list @see https://mimesniff.spec.whatwg.org/#matching-an-image-type-pattern
const mimeBytesNeeded: number = (Math.max(...imageMimes.map((m) => m.pattern.length)) - 1);
// const mimeBytesNeeded: number = (Math.max(...imageMimes.map((m) => m.pattern.length)) - 1);

/**
* @name - Asset Service
Expand Down
25 changes: 4 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1310,11 +1310,6 @@
office-ui-fabric-react "^7.121.0"
tslib "^1.10.0"

"@fortawesome/fontawesome-free@^5.12.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.13.0.tgz#fcb113d1aca4b471b709e8c9c168674fbd6e06d9"
integrity sha512-xKOeQEl5O47GPZYIMToj6uuA2syyFlq9EMSl2ui0uytjY9xbe8XS0pexNWmxrdcCyNGyDmLyYw5FtKsalBUeOg==

"@hapi/[email protected]":
version "2.1.4"
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"
Expand Down Expand Up @@ -7695,11 +7690,6 @@ [email protected]:
import-local "^2.0.0"
jest-cli "^24.9.0"

jquery@^3.5.0:
version "3.5.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==

js-base64@^2.1.8:
version "2.5.2"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.2.tgz#313b6274dda718f714d00b3330bbae6e38e90209"
Expand Down Expand Up @@ -11777,13 +11767,6 @@ serialize-javascript@^3.1.0:
dependencies:
randombytes "^2.1.0"

serialize-javascript@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4"
integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==
dependencies:
randombytes "^2.1.0"

serve-index@^1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239"
Expand Down Expand Up @@ -13873,10 +13856,10 @@ yargs@^16.0.3:
y18n "^5.0.5"
yargs-parser "^20.2.2"

yarn@^1.22.4:
version "1.22.4"
resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.4.tgz#01c1197ca5b27f21edc8bc472cd4c8ce0e5a470e"
integrity sha512-oYM7hi/lIWm9bCoDMEWgffW8aiNZXCWeZ1/tGy0DWrN6vmzjCXIKu2Y21o8DYVBUtiktwKcNoxyGl/2iKLUNGA==
yarn@^1.22.10:
version "1.22.10"
resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.10.tgz#c99daa06257c80f8fa2c3f1490724e394c26b18c"
integrity sha512-IanQGI9RRPAN87VGTF7zs2uxkSyQSrSPsju0COgbsKQOOXr5LtcVPeyXWgwVa0ywG3d8dg6kSYKGBuYK021qeA==

yauzl@^2.10.0:
version "2.10.0"
Expand Down

0 comments on commit 457ee9a

Please sign in to comment.