-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
preset_build.js
77 lines (72 loc) · 1.7 KB
/
preset_build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const { ModuleParser, BedrockPackBuilder } = require('memepack-builder')
const { writeFileSync, existsSync, mkdirSync } = require('fs')
const { resolve } = require('path')
const glob = require('glob')
const PACK_VERSION = '1.9.0'
const preset_args = [
{
platform: 'bedrock',
type: 'mcpack',
compatible: false,
modules: {
resource: ['meme_resourcepack'],
collection: [],
},
},
{
platform: 'bedrock',
type: 'mcpack',
compatible: true,
modules: {
resource: ['meme_resourcepack'],
collection: [],
},
},
{
platform: 'bedrock',
type: 'zip',
compatible: false,
modules: {
resource: ['meme_resourcepack'],
collection: [],
},
},
{
platform: 'bedrock',
type: 'zip',
compatible: true,
modules: {
resource: ['meme_resourcepack'],
collection: [],
},
},
]
const preset_name = [
`meme-resourcepack_v${PACK_VERSION}.mcpack`,
`meme-resourcepack_compatible_v${PACK_VERSION}.mcpack`,
`meme-resourcepack_v${PACK_VERSION}.zip`,
`meme-resourcepack_compatible_v${PACK_VERSION}.zip`,
]
async function start() {
const beModules = new ModuleParser()
beModules.addSearchPaths(resolve(__dirname, './modules'))
const be = new BedrockPackBuilder(
await beModules.searchModules(),
resolve(__dirname, './modules/prioroty.txt'),
)
if (!existsSync('./builds')) {
mkdirSync('./builds')
}
for (const [i, arg] of preset_args.entries()) {
try {
let r = await be.build(arg)
console.log(arg, preset_name[i])
writeFileSync(resolve(__dirname, `./builds/${preset_name[i]}`), r)
} catch (e) {
console.error(e)
process.exit(1)
}
}
process.exit(0)
}
start()