@@ -49,6 +49,18 @@ export default function (file, output, options) {
49
49
return relativePath ;
50
50
}
51
51
52
+ function getTransformOutput ( output , file ) {
53
+ const { name, dir } = path . parse ( path . resolve ( file ) ) ;
54
+
55
+ // default angular's assets directory
56
+ if ( file . includes ( "public" ) ) {
57
+ return path . join ( dir , name + "-transformed.glb" ) ;
58
+ }
59
+
60
+ const outputDir = path . parse ( path . resolve ( output ?? file ) ) . dir ;
61
+ return path . join ( outputDir , name + "-transformed.glb" ) ;
62
+ }
63
+
52
64
// function getFilePath(file) {
53
65
// // remove public from path. assuming that public is the assets root
54
66
// if (file.includes("public/")) {
@@ -62,11 +74,10 @@ export default function (file, output, options) {
62
74
let size = "" ;
63
75
64
76
if ( options . transform || options . instance || options . instanceall ) {
65
- const { name } = path . parse ( file ) ;
66
- const outputDir = path . parse ( path . resolve ( output ?? file ) ) . dir ;
67
- const transformOut = path . join ( outputDir , name + "-transformed.glb" ) ;
68
-
69
- console . log ( { file, name, outputDir, transformOut } ) ;
77
+ const transformOut = getTransformOutput ( output , file ) ;
78
+ console . warn (
79
+ `Transform output ${ transformOut } might not work for you. Move the file manually if needed.` ,
80
+ ) ;
70
81
71
82
await transform ( file , transformOut , options ) ;
72
83
const { size : sizeOriginal , sizeKB : sizeKBOriginal } =
0 commit comments