Commit 1fd7b61 1 parent 4a1b901 commit 1fd7b61 Copy full SHA for 1fd7b61
File tree 3 files changed +28
-4
lines changed
3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,16 @@ const DEFAULT_BACKGROUND_FILE = path.join(
16
16
)
17
17
18
18
const getFiles = ( ) => {
19
- return file . readdirSync ( DIST_DIR )
19
+ const ret = file . readdirSync ( DIST_DIR )
20
+ ret . unshift (
21
+ ret . splice (
22
+ ret . findIndex (
23
+ ( e ) => e === config . module . background . operator_bg_png
24
+ ) ,
25
+ 1
26
+ ) [ 0 ]
27
+ )
28
+ return ret
20
29
}
21
30
22
31
export let files = getFiles ( )
Original file line number Diff line number Diff line change @@ -10,15 +10,27 @@ import { getLangs } from '@aklive2d/charword-table'
10
10
const DIST_DIR = path . join ( import . meta. dirname , config . dir_name . dist )
11
11
12
12
export const build = ( namesToBuild ) => {
13
+ const err = [ ]
13
14
const names = ! namesToBuild . length ? Object . keys ( operators ) : namesToBuild
14
15
console . log ( 'Generating assets for' , names . length , 'operators' )
16
+ const musicMapping = [ ]
17
+ // sort music mapping based on background file order
18
+ for ( const item of backgrounds ) {
19
+ if ( musics . musicFileMapping [ item ] ) {
20
+ musicMapping . push ( item )
21
+ } else {
22
+ err . push (
23
+ `Music folder doesn't contain music for ${ item } background.`
24
+ )
25
+ }
26
+ }
15
27
for ( const name of names ) {
16
28
const { voiceLangs, subtitleLangs } = getLangs ( name )
17
29
load ( name , {
18
30
backgrounds,
19
31
voiceLangs,
20
32
subtitleLangs,
21
- music : Object . keys ( musics . musicFileMapping ) ,
33
+ music : musicMapping ,
22
34
} )
23
35
file . symlink (
24
36
path . join (
@@ -28,6 +40,7 @@ export const build = (namesToBuild) => {
28
40
path . join ( getDistDir ( name ) , config . module . project_json . preview_jpg )
29
41
)
30
42
}
43
+ return err
31
44
}
32
45
33
46
const getDistDir = ( name ) => {
Original file line number Diff line number Diff line change 1
- import { envParser } from '@aklive2d/libs'
1
+ import { envParser , error } from '@aklive2d/libs'
2
2
import { build } from './index.js'
3
3
4
4
async function main ( ) {
5
+ let err = [ ]
5
6
const { mode, name } = envParser . parse ( {
6
7
mode : {
7
8
type : 'string' ,
@@ -16,11 +17,12 @@ async function main() {
16
17
} )
17
18
switch ( mode ) {
18
19
case 'build' :
19
- build ( name )
20
+ err = build ( name )
20
21
break
21
22
default :
22
23
throw new Error ( `Unknown mode: ${ mode } ` )
23
24
}
25
+ error . handle ( err )
24
26
}
25
27
26
28
main ( )
You can’t perform that action at this time.
0 commit comments