Skip to content

Commit

Permalink
Update file paths and imports. Upgraded to webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
Power-Maverick committed Dec 28, 2023
1 parent 6484c59 commit cfda5a4
Show file tree
Hide file tree
Showing 12 changed files with 2,267 additions and 1,360 deletions.
3,387 changes: 2,118 additions & 1,269 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 24 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dataverse-devtools",
"displayName": "Dataverse DevTools",
"version": "2.1.13",
"version": "2.2.0",
"description": "The all-in-one tool to develop code for Dataverse/Dynamics 365. Helps you connect to a Dataverse environment, generate TypeScript definitions for entities, create different type of Dataverse-specific projects and much more.",
"publisher": "danish-naglekar",
"author": {
Expand All @@ -20,17 +20,20 @@
"*"
],
"engines": {
"vscode": "^1.58.0"
"vscode": "^1.80.0"
},
"main": "./out/extension.js",
"main": "./dist/extension.js",
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"vscode:prepublish": "npm run package",
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "vscode-test",
"format": "prettier --write src",
"test": "node ./out/test/runTest.js",
"version": "auto-changelog -p && git add CHANGELOG.md",
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate"
Expand Down Expand Up @@ -551,27 +554,32 @@
"devDependencies": {
"@types/glob": "^7.1.3",
"@types/mocha": "^8.2.2",
"@types/node": "14.x",
"@types/node": "18.x",
"@types/node-fetch": "^2.5.11",
"@types/uuid": "^8.3.1",
"@types/vscode": "^1.58.0",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"@types/vscode": "^1.80.0",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@vscode/test-cli": "^0.0.4",
"@vscode/test-electron": "^2.3.8",
"all-contributors-cli": "^6.20.0",
"auto-changelog": "^2.3.0",
"eslint": "^7.27.0",
"copy-webpack-plugin": "^11.0.0",
"eslint": "^8.56.0",
"glob": "^7.1.7",
"mocha": "^10.0.0",
"typescript": "^4.3.2",
"vscode-test": "^1.5.2"
"ts-loader": "^9.5.1",
"typescript": "^5.3.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@azure/identity": "^3.0.0",
"@azure/identity-vscode": "^1.0.0",
"@azure/msal-node": "^1.3.0",
"@types/fs-extra": "^9.0.12",
"@types/lodash": "^4.14.171",
"@vscode/extension-telemetry": "^0.8.5",
"@vscode/extension-telemetry": "^0.9.2",
"axios": "^0.27.2",
"conditional-reduce": "^1.2.0",
"dayjs": "^1.10.7",
Expand Down
11 changes: 5 additions & 6 deletions src/cliCommands/cliCommandsDataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as vscode from "vscode";
import * as path from "path";
import * as config from "../utils/Config";
import { ICliCommandVerb, ICliCommandList } from "../utils/Interfaces";
import { CliCommandItemBase } from "./cliCommandsItemBase";
import * as vscode from "vscode";
import { ICliCommandList, ICliCommandVerb } from "../utils/Interfaces";
import cliInJson from "./cliCommands.json";
import { CliCommandItemBase } from "./cliCommandsItemBase";

export class CliCommandDataProvider implements vscode.TreeDataProvider<CliCommandTreeItem> {
private cliCommands: ICliCommandList | undefined;
Expand Down Expand Up @@ -56,8 +55,8 @@ export class CliCommandTreeItem extends CliCommandItemBase {
}

iconPath = {
light: path.join(__filename, "..", "..", "..", "resources", "light", this.level === 1 ? "folder.svg" : this.level === 2 ? "cli.svg" : "generic.svg"),
dark: path.join(__filename, "..", "..", "..", "resources", "dark", this.level === 1 ? "folder.svg" : this.level === 2 ? "cli.svg" : "generic.svg"),
light: path.join(__filename, "..", "resources", "light", this.level === 1 ? "folder.svg" : this.level === 2 ? "cli.svg" : "generic.svg"),
dark: path.join(__filename, "..", "resources", "dark", this.level === 1 ? "folder.svg" : this.level === 2 ? "cli.svg" : "generic.svg"),
};

contextValue = this.level === 2 ? "cli-command" : "cli-group";
Expand Down
6 changes: 3 additions & 3 deletions src/cliCommands/cliCommandsItemBase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from "vscode";
import * as path from "path";
import * as vscode from "vscode";

export class CliCommandItemBase extends vscode.TreeItem {
constructor(public readonly label: string, public readonly desc: string | undefined, public readonly collapsibleState: vscode.TreeItemCollapsibleState) {
Expand All @@ -10,8 +10,8 @@ export class CliCommandItemBase extends vscode.TreeItem {
}

iconPath = {
light: path.join(__filename, "..", "..", "..", "resources", "light", "generic.svg"),
dark: path.join(__filename, "..", "..", "..", "resources", "dark", "generic.svg"),
light: path.join(__filename, "..", "resources", "light", "generic.svg"),
dark: path.join(__filename, "..", "resources", "dark", "generic.svg"),
};

//contextValue = this.level === 2 ? "connection" : "connection-child";
Expand Down
9 changes: 5 additions & 4 deletions src/login/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as fs from "fs";
import * as http from "http";
import * as net from "net";
import * as path from "path";
import * as url from "url";
import { parse, ParsedUrlQuery } from "querystring";
import * as url from "url";

interface Deferred<T> {
resolve: (result: T | Promise<T>) => void;
Expand Down Expand Up @@ -88,10 +88,10 @@ export function createServer(nonce: string): {
}
break;
case "/":
sendFile(res, path.join(__filename, "..", "..", "..", "CodeFlowResult", "index.html"), "text/html; charset=utf-8");
sendFile(res, path.join(__filename, "..", "CodeFlowResult", "index.html"), "text/html; charset=utf-8");
break;
case "/main.css":
sendFile(res, path.join(__filename, "..", "..", "..", "CodeFlowResult", "main.css"), "text/css; charset=utf-8");
sendFile(res, path.join(__filename, "..", "CodeFlowResult", "main.css"), "text/css; charset=utf-8");
break;
case "/callback/":
deferredCode.resolve(
Expand Down Expand Up @@ -137,10 +137,11 @@ export function createTerminateServer(server: http.Server): () => Promise<void>
}

export async function startServer(server: http.Server, adfs: boolean): Promise<number> {
let portTimer: NodeJS.Timer;
let portTimer: NodeJS.Timeout;
function cancelPortTimer() {
clearTimeout(portTimer);
}

const portPromise = new Promise<number>((resolve, reject) => {
portTimer = setTimeout(() => {
reject(new Error("Timeout waiting for port"));
Expand Down
8 changes: 2 additions & 6 deletions src/tools/toolsDataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as vscode from "vscode";
import * as path from "path";
import * as vscode from "vscode";
import { ITools } from "../utils/Interfaces";
import { ToolsItemBase } from "./toolsItemBase";
import toolsInJson from "./tools.json";
import { ToolsItemBase } from "./toolsItemBase";

export class ToolsDataProvider implements vscode.TreeDataProvider<ToolsTreeItem> {
constructor(private vscontext: vscode.ExtensionContext) {}
Expand Down Expand Up @@ -32,17 +32,13 @@ export class ToolsTreeItem extends ToolsItemBase {
light: path.join(
__filename,
"..",
"..",
"..",
"resources",
"toolIcons",
this.toolShortName === "drb" ? "drb.png" : this.toolShortName === "prt" ? "prt.png" : this.toolShortName === "cmt" ? "cmt.png" : this.toolShortName === "pd" ? "pd.png" : "generic.svg",
),
dark: path.join(
__filename,
"..",
"..",
"..",
"resources",
"toolIcons",
this.toolShortName === "drb" ? "drb.png" : this.toolShortName === "prt" ? "prt.png" : this.toolShortName === "cmt" ? "cmt.png" : this.toolShortName === "pd" ? "pd.png" : "generic.svg",
Expand Down
6 changes: 3 additions & 3 deletions src/tools/toolsItemBase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from "vscode";
import * as path from "path";
import * as vscode from "vscode";

export class ToolsItemBase extends vscode.TreeItem {
constructor(public readonly toolName: string, public readonly authorName: string | undefined, public readonly collapsibleState: vscode.TreeItemCollapsibleState) {
Expand All @@ -10,8 +10,8 @@ export class ToolsItemBase extends vscode.TreeItem {
}

iconPath = {
light: path.join(__filename, "..", "..", "..", "resources", "light", "generic.svg"),
dark: path.join(__filename, "..", "..", "..", "resources", "dark", "generic.svg"),
light: path.join(__filename, "..", "resources", "light", "generic.svg"),
dark: path.join(__filename, "..", "resources", "dark", "generic.svg"),
};

//contextValue = this.level === 2 ? "connection" : "connection-child";
Expand Down
12 changes: 4 additions & 8 deletions src/trees/dataverseConnectionDataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as vscode from "vscode";
import { observable } from "mobx";
import * as path from "path";
import { State } from "../utils/State";
import * as vscode from "vscode";
import { connectionCurrentStoreKey, connectionStoreKey, environmentTypes, extensionPrefix } from "../utils/Constants";
import { IConnection, IStore } from "../utils/Interfaces";
import { observable } from "mobx";
import { groupBy } from "../utils/ExtensionMethods";
import { IConnection, IStore } from "../utils/Interfaces";
import { State } from "../utils/State";
import { TreeItemBase } from "./treeItemBase";

export class DataverseConnectionDataProvider implements vscode.TreeDataProvider<DataverseConnectionTreeItem> {
Expand Down Expand Up @@ -119,8 +119,6 @@ export class DataverseConnectionTreeItem extends TreeItemBase {
light: path.join(
__filename,
"..",
"..",
"..",
"resources",
"light",
this.level === 1
Expand All @@ -136,8 +134,6 @@ export class DataverseConnectionTreeItem extends TreeItemBase {
dark: path.join(
__filename,
"..",
"..",
"..",
"resources",
"dark",
this.level === 1
Expand Down
16 changes: 8 additions & 8 deletions src/trees/entitiesDataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as vscode from "vscode";
import * as path from "path";
import { State } from "../utils/State";
import { entityDefinitionsStoreKey, extensionName, extensionPrefix } from "../utils/Constants";
import { IStore, IEntityDefinition, IEntityMetadata, ISolutionComponents, ISolutionComponent } from "../utils/Interfaces";
import { observable } from "mobx";
import { TreeItemBase } from "./treeItemBase";
import * as path from "path";
import * as vscode from "vscode";
import { DataverseHelper } from "../helpers/dataverseHelper";
import { entityDefinitionsStoreKey, extensionName, extensionPrefix } from "../utils/Constants";
import { IEntityDefinition, IEntityMetadata, ISolutionComponent, IStore } from "../utils/Interfaces";
import { Placeholders } from "../utils/Placeholders";
import { State } from "../utils/State";
import { TreeItemBase } from "./treeItemBase";

export class EntitiesDataProvider implements vscode.TreeDataProvider<EntitiesTreeItem> {
private refreshTreeData: vscode.EventEmitter<EntitiesTreeItem | undefined | void> = new vscode.EventEmitter<EntitiesTreeItem | undefined | void>();
Expand Down Expand Up @@ -177,8 +177,8 @@ export class EntitiesTreeItem extends TreeItemBase {
}

iconPath = {
light: path.join(__filename, "..", "..", "..", "resources", "light", this.level === 1 ? "table.svg" : this.level === 2 ? "column.svg" : "generic.svg"),
dark: path.join(__filename, "..", "..", "..", "resources", "dark", this.level === 1 ? "table.svg" : this.level === 2 ? "column.svg" : "generic.svg"),
light: path.join(__filename, "..", "resources", "light", this.level === 1 ? "table.svg" : this.level === 2 ? "column.svg" : "generic.svg"),
dark: path.join(__filename, "..", "resources", "dark", this.level === 1 ? "table.svg" : this.level === 2 ? "column.svg" : "generic.svg"),
};

contextValue = "entitymedata";
Expand Down
6 changes: 3 additions & 3 deletions src/trees/treeItemBase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from "vscode";
import * as path from "path";
import * as vscode from "vscode";

export class TreeItemBase extends vscode.TreeItem {
constructor(public readonly label: string, public readonly desc: string | undefined, public readonly collapsibleState: vscode.TreeItemCollapsibleState) {
Expand All @@ -10,8 +10,8 @@ export class TreeItemBase extends vscode.TreeItem {
}

iconPath = {
light: path.join(__filename, "..", "..", "..", "resources", "light", "generic.svg"),
dark: path.join(__filename, "..", "..", "..", "resources", "dark", "generic.svg"),
light: path.join(__filename, "..", "resources", "light", "generic.svg"),
dark: path.join(__filename, "..", "resources", "dark", "generic.svg"),
};

//contextValue = this.level === 2 ? "connection" : "connection-child";
Expand Down
61 changes: 27 additions & 34 deletions src/trees/webResourcesDataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as vscode from "vscode";
import { observable } from "mobx";
import * as path from "path";
import { State } from "../utils/State";
import * as vscode from "vscode";
import { DataverseHelper } from "../helpers/dataverseHelper";
import { WebResourceHelper } from "../helpers/webResourceHelper";
import { extensionName, extensionPrefix, WebResourceType, wrDefinitionsStoreKey } from "../utils/Constants";
import { ISolutionComponent, IStore, IWebResource, IWebResources } from "../utils/Interfaces";
import { observable } from "mobx";
import { TreeItemBase } from "./treeItemBase";
import { toArray } from "../utils/ExtensionMethods";
import { WebResourceHelper } from "../helpers/webResourceHelper";
import { DataverseHelper } from "../helpers/dataverseHelper";
import { ISolutionComponent, IStore, IWebResource, IWebResources } from "../utils/Interfaces";
import { Placeholders } from "../utils/Placeholders";
import { State } from "../utils/State";
import { TreeItemBase } from "./treeItemBase";

export class WebResourcesDataProvider implements vscode.TreeDataProvider<WebResourcesTreeItem> {
private refreshTreeData: vscode.EventEmitter<WebResourcesTreeItem | undefined | void> = new vscode.EventEmitter<WebResourcesTreeItem | undefined | void>();
Expand All @@ -17,7 +17,7 @@ export class WebResourcesDataProvider implements vscode.TreeDataProvider<WebReso
private areWRFiltered: boolean = false;
private areWRSearched: boolean = false;

constructor(private vscontext: vscode.ExtensionContext, private dvHelper: DataverseHelper, private uploadHelper: WebResourceHelper) { }
constructor(private vscontext: vscode.ExtensionContext, private dvHelper: DataverseHelper, private uploadHelper: WebResourceHelper) {}

async refresh(): Promise<void> {
await this.populateWebResources();
Expand All @@ -32,14 +32,12 @@ export class WebResourcesDataProvider implements vscode.TreeDataProvider<WebReso
if (!element) {
// Parent

const allowedFolder = ['html', 'css', 'script', 'others'];
const allowedFolder = ["html", "css", "script", "others"];

let parentTree: WebResourcesTreeItem[] = [];
toArray(WebResourceType).map((t: WebResourceType) => {
if (allowedFolder.indexOf(t.toString()) > WebResourceType.others) {
parentTree.push(
new WebResourcesTreeItem(
t.toString(), undefined, vscode.TreeItemCollapsibleState.Expanded, 1));
parentTree.push(new WebResourcesTreeItem(t.toString(), undefined, vscode.TreeItemCollapsibleState.Expanded, 1));
}
});

Expand All @@ -50,8 +48,7 @@ export class WebResourcesDataProvider implements vscode.TreeDataProvider<WebReso
let checkType: Array<IWebResource> | undefined = undefined;

if (selectedType === WebResourceType.others) {
checkType = this.webResource.filter(
(w) => w.webresourcetype !== undefined && w.webresourcetype > WebResourceType.script);
checkType = this.webResource.filter((w) => w.webresourcetype !== undefined && w.webresourcetype > WebResourceType.script);
} else {
checkType = this.webResource.filter((w) => w.webresourcetype === selectedType);
}
Expand Down Expand Up @@ -208,40 +205,36 @@ export class WebResourcesTreeItem extends TreeItemBase {
light: path.join(
__filename,
"..",
"..",
"..",
"resources",
"light",
this.label === "html"
? "html.svg"
: this.label === "css"
? "css.svg"
: this.label === "script"
? "js.svg"
: this.level === 2 && !this.showCheck
? "file-red.svg"
: this.level === 2 && this.showCheck
? "file-green.svg"
: "generic.svg",
? "css.svg"
: this.label === "script"
? "js.svg"
: this.level === 2 && !this.showCheck
? "file-red.svg"
: this.level === 2 && this.showCheck
? "file-green.svg"
: "generic.svg",
),
dark: path.join(
__filename,
"..",
"..",
"..",
"resources",
"dark",
this.label === "html"
? "html.svg"
: this.label === "css"
? "css.svg"
: this.label === "script"
? "js.svg"
: this.level === 2 && !this.showCheck
? "file-red.svg"
: this.level === 2 && this.showCheck
? "file-green.svg"
: "generic.svg",
? "css.svg"
: this.label === "script"
? "js.svg"
: this.level === 2 && !this.showCheck
? "file-red.svg"
: this.level === 2 && this.showCheck
? "file-green.svg"
: "generic.svg",
),
};

Expand Down
Loading

0 comments on commit cfda5a4

Please sign in to comment.