File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 1
1
import terser from '@rollup/plugin-terser' ;
2
2
import alias from '@rollup/plugin-alias' ;
3
+ import fs from 'fs' ;
3
4
import path from 'path' ;
4
5
import { fileURLToPath } from 'url' ;
5
6
6
7
const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
7
8
8
- function banner ( ) {
9
+ function findCubismDir ( ) {
10
+ const buildDir = path . join ( __dirname , 'build' ) ;
11
+ let candidates = fs . readdirSync ( buildDir )
12
+ . filter ( f => f . startsWith ( 'CubismSdkForWeb-' ) && fs . statSync ( path . join ( buildDir , f ) ) . isDirectory ( ) ) ;
13
+ if ( candidates . length === 0 ) {
14
+ candidates = [ 'CubismSdkForWeb-5-r.4' ] ;
15
+ }
16
+ return path . join ( buildDir , candidates [ 0 ] ) ;
17
+ }
9
18
19
+ const cubismDir = findCubismDir ( ) ;
20
+
21
+ function banner ( ) {
10
22
return {
11
23
name : 'banner' ,
12
24
@@ -34,11 +46,11 @@ export default {
34
46
entries : [
35
47
{
36
48
find : '@demo' ,
37
- replacement : path . resolve ( __dirname , 'build/CubismSdkForWeb-5-r.4/ Samples/TypeScript/Demo/src/' )
49
+ replacement : path . resolve ( cubismDir , 'Samples/TypeScript/Demo/src/' )
38
50
} ,
39
51
{
40
52
find : '@framework' ,
41
- replacement : path . resolve ( __dirname , 'build/CubismSdkForWeb-5-r.4/ Framework/src/' )
53
+ replacement : path . resolve ( cubismDir , 'Framework/src/' )
42
54
}
43
55
]
44
56
} ) ,
You can’t perform that action at this time.
0 commit comments