Skip to content

Commit a03eceb

Browse files
committed
1.2.3
- Update to 1.18 snapshots
1 parent 5122395 commit a03eceb

File tree

11 files changed

+64
-55
lines changed

11 files changed

+64
-55
lines changed

.gitattributes

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
11
# General
22
* text=auto
3-
4-
# Project
5-
package-lock.json -diff
6-
7-
# Linguist
8-
*.ts linguist-language=TypeScript

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
node_modules/
2-
*.js
3-
*.d.ts
4-
!bin/*
2+
dist/

bin/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env node
2-
require('../src/cli.js');
2+
require('../dist/src/cli.js');

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.2.3
4+
*2021-09-16*
5+
- Updated to support 1.18 snapshots.
6+
37
## 1.2.2
48
*2021-07-23*
59
- Added support for Combat Test snapshots.

package-lock.json

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

package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
{
22
"name": "pack-format",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "Returns the pack_format of any Minecraft version, including snapshots",
55
"scripts": {
66
"prepublish": "tsc",
7-
"test": "tsc && node test/test"
7+
"test": "tsc && node dist/test/test"
88
},
99
"keywords": [
1010
"minecraft",
1111
"resourcepack",
12+
"resource pack",
1213
"datapack",
13-
"pack_format"
14+
"data pack",
15+
"pack format"
1416
],
15-
"main": "src/index.js",
17+
"main": "dist/src/index.js",
1618
"bin": {
1719
"pack-format": "bin/index.js"
1820
},
1921
"files": [
20-
"bin/*.js",
21-
"src/*.js",
22-
"src/*.d.ts"
22+
"bin/",
23+
"dist/src/"
2324
],
25+
"engines": {
26+
"node": ">=12"
27+
},
2428
"repository": {
2529
"type": "git",
2630
"url": "git+https://github.com/Nixinova/pack-format.git"
@@ -31,7 +35,7 @@
3135
},
3236
"license": "ISC",
3337
"devDependencies": {
34-
"@types/node": "ts4.3",
35-
"typescript": "~4.3.5"
38+
"@types/node": "ts4.4",
39+
"typescript": "~4.4.3"
3640
}
3741
}

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getPackFormat, getVersions, LATEST } from './index'
2-
const VERSION: string = require('../package.json').version
2+
import { version as VERSION } from '../package.json';
33

44
const arg = (n: number): string => process.argv[n + 1]
55
const indent = (n: number): string => ' '.repeat(n * 4)

src/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const RELEASES: Record<number, VersionName[]> = {
1717
4: ['1.13.x', '1.14.x'],
1818
5: ['1.15.x', '1.16.0', '1.16.1'],
1919
6: ['1.16.x'],
20-
7: ['1.17.x', '1.18.0'],
20+
7: ['1.17.x'],
21+
8: ['1.18.x'],
2122
}
2223

2324
const SPECIAL: Record<number, string[]> = {
@@ -36,6 +37,7 @@ const START_SNAPSHOTS: Record<SnapshotName, Record<PackType, FormatResult>> = {
3637
'20w06a': { resource: 5, data: 5 },
3738
'20w45a': { resource: 7, data: 6 },
3839
'20w46a': { resource: 7, data: 7 },
40+
'21w37a': { resource: 8, data: 8 },
3941
[fauxCurrentSnapshot]: { resource: undefined, data: undefined },
4042
}
4143

@@ -64,11 +66,17 @@ function getPackFormat(version: string, type: PackType = 'resource'): FormatResu
6466

6567
// Release //
6668

67-
version = version.replace(/-? *pre[- ]?(release)? */, '-pre').replace(/ *release candidate */, '-rc')
69+
version = version
70+
.replace(/-? *pre[- ]?(release)? */, '-pre')
71+
.replace(/ *release candidate */, '-rc')
72+
.replace(/ *experimental *snapshot|-es/, '-exp')
6873

6974
if (version.includes('-')) {
75+
// Special cases for specific development versions
7076
if (version.includes('1.16.2-pre')) return 5
71-
else version = version.replace(/-.+$/, '')
77+
if (version.includes('1.18-e')) return 7
78+
// Default to the parent version
79+
version = version.replace(/-.+$/, '')
7280
}
7381
if (/^\d+\.\d+$/.test(version)) version += '.0'
7482

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type VersionName = `1.${number}.${number | 'x'}`
2-
export type SnapshotName = `${number}w${string}${string}`
2+
export type SnapshotName = `${number}w${string}${Lowercase<string>}`
33

44
export type PackType = 'resource' | 'data'
55
export type PackMap = Record<PackType, FormatResult>

test/test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ testPackFormat(['16w31a'], 2)
5050
testPackFormat(['16w32a'], 3)
5151
testPackFormat(['20w30a'], 5)
5252
testPackFormat(['20w45a'], 7)
53+
testPackFormat(['21w37a'], 8)
5354
testPackFormat(['20w45a', 'resource'], 7)
5455
testPackFormat(['20w45a', 'data'], 6)
5556
testPackFormat(['20w46a', 'data'], 7)
5657
testPackFormat(['combat3'], 4)
5758
testPackFormat(['1.18-exp1'], 7)
59+
testPackFormat(['1.18-es2'], 7)
60+
testPackFormat(['1.18 experimental snapshot 3'], 7)
61+
testPackFormat(['1.18'], 8)
5862

5963
testVersions([3, 'data'], { releases: { min: '', max: '' }, snapshots: { min: '', max: '' } })
6064
testVersions([6, 'resource'], { releases: { min: '1.16.x', max: '1.16.x' }, snapshots: { min: '', max: '' } })

0 commit comments

Comments
 (0)