Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(val): Remove eslint validator, update dependencies, bug fixes #49

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/jsnode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"access": "public"
},
"dependencies": {
"@octokit/rest": "^18.5.2",
"@octokit/rest": "^19.0.13",
"@rauschma/stringio": "^1.4.0",
"axios": "^1.6.4",
"commander": "^8.2.0",
Expand All @@ -38,9 +38,8 @@
"pako": "^2.0.4",
"esbuild-wasm": "^0.21.3",
"threads": "^1.7.0",
"eslint": "^8.34.0",
"js-md5": "^0.7.3",
"ajv": "^8.11.0",
"ajv": "^8.17.1",
"localforage": "^1.9.0",
"permessage-deflate": "^0.1.7",
"ste-events": "^2.0.9"
Expand Down
605 changes: 449 additions & 156 deletions app/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@monaco-editor/react": "^4.6.0",
"@npm/types": "^1.0.2",
"@rauschma/stringio": "^1.4.0",
"ajv": "^8.11.0",
"ajv": "^8.17.1",
"axios": "^1.6.4",
"commander": "^8.2.0",
"esbuild-wasm": "^0.21.5",
Expand Down Expand Up @@ -110,16 +110,16 @@
"@babel/plugin-transform-private-methods": "^7.23.3",
"@babel/preset-env": "^7.23.7",
"@babel/preset-react": "^7.23.3",
"@minecraft/math": "^1.4.0",
"@minecraft/math": "^1.5.1",
"@minecraft/server": "^1.15.0-beta.1.21.30-preview.25",
"@minecraft/server-admin": "^1.0.0-beta.1.21.30-preview.25",
"@minecraft/server-editor": "^0.1.0-beta.1.21.30-preview.25",
"@minecraft/server-gametest": "^1.0.0-beta.1.21.30-preview.25",
"@minecraft/server-net": "^1.0.0-beta.1.21.30-preview.25",
"@minecraft/server-ui": "^1.4.0-beta.1.21.30-preview.25",
"@minecraft/vanilla-data": "^1.21.22",
"@minecraft/vanilla-data": "^1.21.50",
"@npm/types": "^1.0.2",
"@octokit/rest": "^18.5.2",
"@octokit/rest": "^19.0.13",
"@octokit/types": "^6.13.0",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.8.1",
Expand Down
1 change: 0 additions & 1 deletion app/reslist/packs-preview.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts/",
"ui/",
"gui/",
"painting/",
"persona_thumbnails/",
"trading/",
"pack_icon.png",
Expand Down
1 change: 0 additions & 1 deletion app/reslist/packs.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts/",
"ui/",
"gui/",
"painting/",
"persona_thumbnails/",
"trading/",
"pack_icon.png",
Expand Down
4 changes: 2 additions & 2 deletions app/src/UX/AudioManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,11 @@ export default class AudioManager extends Component<IAudioManagerProps, IAudioMa
}}
>
<div
className={"aum-contents " + (CartoApp.theme === CartoThemeStyle.dark ? "playlist-dark" : "playlist-loght")}
className={"aum-contents " + (CartoApp.theme === CartoThemeStyle.dark ? "playlist-dark" : "playlist-light")}
ref={this.rootElt}
></div>
<div
className={"aum-status " + (CartoApp.theme === CartoThemeStyle.dark ? "playlist-dark" : "playlist-loght")}
className={"aum-status " + (CartoApp.theme === CartoThemeStyle.dark ? "playlist-dark" : "playlist-light")}
ref={this.statusElt}
></div>
{audioItemProps}
Expand Down
5 changes: 4 additions & 1 deletion app/src/UX/ProjectEditorUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ProjectItemUtilities from "../app/ProjectItemUtilities";
import ProjectUtilities from "../app/ProjectUtilities";
import Utilities from "../core/Utilities";
import BlockbenchModel from "../integrations/BlockbenchModel";
import MinecraftDefinitions from "../minecraft/MinecraftDefinitions";
import { PackType } from "../minecraft/Pack";
import FileSystemFolder from "../storage/FileSystemFolder";
import FileSystemStorage from "../storage/FileSystemStorage";
Expand Down Expand Up @@ -540,14 +541,16 @@ export default class ProjectEditorUtilities {
const relPath = contentFile.getFolderRelativePath(project.projectFolder as IFolder);

if (relPath !== undefined) {
project.ensureItemByProjectPath(
const item = project.ensureItemByProjectPath(
relPath,
ProjectItemStorageType.singleFile,
file.name,
ProjectItemType.audio,
undefined,
ProjectItemCreationType.normal
);

await MinecraftDefinitions.ensureFoundationalDependencies(item);
}

await project.carto.notifyOperationEnded(operId, "New audio file '" + file.name + "' added");
Expand Down
12 changes: 6 additions & 6 deletions app/src/UX/ProjectInfoDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export enum ProjectInfoDisplayMenuState {
exportMenu,
}

export const SuiteTitles = ["All", "Current Platform Versions", "Add-On Best Practices"];
export const SuiteTitles = ["All", "Current Platform Versions", "Cooperative Add-On Best Practices"];

export enum InfoItemCommand {
itemSelect,
Expand Down Expand Up @@ -107,7 +107,7 @@ export default class ProjectInfoDisplay extends Component<IProjectInfoDisplayPro
let suite = this.props.carto.preferredSuite;

if (suite === undefined) {
suite = ProjectInfoSuite.allExceptAddOn;
suite = ProjectInfoSuite.default;
}

this.state = {
Expand Down Expand Up @@ -208,7 +208,7 @@ export default class ProjectInfoDisplay extends Component<IProjectInfoDisplayPro
contentIndex
);
}
} else if (this.props.project && this.state.activeSuite === ProjectInfoSuite.allExceptAddOn) {
} else if (this.props.project && this.state.activeSuite === ProjectInfoSuite.default) {
newInfoSet = this.props.project.infoSet;
} else if (this.props.project) {
newInfoSet = new ProjectInfoSet(this.props.project, this.state.activeSuite);
Expand All @@ -223,7 +223,7 @@ export default class ProjectInfoDisplay extends Component<IProjectInfoDisplayPro
if (!this.props.file && !this.props.data) {
await newInfoSet.generateForProject(force);

if (this.state.activeSuite === ProjectInfoSuite.allExceptAddOn && this.props.onNotifyInfoSetLoaded) {
if (this.state.activeSuite === ProjectInfoSuite.default && this.props.onNotifyInfoSetLoaded) {
this.props.onNotifyInfoSetLoaded(newInfoSet);
}
}
Expand Down Expand Up @@ -421,12 +421,12 @@ export default class ProjectInfoDisplay extends Component<IProjectInfoDisplayPro
event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element> | null,
data: DropdownProps
) {
let targetedSuite = ProjectInfoSuite.allExceptAddOn;
let targetedSuite = ProjectInfoSuite.default;

if (data.value === SuiteTitles[1]) {
targetedSuite = ProjectInfoSuite.currentPlatformVersions;
} else if (data.value === SuiteTitles[2]) {
targetedSuite = ProjectInfoSuite.addOn;
targetedSuite = ProjectInfoSuite.cooperativeAddOn;
}

if (targetedSuite !== this.props.carto.preferredSuite) {
Expand Down
32 changes: 17 additions & 15 deletions app/src/app/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default class Project {

public get infoSet() {
if (!this.#infoSet) {
this.#infoSet = new ProjectInfoSet(this, ProjectInfoSuite.allExceptAddOn);
this.#infoSet = new ProjectInfoSet(this, ProjectInfoSuite.default);
}

return this.#infoSet;
Expand Down Expand Up @@ -2361,11 +2361,6 @@ export default class Project {
folderPathLower.indexOf("/attachables/") >= 0
) {
newJsonType = ProjectItemType.attachableResourceJson;
} else if (
folderContext === FolderContext.resourcePack &&
(folderPathLower.indexOf("/entities/") >= 0 || folderPathLower.indexOf("/entity/") >= 0)
) {
newJsonType = ProjectItemType.entityTypeResource;
} else if (folderContext === FolderContext.resourcePack && folderPathLower.indexOf("/fogs/") >= 0) {
newJsonType = ProjectItemType.fogResourceJson;
} else if (folderContext === FolderContext.resourcePack && folderPathLower.indexOf("/particles/") >= 0) {
Expand Down Expand Up @@ -2475,15 +2470,6 @@ export default class Project {
newJsonType = ProjectItemType.packageLockJson;
} else if (baseName === ".prettierrc") {
newJsonType = ProjectItemType.prettierRcJson;
} else if (
folderContext === FolderContext.behaviorPack &&
(folderPathLower.indexOf("/entities/") >= 0 || folderPathLower.indexOf("/entity/") >= 0)
) {
newJsonType = ProjectItemType.entityTypeBehavior;
} else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/items/") >= 0) {
newJsonType = ProjectItemType.itemTypeBehavior;
} else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/blocks/") >= 0) {
newJsonType = ProjectItemType.blockTypeBehavior;
} else if (folderContext === FolderContext.docs && baseName === "info") {
newJsonType = ProjectItemType.docInfoJson;
this.role = ProjectRole.documentation;
Expand Down Expand Up @@ -2523,6 +2509,22 @@ export default class Project {
} else if (folderContext === FolderContext.typeDefs && folderPathLower.indexOf("/engine_modules") >= 0) {
newJsonType = ProjectItemType.engineOrderingJson;
this.role = ProjectRole.documentation;
}
// these need to be near the bottom since URL segments like /items/, /blocks/, /entities etc. could theoretically be used in loot_tables, etc. and that should take precedence in detection
else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/items/") >= 0) {
newJsonType = ProjectItemType.itemTypeBehavior;
} else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/blocks/") >= 0) {
newJsonType = ProjectItemType.blockTypeBehavior;
} else if (
folderContext === FolderContext.resourcePack &&
(folderPathLower.indexOf("/entities/") >= 0 || folderPathLower.indexOf("/entity/") >= 0)
) {
newJsonType = ProjectItemType.entityTypeResource;
} else if (
folderContext === FolderContext.behaviorPack &&
(folderPathLower.indexOf("/entities/") >= 0 || folderPathLower.indexOf("/entity/") >= 0)
) {
newJsonType = ProjectItemType.entityTypeBehavior;
} else {
// Log.debugAlert("General JSON file found: " + projectPath);
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/app/ProjectItemUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,13 @@ export default class ProjectItemUtilities {

case ProjectItemType.itemTypeBehavior:
return 1853;

case ProjectItemType.recipeBehavior:
return 1860;

case ProjectItemType.particleJson:
return 1870;

case ProjectItemType.tickJson:
return 903;

Expand Down
4 changes: 2 additions & 2 deletions app/src/cli/TaskWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ async function validateAndDisposeProject(
const isAddon = await ProjectUtilities.getIsAddon(project);

if (isAddon) {
pis = new ProjectInfoSet(project, ProjectInfoSuite.addOn);
pis = new ProjectInfoSet(project, ProjectInfoSuite.cooperativeAddOn);

await pis.generateForProject();

Expand All @@ -229,7 +229,7 @@ async function validateAndDisposeProject(
projectName: project.name,
projectTitle: project.title,
infoSetData: pis.getDataObject(),
suite: ProjectInfoSuite.addOn,
suite: ProjectInfoSuite.cooperativeAddOn,
};

metaStates.push(projectSet);
Expand Down
4 changes: 2 additions & 2 deletions app/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ async function aggregateReports() {
}

if (baseName.endsWith("addon")) {
suite = ProjectInfoSuite.addOn;
suite = ProjectInfoSuite.cooperativeAddOn;
baseName = baseName.substring(0, baseName.length - 6);
}

Expand Down Expand Up @@ -1381,7 +1381,7 @@ async function saveAggregatedReports(projectList: IProjectMetaState[]) {

sampleProjectInfoSets[suiteName] = pis;

if (projectSet.suite === undefined || projectSet.suite === ProjectInfoSuite.allExceptAddOn) {
if (projectSet.suite === undefined || projectSet.suite === ProjectInfoSuite.default) {
if (projectSet.infoSetData.info) {
for (const memberName in projectSet.infoSetData.info) {
if (ProjectInfoSet.isAggregableFieldName(memberName)) {
Expand Down
6 changes: 6 additions & 0 deletions app/src/core/ContentIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ export default class ContentIndex implements IContentIndex {
hasPathMatches(pathEnd: string) {
pathEnd = pathEnd.toLowerCase();

const lastPeriodEnd = pathEnd.lastIndexOf(".");

if (lastPeriodEnd >= 0) {
pathEnd = pathEnd.substring(0, lastPeriodEnd);
}

for (let path of this.data.items) {
if (path.startsWith("/")) {
const lastPeriod = path.lastIndexOf(".");
Expand Down
39 changes: 27 additions & 12 deletions app/src/info/AnimationResourceInfoGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import IProjectInfoGenerator from "./IProjectInfoGenerator";
import Project from "../app/Project";
import ContentIndex from "../core/ContentIndex";
import AnimationResourceDefinition from "../minecraft/AnimationResourceDefinition";
import ProjectInfoUtilities from "./ProjectInfoUtilities";

export enum AnimationResourceInfoGeneratorTest {
animations = 1,
bones = 2,
}

export default class AnimationResourceInfoGenerator implements IProjectInfoGenerator {
id = "RESOURCEANIMATION";
Expand All @@ -17,16 +23,9 @@ export default class AnimationResourceInfoGenerator implements IProjectInfoGener
performAddOnValidations = false;

getTopicData(topicId: number) {
switch (topicId) {
case 1:
return { title: "Animations" };

case 2:
return { title: "Bones" };

default:
return { title: topicId.toString() };
}
return {
title: ProjectInfoUtilities.getTitleFromEnum(AnimationResourceInfoGeneratorTest, topicId),
};
}

summarize(info: any, infoSet: ProjectInfoSet) {
Expand All @@ -36,10 +35,26 @@ export default class AnimationResourceInfoGenerator implements IProjectInfoGener
async generate(project: Project, contentIndex: ContentIndex): Promise<ProjectInfoItem[]> {
const items: ProjectInfoItem[] = [];

const animationCountPi = new ProjectInfoItem(InfoItemType.featureAggregate, this.id, 1, "Animations");
const animationCountPi = new ProjectInfoItem(
InfoItemType.featureAggregate,
this.id,
AnimationResourceInfoGeneratorTest.animations,
ProjectInfoUtilities.getTitleFromEnum(
AnimationResourceInfoGeneratorTest,
AnimationResourceInfoGeneratorTest.animations
)
);
items.push(animationCountPi);

const boneCountPi = new ProjectInfoItem(InfoItemType.featureAggregate, this.id, 2, "Bones");
const boneCountPi = new ProjectInfoItem(
InfoItemType.featureAggregate,
this.id,
AnimationResourceInfoGeneratorTest.bones,
ProjectInfoUtilities.getTitleFromEnum(
AnimationResourceInfoGeneratorTest,
AnimationResourceInfoGeneratorTest.bones
)
);
items.push(boneCountPi);

const itemsCopy = project.getItemsCopy();
Expand Down
Loading
Loading