Skip to content

Commit 92b1824

Browse files
authored
🔀 Merge #492: 🔖 v1.10.0-beta.6
2 parents b24b5ba + 5ef56e4 commit 92b1824

45 files changed

Lines changed: 3740 additions & 8214 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: bun install --frozen-lockfile
2424

2525
- name: Build
26-
run: bun run build
26+
run: bun run prod
2727

2828
- name: Run tests
2929
run: bun test

.scripts/plugins/packagerPlugin.ts

Lines changed: 55 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import type { Plugin } from 'esbuild'
22
import * as fs from 'fs'
33
import { readFileSync, writeFileSync } from 'fs'
44
import { basename, join } from 'node:path'
5-
import { Octokit } from 'octokit'
6-
import * as prettier from 'prettier'
75
import { sveltePreprocess } from 'svelte-preprocess'
86
// @ts-expect-error - Types are broken in nodenext for this package, but it works fine.
97
import { typescript } from 'svelte-preprocess-esbuild'
@@ -13,16 +11,12 @@ import { render } from 'svelte/server'
1311
// @ts-expect-error - Svelte's internal server-side rendering API is not typed, but we need it to render the about.svelte file at build time.
1412
import * as svelteInternalServer from 'svelte/internal/server'
1513

16-
const OCTO_KIT = new Octokit({})
17-
1814
const PACKAGE = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
1915
const PLUGIN_PACKAGE_PATH = './src/pluginPackage/'
2016
const SVELTE_FILE = './src/pluginPackage/about.svelte'
2117
const README_DIST_PATH = './dist/pluginPackage/about.md'
2218
const DIST_PATH = './dist/'
2319
const DIST_PACKAGE_PATH = './dist/pluginPackage/'
24-
const PLUGIN_REPO_PATH = 'D:/github-repos/snavesutit/blockbench-plugins/plugins/animated_java'
25-
const PLUGIN_MANIFEST_PATH = 'D:/github-repos/snavesutit/blockbench-plugins/plugins.json'
2620
const CHANGELOG_PATH = './src/pluginPackage/changelog.json'
2721
const RELEASE_NOTES_TEMPLATES = './.scripts/plugins/releaseNoteTemplates/'
2822
const URL_REGEX =
@@ -32,18 +26,6 @@ function replaceTemplateVars(str: string, items: Record<string, string>) {
3226
return str.replace(/\{(.+?)\}/g, str => items[str.replace(/[\{\}]/g, '')] ?? str)
3327
}
3428

35-
const VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9]+))?/
36-
37-
function getVersionNumbers(version: string) {
38-
const match = VERSION_REGEX.exec(version)
39-
if (!match) return null
40-
const major = parseInt(match[1])
41-
const minor = parseInt(match[2])
42-
const patch = parseInt(match[3])
43-
const preRelease = match[4] ?? null
44-
return { major, minor, patch, preRelease }
45-
}
46-
4729
/**
4830
* Convert a warning or error emitted from the svelte compiler for esbuild.
4931
*/
@@ -160,114 +142,68 @@ function plugin(): Plugin {
160142
fs.unlinkSync(join(DIST_PACKAGE_PATH, 'about.svelte'))
161143

162144
if (process.env.NODE_ENV === 'production') {
163-
try {
164-
console.log('📝 Creating changelogs...')
165-
const rawChangelog = fs.readFileSync(CHANGELOG_PATH, 'utf-8')
166-
const changelog = JSON.parse(rawChangelog)
167-
for (const file of fs.readdirSync(RELEASE_NOTES_TEMPLATES)) {
168-
let content = fs.readFileSync(
169-
join(RELEASE_NOTES_TEMPLATES, file),
170-
'utf-8'
171-
)
172-
let pings = ''
173-
const version = getVersionNumbers(PACKAGE.version)
174-
if (!version) {
175-
throw new Error(
176-
`Version ${PACKAGE.version} in package.json is not valid semver!`
177-
)
178-
}
179-
const latestRelease = getVersionNumbers(
180-
(
181-
await OCTO_KIT.request('GET /repos/{owner}/{repo}/releases', {
182-
owner: 'animated-java',
183-
repo: 'animated-java',
184-
per_page: 1,
185-
headers: {
186-
accept: 'application/vnd.github+json',
187-
'X-GitHub-Api-Version': '2022-11-28',
188-
},
189-
})
190-
).data[0].tag_name
145+
console.log('📝 Creating changelogs...')
146+
const rawChangelog = fs.readFileSync(CHANGELOG_PATH, 'utf-8')
147+
const changelog = JSON.parse(rawChangelog)
148+
for (const file of fs.readdirSync(RELEASE_NOTES_TEMPLATES)) {
149+
let content = fs.readFileSync(join(RELEASE_NOTES_TEMPLATES, file), 'utf-8')
150+
151+
const versionChangelog = changelog[PACKAGE.version]
152+
if (!versionChangelog) {
153+
console.warn(
154+
`⚠️ No changelog found for version ${PACKAGE.version} in ${CHANGELOG_PATH}`
191155
)
192-
if (!latestRelease) {
193-
throw new Error('No latest release found on github!')
194-
}
195-
if (version.major > latestRelease.major) {
196-
pings += `@Major Release Ping`
197-
}
198-
if (version.minor > latestRelease.minor) {
199-
pings += ` @Minor Release Ping`
200-
}
201-
if (version.patch > latestRelease.patch) {
202-
pings += ` @Patch Release Ping`
203-
}
204-
if (latestRelease.preRelease) {
205-
pings += ` @Pre-Release Ping`
206-
}
207-
if (rawChangelog.includes('[BREAKING]')) {
208-
pings += ` @Breaking Changes Ping`
209-
}
210-
211-
const versionChangelog = changelog[PACKAGE.version]
212-
if (!versionChangelog) {
213-
throw new Error(
214-
`No changelog found for version ${PACKAGE.version} in ${CHANGELOG_PATH}`
215-
)
216-
}
217-
218-
let categories = ''
219-
for (const category of versionChangelog.categories) {
220-
categories +=
221-
`\n\n### ${category.title}\n\n` +
222-
category.list
223-
.map((v: string) => '- ' + v)
224-
.join('\n')
225-
.replaceAll('[BREAKING]', '⚠️ **BREAKING** —')
226-
}
156+
return
157+
}
227158

228-
content = replaceTemplateVars(content, {
229-
version: PACKAGE.version,
230-
categories: categories.trim(),
231-
pings: pings.trim(),
232-
})
159+
let categories = ''
160+
for (const category of versionChangelog.categories) {
161+
categories +=
162+
`\n\n### ${category.title}\n\n` +
163+
category.list
164+
.map((v: string) => '- ' + v)
165+
.join('\n')
166+
.replaceAll('[BREAKING]', '⚠️ **BREAKING** —')
167+
}
233168

234-
if (content.includes('[[ESCAPE_URLS]]')) {
235-
content = content
236-
.replace('[[ESCAPE_URLS]]', '')
237-
.replaceAll(URL_REGEX, (match: string) => '<' + match + '>')
238-
}
169+
content = replaceTemplateVars(content, {
170+
version: PACKAGE.version,
171+
categories: categories.trim(),
172+
})
239173

240-
fs.writeFileSync(join(DIST_PATH, file), content)
174+
if (content.includes('[[ESCAPE_URLS]]')) {
175+
content = content
176+
.replace('[[ESCAPE_URLS]]', '')
177+
.replaceAll(URL_REGEX, (match: string) => '<' + match + '>')
241178
}
242-
} catch (e) {
243-
console.error('Error creating changelogs:', e)
244-
throw e
245-
}
246-
247-
if (fs.existsSync(PLUGIN_REPO_PATH)) {
248-
fs.rmSync(PLUGIN_REPO_PATH, { recursive: true, force: true })
249-
fs.cpSync(DIST_PACKAGE_PATH, PLUGIN_REPO_PATH, { recursive: true })
250-
const manifest = JSON.parse(fs.readFileSync(PLUGIN_MANIFEST_PATH, 'utf-8'))
251-
manifest.animated_java.title = PACKAGE.title
252-
manifest.animated_java.author = PACKAGE.author.name
253-
manifest.animated_java.icon = PACKAGE.icon
254-
manifest.animated_java.description = PACKAGE.description
255-
manifest.animated_java.version = PACKAGE.version
256-
manifest.animated_java.min_version = PACKAGE.min_blockbench_version
257-
manifest.animated_java.max_version = PACKAGE.max_blockbench_version
258-
manifest.animated_java.variant = PACKAGE.variant
259-
manifest.animated_java.tags = PACKAGE.tags
260-
manifest.animated_java.has_changelog = true
261179

262-
fs.writeFileSync(
263-
PLUGIN_MANIFEST_PATH,
264-
await prettier.format(JSON.stringify(manifest, null, '\t'), {
265-
useTabs: true,
266-
parser: 'json',
267-
})
268-
)
269-
console.log('📋 Copied to Plugin Repo!')
180+
fs.writeFileSync(join(DIST_PATH, file), content)
270181
}
182+
183+
// if (fs.existsSync(PLUGIN_REPO_PATH)) {
184+
// fs.rmSync(PLUGIN_REPO_PATH, { recursive: true, force: true })
185+
// fs.cpSync(DIST_PACKAGE_PATH, PLUGIN_REPO_PATH, { recursive: true })
186+
// const manifest = JSON.parse(fs.readFileSync(PLUGIN_MANIFEST_PATH, 'utf-8'))
187+
// manifest.animated_java.title = PACKAGE.title
188+
// manifest.animated_java.author = PACKAGE.author.name
189+
// manifest.animated_java.icon = PACKAGE.icon
190+
// manifest.animated_java.description = PACKAGE.description
191+
// manifest.animated_java.version = PACKAGE.version
192+
// manifest.animated_java.min_version = PACKAGE.min_blockbench_version
193+
// manifest.animated_java.max_version = PACKAGE.max_blockbench_version
194+
// manifest.animated_java.variant = PACKAGE.variant
195+
// manifest.animated_java.tags = PACKAGE.tags
196+
// manifest.animated_java.has_changelog = true
197+
198+
// fs.writeFileSync(
199+
// PLUGIN_MANIFEST_PATH,
200+
// await prettier.format(JSON.stringify(manifest, null, '\t'), {
201+
// useTabs: true,
202+
// parser: 'json',
203+
// })
204+
// )
205+
// console.log('📋 Copied to Plugin Repo!')
206+
// }
271207
}
272208
})
273209
},

CONTRIBUTING.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@ Contributions are always welcome, however, please consult @SnaveSutit before sta
1111

1212
### 🛠️ Prerequisites
1313

14-
- #### Required
14+
- #### Required
15+
- [Bun](https://bun.sh/)
16+
- [Git](https://git-scm.com/)
1517

16-
- [Node.js](https://nodejs.org/en/)
17-
- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)
18-
- [Git](https://git-scm.com/)
19-
20-
- #### Recommended
21-
22-
- [VSCode](https://code.visualstudio.com/)
18+
- #### Recommended
19+
- [VSCode](https://code.visualstudio.com/)
2320
> (or any other code editor, but this project has configurations for VSCode)
24-
- [Blockbench](https://www.blockbench.net/)
21+
- [Blockbench](https://www.blockbench.net/)
2522
> The repository includes [Envbench](https://github.com/SnaveSutit/envbench) to create and manage a dev instance of Blockbench, So installing Blockbench separately is not strictly required.
26-
- [SnaveSutit's Blockbench Types](https://github.com/SnaveSutit/blockbench-types)
27-
> Bleeding edge types for Blockbench plugins.<br/>Install via `yarn add -D https://github.com/SnaveSutit/blockbench-types.git`
28-
- [GitButler](https://gitbutler.com/)
23+
- [SnaveSutit's Blockbench Types](https://github.com/SnaveSutit/blockbench-types)
24+
> Bleeding edge types for Blockbench plugins.<br/>Install via `bun add -D https://github.com/SnaveSutit/blockbench-types.git`
25+
- [GitButler](https://gitbutler.com/)
2926
> A Git client for simultaneous branches on top of your existing workflow.
3027
3128
## 🖇️ Cloning the Repository
@@ -34,7 +31,7 @@ Contributions are always welcome, however, please consult @SnaveSutit before sta
3431

3532
> [How do I clone a repository?](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
3633
37-
2. Run `yarn install` to install dependencies.
34+
2. Run `bun install` to install dependencies.
3835

3936
3. Open up `src/blockbenchTypes.d.ts` and replace the first line with the following:
4037

@@ -44,9 +41,9 @@ Contributions are always welcome, however, please consult @SnaveSutit before sta
4441

4542
> By default this references my local fork of the Blockbench types to quickly add / adjust types as needed. So you need to adjust this to the official Blockbench types, or your own fork, if you're not me.
4643

47-
4. Run `yarn dev` to start the development environment, which will watch for changes and recompile the plugin.
44+
4. Run `bun run dev` to start the development environment, which will watch for changes and recompile the plugin.
4845

49-
5. Open a new terminal, or click `Split` if you're in VSCode's terminal, and run `yarn start` to start the development instance of Blockbench.
46+
5. Open a new terminal, or click `Split` if you're in VSCode's terminal, and run `bun run start` to start the development instance of Blockbench.
5047

5148
6. That's it! You're ready to start developing.
5249

bun.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
"title": "Animated Java",
55
"icon": "icon.svg",
66
"description": "Effortlessly craft complex animations for Minecraft: Java Edition",
7-
"version": "1.10.0-beta.5",
7+
"version": "1.10.0-beta.6",
88
"min_blockbench_version": "5.1.4",
9-
"max_blockbench_version": "5.1.4",
109
"variant": "desktop",
1110
"tags": [
1211
"Minecraft: Java Edition",
@@ -93,8 +92,8 @@
9392
"@types/websocket": "^1.0.10",
9493
"@typescript-eslint/eslint-plugin": "^5.54.0",
9594
"@typescript-eslint/parser": "^5.54.0",
96-
"blockbench-patch-manager": "^1.0.2",
97-
"book-and-quill": "^1.0.8",
95+
"blockbench-patch-manager": "^1.1.0",
96+
"book-and-quill": "^1.0.9",
9897
"esbuild": "^0.17.10",
9998
"esbuild-plugin-import-folder": "^1.0.1",
10099
"esbuild-plugin-import-glob": "^0.1.1",

src/dialogs/blueprintSettings/blueprintSettings.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import GeneralComponent from './pages/general.svelte'
1515
import MiscComponent from './pages/misc.svelte'
1616
import PluginComponent from './pages/plugin.svelte'
1717
import ResourcepackComponent from './pages/resourcepack.svelte'
18+
import RigComponent from './pages/rig.svelte'
1819

1920
const localize = createScopedTranslator('dialog.blueprint_settings')
2021

@@ -28,17 +29,25 @@ export function openBlueprintSettings() {
2829
label: localize('pages.general.title'),
2930
icon: 'settings',
3031
},
32+
resourcepack: {
33+
component: ResourcepackComponent,
34+
condition: () => Project.pluginMode.get() === false,
35+
label: localize('pages.resource_pack.title'),
36+
icon: 'image',
37+
},
3138
datapack: {
3239
component: DatapackComponent,
3340
condition: () => Project.pluginMode.get() === false,
3441
label: localize('pages.datapack.title'),
3542
icon: 'database',
3643
},
37-
resourcepack: {
38-
component: ResourcepackComponent,
39-
condition: () => Project.pluginMode.get() === false,
40-
label: localize('pages.resource_pack.title'),
41-
icon: 'image',
44+
rig: {
45+
component: RigComponent,
46+
label: localize('pages.rig.title'),
47+
icon: 'fa-person',
48+
condition: () =>
49+
Project.pluginMode.get() === false &&
50+
Project.animated_java.data_pack_export_mode !== 'none',
4251
},
4352
eventFunctions: {
4453
component: EventFunctionsComponent,

0 commit comments

Comments
 (0)