mineflayer
Advanced tools
| { | ||
| "dependencies": { | ||
| "gh-helpers": "^1.0.0" | ||
| } | ||
| } |
| #!/usr/bin/env node | ||
| /** | ||
| * Updator script triggered from minecraft-data repository to auto generate PR | ||
| */ | ||
| const fs = require('fs') | ||
| const cp = require('child_process') | ||
| const assert = require('assert') | ||
| const github = require('gh-helpers')() | ||
| const { join } = require('path') | ||
| const exec = (cmd) => github.mock ? console.log('> ', cmd) : (console.log('> ', cmd), cp.execSync(cmd, { stdio: 'inherit' })) | ||
| console.log('Starting update process...') | ||
| // Sanitize and validate environment variables all non alpha numeric / underscore / dot | ||
| const newVersion = process.env.NEW_MC_VERSION?.replace(/[^a-zA-Z0-9_.]/g, '_') | ||
| const triggerBranch = process.env.MCDATA_BRANCH?.replace(/[^a-zA-Z0-9_.]/g, '_') | ||
| const mcdataPrURL = process.env.MCDATA_PR_URL | ||
| console.log({ newVersion, triggerBranch, mcdataPrURL }) | ||
| assert(newVersion) | ||
| assert(triggerBranch) | ||
| async function main () { | ||
| const currentSupportedPath = require.resolve('../../lib/version.js') | ||
| const readmePath = join(__dirname, '../../docs/README.md') | ||
| const ciPath = join(__dirname, '../../.github/workflows/ci.yml') | ||
| // Update the version.js | ||
| const currentSupportedVersion = require('../../lib/version.js') | ||
| const currentContents = fs.readFileSync(currentSupportedPath, 'utf8') | ||
| console.log('Current supported version:', currentContents) | ||
| const latestV = currentSupportedVersion.testedVersions.at(-1) | ||
| const newContents = currentContents.includes(newVersion) | ||
| ? currentContents | ||
| : currentContents | ||
| .replace(`, '${latestV}'`, `, '${latestV}', '${newVersion}'`) | ||
| // Update the README.md | ||
| const currentContentsReadme = fs.readFileSync(readmePath, 'utf8') | ||
| if (!currentContentsReadme.includes(newVersion)) { | ||
| const newReadmeContents = currentContentsReadme | ||
| .replace(/Minecraft 1\.8 to [0-9A-Za-z._-]+ \(/, `Minecraft 1.8 to ${newVersion} (`) | ||
| .replace(') <!--version-->', `, ${newVersion}) <!--version-->`) | ||
| fs.writeFileSync(readmePath, newReadmeContents) | ||
| console.log('Updated README with new version:', newVersion) | ||
| } | ||
| fs.writeFileSync(currentSupportedPath, newContents) | ||
| // Update the CI workflow | ||
| const currentContentsCI = fs.readFileSync(ciPath, 'utf8') | ||
| if (!currentContentsCI.includes(newVersion)) { | ||
| const newCIContents = currentContentsCI.replace( | ||
| 'run: npm install', `run: npm install | ||
| - run: cd node_modules && cd minecraft-data && mv minecraft-data minecraft-data-old && git clone -b ${triggerBranch} https://github.com/PrismarineJS/minecraft-data --depth 1 && node bin/generate_data.js | ||
| - run: curl -o node_modules/protodef/src/serializer.js https://raw.githubusercontent.com/extremeheat/node-protodef/refs/heads/dlog/src/serializer.js && curl -o node_modules/protodef/src/compiler.js https://raw.githubusercontent.com/extremeheat/node-protodef/refs/heads/dlog/src/compiler.js | ||
| `) | ||
| fs.writeFileSync(ciPath, newCIContents) | ||
| console.log('Updated CI workflow with new version:', newVersion) | ||
| } | ||
| const branchName = 'pc' + newVersion.replace(/[^a-zA-Z0-9_]/g, '_') | ||
| exec(`git checkout -b ${branchName}`) | ||
| exec('git config user.name "github-actions[bot]"') | ||
| exec('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"') | ||
| exec('git add --all') | ||
| exec(`git commit -m "Update to version ${newVersion}"`) | ||
| exec(`git push origin ${branchName} --force`) | ||
| // createPullRequest(title: string, body: string, fromBranch: string, intoBranch?: string): Promise<{ number: number, url: string }>; | ||
| const pr = await github.createPullRequest( | ||
| `🎈 ${newVersion}`, | ||
| `This automated PR sets up the relevant boilerplate for Minecraft version ${newVersion}. | ||
| Ref: ${mcdataPrURL} | ||
| * You can help contribute to this PR by opening a PR against this <code branch>${branchName}</code> branch instead of <code>master</code>. | ||
| `, | ||
| branchName, | ||
| 'master' | ||
| ) | ||
| console.log(`Pull request created`, pr) | ||
| } | ||
| main().catch(err => { | ||
| console.error('Error during update process:', err) | ||
| process.exit(1) | ||
| }) |
| name: Update from minecraft-data | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| new_mc_version: | ||
| description: New minecraft version number | ||
| required: true | ||
| type: string | ||
| mcdata_branch: | ||
| description: minecraft-data branch for this version | ||
| required: true | ||
| type: string | ||
| mcdata_pr_url: | ||
| description: minecraft-data PR number to open a PR here against | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| nmp_branch: | ||
| description: minecraft-protocol branch for this version | ||
| required: true | ||
| type: string | ||
| nmp_pr_url: | ||
| description: minecraft-protocol PR number to open a PR here against | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| jobs: | ||
| update: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.PAT_PASSWORD }} | ||
| - name: Use Node.js 22.x | ||
| uses: actions/setup-node@v1.4.4 | ||
| with: | ||
| node-version: 22.x | ||
| - run: npm install PrismarineJS/node-minecraft-protocol#${{ github.event.inputs.nmp_branch }} | ||
| - name: Run updator script | ||
| run: cd .github/helper && npm install && node updator.js | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.PAT_PASSWORD }} | ||
| NEW_MC_VERSION: ${{ github.event.inputs.new_mc_version }} | ||
| MCDATA_BRANCH: ${{ github.event.inputs.mcdata_branch }} | ||
| MCDATA_PR_URL: ${{ github.event.inputs.mcdata_pr_url }} | ||
| NMP_BRANCH: ${{ github.event.inputs.nmp_branch }} | ||
| NMP_PR_URL: ${{ github.event.inputs.nmp_pr_url }} |
+4
-0
@@ -0,1 +1,5 @@ | ||
| ## 4.33.0 | ||
| * [Add update workflow (#3727)](https://github.com/PrismarineJS/mineflayer/commit/9c335366d435b58cfe45bbfbbc534b99ee669dc2) (thanks @extremeheat) | ||
| * [Add support for Minecraft 1.21.8 (#3732)](https://github.com/PrismarineJS/mineflayer/commit/ec8220d7c63b72acb4bf16f30cdf4ba346b83f98) (thanks @rom1504) | ||
| ## 4.32.0 | ||
@@ -2,0 +6,0 @@ * [1.21.6 (#3713)](https://github.com/PrismarineJS/mineflayer/commit/01f537c394fc78bf2e765b28a8b24a30c1d1fd2e) (thanks @extremeheat) |
+1
-1
@@ -20,3 +20,3 @@ # Mineflayer | ||
| * Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, and 1.21) | ||
| * Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21) <!--version--> | ||
| * Entity knowledge and tracking. | ||
@@ -23,0 +23,0 @@ * Block knowledge. You can query the world around you. Milliseconds to find any block. |
+1
-1
@@ -1,2 +0,2 @@ | ||
| const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21.1', '1.21.3', '1.21.4', '1.21.5', '1.21.6'] | ||
| const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21.1', '1.21.3', '1.21.4', '1.21.5', '1.21.6', '1.21.8'] | ||
| module.exports = { | ||
@@ -3,0 +3,0 @@ |
+3
-3
| { | ||
| "name": "mineflayer", | ||
| "version": "4.32.0", | ||
| "version": "4.33.0", | ||
| "description": "create minecraft bots with a stable, high level API", | ||
@@ -24,4 +24,4 @@ "main": "index.js", | ||
| "dependencies": { | ||
| "minecraft-data": "^3.76.0", | ||
| "minecraft-protocol": "^1.60.0", | ||
| "minecraft-data": "^3.98.0", | ||
| "minecraft-protocol": "^1.61.0", | ||
| "prismarine-biome": "^1.1.1", | ||
@@ -28,0 +28,0 @@ "prismarine-block": "^1.22.0", |
+1
-1
@@ -20,3 +20,3 @@ # Mineflayer | ||
| * Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, and 1.21) | ||
| * Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21) <!--version--> | ||
| * Entity knowledge and tracking. | ||
@@ -23,0 +23,0 @@ * Block knowledge. You can query the world around you. Milliseconds to find any block. |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1237132
0.49%188
1.62%10291
0.74%18
28.57%1
Infinity%- Removed
- Removed
Updated
Updated