Skip to content

Commit d693238

Browse files
committed
Initial Commit
1 parent 2ec2486 commit d693238

File tree

12 files changed

+304
-0
lines changed

12 files changed

+304
-0
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PROJECT_NAME="Shared-Inventory"
2+
MINECRAFT_PRODUCT="BedrockUWP"
3+
CUSTOM_DEPLOYMENT_PATH=""

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
lib

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"semi": true,
5+
"singleQuote": false,
6+
"bracketSpacing": true,
7+
"arrowParens": "always",
8+
"printWidth": 120,
9+
"endOfLine": "auto"
10+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"format_version": 2,
3+
"header": {
4+
"name": "Shared Inventory",
5+
"description": "Share your inventory with your friends!",
6+
"uuid": "90e96a18-bd6e-46a5-993a-3da137982e8e",
7+
"version": [
8+
1,
9+
0,
10+
0
11+
],
12+
"min_engine_version": [
13+
1,
14+
20,
15+
30
16+
]
17+
},
18+
"modules": [
19+
{
20+
"description": "Script resources",
21+
"language": "javascript",
22+
"type": "script",
23+
"uuid": "0eb349e4-c6b3-48bc-aa37-878343c1cdd8",
24+
"version": [
25+
1,
26+
0,
27+
0
28+
],
29+
"entry": "scripts/main.js"
30+
}
31+
],
32+
"dependencies": [
33+
{
34+
"module_name": "@minecraft/server",
35+
"version": "2.0.0"
36+
}
37+
]
38+
}
275 KB
Loading

eslint.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import minecraftLinting from "eslint-plugin-minecraft-linting";
2+
import tsParser from "@typescript-eslint/parser";
3+
import ts from "@typescript-eslint/eslint-plugin";
4+
5+
export default [
6+
{
7+
files: ["scripts/**/*.ts"],
8+
languageOptions: {
9+
parser: tsParser,
10+
ecmaVersion: "latest",
11+
},
12+
plugins: {
13+
ts,
14+
"minecraft-linting": minecraftLinting,
15+
},
16+
rules: {
17+
"minecraft-linting/avoid-unnecessary-command": "error",
18+
},
19+
},
20+
];

just.config.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import { argv, parallel, series, task, tscTask } from "just-scripts";
2+
import {
3+
BundleTaskParameters,
4+
CopyTaskParameters,
5+
bundleTask,
6+
cleanTask,
7+
cleanCollateralTask,
8+
copyTask,
9+
coreLint,
10+
mcaddonTask,
11+
setupEnvironment,
12+
ZipTaskParameters,
13+
STANDARD_CLEAN_PATHS,
14+
DEFAULT_CLEAN_DIRECTORIES,
15+
getOrThrowFromProcess,
16+
watchTask,
17+
} from "@minecraft/core-build-tasks";
18+
import path from "path";
19+
20+
// Setup env variables
21+
setupEnvironment(path.resolve(__dirname, ".env"));
22+
const projectName = getOrThrowFromProcess("PROJECT_NAME");
23+
24+
// You can use `npm run build:production` to build a "production" build that strips out statements labelled with "dev:".
25+
const isProduction = argv()['production'];
26+
27+
const bundleTaskOptions: BundleTaskParameters = {
28+
entryPoint: path.join(__dirname, "./scripts/main.ts"),
29+
external: ["@minecraft/server", "@minecraft/server-ui"],
30+
outfile: path.resolve(__dirname, "./dist/scripts/main.js"),
31+
minifyWhitespace: false,
32+
sourcemap: true,
33+
outputSourcemapPath: path.resolve(__dirname, "./dist/debug"),
34+
dropLabels: isProduction ? ['dev'] : undefined
35+
};
36+
37+
const copyTaskOptions: CopyTaskParameters = {
38+
copyToBehaviorPacks: [`./behavior_packs/${projectName}`],
39+
copyToScripts: ["./dist/scripts"],
40+
copyToResourcePacks: [`./resource_packs/${projectName}`],
41+
};
42+
43+
const mcaddonTaskOptions: ZipTaskParameters = {
44+
...copyTaskOptions,
45+
outputFile: `./dist/packages/${projectName}.mcaddon`,
46+
};
47+
48+
// Lint
49+
task("lint", coreLint(["scripts/**/*.ts"], argv().fix));
50+
51+
// Build
52+
task("typescript", tscTask());
53+
task("bundle", bundleTask(bundleTaskOptions));
54+
task("build", series("typescript", "bundle"));
55+
56+
// Clean
57+
task("clean-local", cleanTask(DEFAULT_CLEAN_DIRECTORIES));
58+
task("clean-collateral", cleanCollateralTask(STANDARD_CLEAN_PATHS));
59+
task("clean", parallel("clean-local", "clean-collateral"));
60+
61+
// Package
62+
task("copyArtifacts", copyTask(copyTaskOptions));
63+
task("package", series("clean-collateral", "copyArtifacts"));
64+
65+
// Local Deploy used for deploying local changes directly to output via the bundler. It does a full build and package first just in case.
66+
task(
67+
"local-deploy",
68+
watchTask(
69+
["scripts/**/*.ts", "behavior_packs/**/*.{json,lang,png}", "resource_packs/**/*.{json,lang,png}"],
70+
series("clean-local", "build", "package")
71+
)
72+
);
73+
74+
// Mcaddon
75+
task("createMcaddonFile", mcaddonTask(mcaddonTaskOptions));
76+
task("mcaddon", series("clean-local", "build", "createMcaddonFile"));

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"devDependencies": {
3+
"@minecraft/core-build-tasks": "^5.2.0",
4+
"eslint-plugin-minecraft-linting": "^2.0.1",
5+
"source-map": "^0.7.4",
6+
"ts-node": "^10.9.1",
7+
"typescript": "^5.5.4"
8+
},
9+
"scripts": {
10+
"lint": "just-scripts lint",
11+
"build": "just-scripts build",
12+
"build:production": "just-scripts build --production",
13+
"clean": "just-scripts clean",
14+
"local-deploy": "just-scripts local-deploy",
15+
"mcaddon": "just-scripts mcaddon",
16+
"mcaddon:production": "just-scripts mcaddon --production",
17+
"enablemcloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-1958404141-86561845-1752920682-3514627264-368642714-62675701-733520436",
18+
"enablemcpreviewloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-424268864-5579737-879501358-346833251-474568803-887069379-4040235476"
19+
},
20+
"dependencies": {
21+
"@minecraft/math": "^2.2.7",
22+
"@minecraft/server": "^2.0.0",
23+
"@minecraft/server-ui": "^2.0.0",
24+
"@minecraft/vanilla-data": "^1.21.90"
25+
}
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"format_version": 2,
3+
"header": {
4+
"name": "Shared Inventory",
5+
"description": "Share your inventory with your friends!",
6+
"uuid": "c1df6c79-7d8a-4f70-a84f-d36e08506184",
7+
"version": [
8+
1,
9+
0,
10+
0
11+
],
12+
"min_engine_version": [
13+
1,
14+
20,
15+
30
16+
]
17+
},
18+
"modules": [
19+
{
20+
"type": "resources",
21+
"uuid": "7611fdb6-4608-449c-919b-dbf1903cea99",
22+
"version": [
23+
1,
24+
0,
25+
0
26+
]
27+
}
28+
],
29+
"dependencies": [
30+
{
31+
"uuid": "90e96a18-bd6e-46a5-993a-3da137982e8e",
32+
"version": [
33+
1,
34+
0,
35+
0
36+
]
37+
}
38+
]
39+
}
275 KB
Loading

0 commit comments

Comments
 (0)