Skip to content

Commit

Permalink
fix(readme): Update readmes (#39)
Browse files Browse the repository at this point in the history
- Adjust resource builds
  • Loading branch information
mammerla authored Sep 16, 2024
1 parent 3882f33 commit df770c7
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 59 deletions.
42 changes: 5 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ In the project directory, you can run:
Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.

You will also see any lint errors in the console.
The page will reload if you make edits. You will also see any lint errors in the console.

### `npm test`

Expand All @@ -55,42 +53,12 @@ You can package the command-line by running `npm pack` in `toolbuild/jsn`.

Builds the web app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance. The build is also minified.

## Sample Command Lines

Once packaged, you can install the command line locally via `npm install minecraft-creator-tools-<version>.tgz`. If you'd like to make Minecraft Creator Tools available across your device, you can install it globally via `npm install -g minecraft-creator-tools-<version>.tgz`.

Some sample command lines:

`npx mct`

Displays default information for the Minecraft Creator Tools command line tool.

### Validation

`npx mct validate -i d:\mycontent\myprojectfolder`

Loads the project folder `d:\mycontent\myprojectfolder` and outputs result files into the default output folder `out`.

`npx mct validate -i d:\mycontent\myprojectfolder -show`

Loads the project folder `d:\mycontent\myprojectfolder` and shows validation results on the command line.

`npx mct validate addon -i d:\mycontent\myprojectfolder -show --log-verbose`

Loads the project folder `d:\mycontent\myprojectfolder`, validates using the 'addon' suite of strict tests and shows validation results on the command line. Also displays verbose logging messages.

`npx mct validate addon -if d:\mycontent\packages\myaddon.mcaddon -show --log-verbose`

Loads the project file `d:\mycontent\packages\myaddon.mcaddon`, validates using the 'addon' suite of strict tests and shows validation results on the command line. Also displays verbose logging messages.


### New project creation

`npx mct create`
## Command Line Tool

Asks a series of questions and creates a new project based on those preferences.
Once packaged, you can install the command line locally via `npm install minecraft-creator-tools-<version>.tgz`. If you'd like to make Minecraft Creator Tools available across your device, you can install it globally via `npm install -g minecraft-creator-tools-<version>.tgz`. Minecraft Creator Tools is also available on NPM via [@minecraft/creator-tools](https://aka.ms/mctnpm).

See the [command-line readme](./app/jsnode/README.md) for more instructions on using the command line.

## Trademarks
## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
22 changes: 16 additions & 6 deletions app/jsnode/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Minecraft Creator Tools Readme
# Minecraft Creator Tools

### Copyright (c) 2024 Mojang AB. All rights reserved.

- [License](LICENSE.md)
- [Changelog](CHANGELOG.md)
- [Notices](NOTICE.md)
- [License](https://aka.ms/mctlicense)
- [GitHub](https://aka.ms/mcthomepage)
- [Report an Issue](https://aka.ms/mctbugs)

This code is currently in alpha preview.
This toolset is currently in alpha preview.

### Some sample command lines:
### Sample command lines

`npx mct`

Expand All @@ -31,3 +31,13 @@ Loads the project folder `d:\mycontent\myprojectfolder`, validates using the 'ad
`npx mct validate addon -if d:\mycontent\packages\myaddon.mcaddon -show --log-verbose`

Loads the project file `d:\mycontent\packages\myaddon.mcaddon`, validates using the 'addon' suite of strict tests and shows validation results on the command line. Also displays verbose logging messages.

### New project creation

`npx mct create`

Asks a series of questions and creates a new project based on those preferences.

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
5 changes: 5 additions & 0 deletions app/public/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ <h3 id="commandLine">Command Line Tools</h3>
Command line tools let you access the power of creator tools from a command line. You can also integrate
this into broader processes or project-level tasks.
</div>
<div>
Command line tools are available via the <a href="https://aka.ms/mctnpm" target="_blank">@minecraft/creator-tools</a> page on
NPM. To install via NPM, install <a href="https://nodejs.org/" target="_blank">nodejs tools</a> and then run <code>npm -i @minecraft/creator-tools</code>
from a command line. See the <a href="https://aka.ms/mctnpm" target="_blank">NPM page</a> for more documentation and sample command lines.
</div>
<div class="g-caboose">&#160;</div>
</div>
<div class="g-overlay">
Expand Down
3 changes: 2 additions & 1 deletion app/reslist/gametestsamples.resources.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"url": "https://github.com/microsoft/minecraft-gametests/archive/refs/heads/main.zip",
"url": "https://github.com/microsoft/minecraft-gametests/archive/e0d67e171f11faa3ea5ea3be085e3f1992b27b83.zip",
"replaceFirstFolderWith": "minecraft-gametests-main",
"exclude": []
}
4 changes: 2 additions & 2 deletions app/reslist/packs.resources.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"url": "https://github.com/Mojang/bedrock-samples/archive/refs/heads/preview.zip",
"ignoreSubfolder": "bedrock-samples-preview",
"url": "https://github.com/Mojang/bedrock-samples/archive/1c48a87a35864df286f5a8403a88706cdede963d.zip",
"ignoreFirstFolder": true,
"exclude": [
"documentation/",
"scripts/",
Expand Down
4 changes: 3 additions & 1 deletion app/reslist/samples.resources.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"url": "https://github.com/microsoft/minecraft-samples/archive/refs/heads/main.zip",
"url": "https://github.com/microsoft/minecraft-samples/archive/4d33c13deb7c862d775905c2336da5c2f4c52285.zip",
"replaceFirstFolderWith": "minecraft-samples-main",
"exclude": [
"add_entity_robot/",
"mclive2022_addon/",
"rtx_resource_pack/",
"culled_block_sample/",
"casual_creator/",
"debug_tools/",
"parkour_sample_world/"
]
}
5 changes: 2 additions & 3 deletions app/reslist/schemas.resources.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"url": "https://github.com/Blockception/Minecraft-bedrock-json-schemas/archive/refs/heads/main.zip",
"ignoreSubfolder": "Minecraft-bedrock-json-schemas-main",
"subfolder": "schemas",
"url": "https://github.com/Blockception/Minecraft-bedrock-json-schemas/archive/67326c3e50d136483444e82d00fecb0a570c9a64.zip",
"replaceFirstFolderWith": "schemas",
"exclude": [
".git",
".vscode/",
Expand Down
3 changes: 2 additions & 1 deletion app/reslist/scriptsamples.resources.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"url": "https://github.com/microsoft/minecraft-scripting-samples/archive/refs/heads/main.zip",
"url": "https://github.com/microsoft/minecraft-scripting-samples/archive/0a9509f18ad476e317ea4427049000e583ce7d2e.zip",
"replaceFirstFolderWith": "minecraft-scripting-samples-main",
"exclude": []
}
2 changes: 2 additions & 0 deletions app/src/devproject/NpmPackageDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ export const ScriptsDefault: NpmScripts = {
"CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-1958404141-86561845-1752920682-3514627264-368642714-62675701-733520436",
enablemcpreviewloopback:
"CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-424268864-5579737-879501358-346833251-474568803-887069379-4040235476",
buildsnippets: "just-scripts buildSnippets",
};

export const DependenciesDefault: Dependencies = {
"@minecraft/math": "^1.4.0",
"@minecraft/server": "^1.13.0",
"@minecraft/server-editor": "^0.1.0-beta.1.21.30-preview.24",
"@minecraft/server-ui": "^1.2.0",
"@minecraft/vanilla-data": "^1.21.20",
};
Expand Down
40 changes: 32 additions & 8 deletions app/tools/gulp-downloadResources/DownloadResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ class DownloadResources {
if (jsonObj && jsonObj.url) {
console.log("Downloading '" + jsonObj.url + "' contents to '" + this._targetFilePath + "'");

let subfolder = jsonObj.subfolder;
let subFolder = jsonObj.subFolder;

if (!subfolder) {
subfolder = "";
if (!subFolder) {
subFolder = "";
}

const ignoreSubfolder = jsonObj.ignoreSubfolder;
const ignoreSubFolder = jsonObj.ignoreSubFolder;
const ignoreFirstFolder = jsonObj.ignoreFirstFolder;
const replaceFirstFolderWith = jsonObj.replaceFirstFolderWith;

let extraExcludeIfContents = jsonObj.exclude;

Expand Down Expand Up @@ -131,11 +133,33 @@ class DownloadResources {
for (const filename of filePathsToProcess) {
let destFile = filename;

if (ignoreSubfolder && destFile.toLowerCase().startsWith(ignoreSubfolder.toLowerCase())) {
destFile = destFile.substring(ignoreSubfolder.length);
if (ignoreSubFolder && destFile.toLowerCase().startsWith(ignoreSubFolder.toLowerCase())) {
let nextSlash = destFile.indexOf("/", ignoreSubFolder.length);

if (nextSlash < ignoreSubFolder.length) {
nextSlash = ignoreSubFolder.length;
}

destFile = destFile.substring(nextSlash);
}

if (ignoreFirstFolder) {
let nextSlash = destFile.indexOf("/", 1);

if (nextSlash > 1) {
destFile = destFile.substring(nextSlash);
}
}

if (replaceFirstFolderWith) {
let nextSlash = destFile.indexOf("/", 1);

if (nextSlash > 1) {
destFile = path.join(replaceFirstFolderWith, destFile.substring(nextSlash));
}
}

const dest = path.join(me._targetFilePath, subfolder, destFile);
const dest = path.join(me._targetFilePath, subFolder, destFile);
const folderPath = me.getPath(dest);

if (!folderInfos[folderPath]) {
Expand Down Expand Up @@ -205,7 +229,7 @@ class DownloadResources {
"Wrote " +
filePathsWritten.length +
" files and folders to '" +
path.join(me._targetFilePath, subfolder) +
path.join(me._targetFilePath, subFolder) +
"'"
);

Expand Down

0 comments on commit df770c7

Please sign in to comment.