@@ -14,7 +14,7 @@ import * as colors from "fmt/colors.ts";
14
14
import { copyMinimal , copyTo } from "../../core/copy.ts" ;
15
15
import * as ld from "../../core/lodash.ts" ;
16
16
17
- import { kKeepMd } from "../../config/constants.ts" ;
17
+ import { kKeepMd , kTargetFormat } from "../../config/constants.ts" ;
18
18
19
19
import {
20
20
kProjectExecuteDir ,
@@ -63,6 +63,7 @@ import {
63
63
import { asArray } from "../../core/array.ts" ;
64
64
import { normalizePath } from "../../core/path.ts" ;
65
65
import { isSubdir } from "fs/_util.ts" ;
66
+ import { Format } from "../../config/types.ts" ;
66
67
67
68
export async function renderProject (
68
69
context : ProjectContext ,
@@ -461,12 +462,31 @@ export async function renderProject(
461
462
// srcPath -> Set<destinationPaths>
462
463
const resourceFilesToCopy : Record < string , Set < string > > = { } ;
463
464
464
- // Process the project resources
465
- context . files . resources ?. forEach ( ( resource ) => {
466
- resourceFilesToCopy [ resource ] = resourceFilesToCopy [ resource ] ||
467
- new Set ( ) ;
468
- const relativePath = relative ( context . dir , resource ) ;
469
- resourceFilesToCopy [ resource ] . add ( join ( projOutputDir , relativePath ) ) ;
465
+ const projectFormats : Record < string , Format > = { } ;
466
+ projResults . files . forEach ( ( file ) => {
467
+ if (
468
+ file . format . identifier [ kTargetFormat ] &&
469
+ projectFormats [ file . format . identifier [ kTargetFormat ] ] === undefined
470
+ ) {
471
+ projectFormats [ file . format . identifier [ kTargetFormat ] ] = file . format ;
472
+ }
473
+ } ) ;
474
+
475
+ Object . values ( projectFormats ) . forEach ( ( format ) => {
476
+ // Process the project resources
477
+ const formatOutputDir = projectFormatOutputDir (
478
+ format ,
479
+ context ,
480
+ projType ,
481
+ ) ;
482
+ context . files . resources ?. forEach ( ( resource ) => {
483
+ resourceFilesToCopy [ resource ] = resourceFilesToCopy [ resource ] ||
484
+ new Set ( ) ;
485
+ const relativePath = relative ( context . dir , resource ) ;
486
+ resourceFilesToCopy [ resource ] . add (
487
+ join ( formatOutputDir , relativePath ) ,
488
+ ) ;
489
+ } ) ;
470
490
} ) ;
471
491
472
492
// Process the resources provided by the files themselves
0 commit comments