Skip to content

Commit

Permalink
$mol_file improve copy api 3
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Oct 21, 2024
1 parent 1eda482 commit 0de3bee
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions build/build.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1404,14 +1404,23 @@ namespace $ {
const root = this.root()
const pack = $mol_file.absolute( path )

var sources = this.sourcesAll( [ path , exclude ] )
.filter( src => /meta.tree$/.test( src.ext() ) )
const sources = this.sourcesAll( [ path , exclude ] )
.filter( src => /meta.tree$/.test( src.ext() ) )

const targets : $mol_file[] = []
sources.forEach( source => {
const tree = this.$.$mol_tree2_from_string( source.text() , source.path() )

const pushFile = (file:$mol_file) => {
for (const source of sources) {

const addFilesRecursive = (file:$mol_file) =>{

if ( ! file.exists() ) return

if( file.type() === 'dir') {
for (const sub of file.sub()) {
addFilesRecursive(sub)
}
return
}
const start = Date.now()

const target = file.clone(pack.resolve( `-/${ file.relate( root ) }` ).path())
Expand All @@ -1421,24 +1430,13 @@ namespace $ {
this.logBundle( target , Date.now() - start )
}

const addFilesRecursive = (file:$mol_file) =>{

if ( ! file.exists() ) return
if( file.type() === 'dir') {
file.sub().forEach(sub => {
addFilesRecursive(sub)
})
}
else {
pushFile(file)
}

}
const tree = this.$.$mol_tree2_from_string( source.text() , source.path() )

tree.select( 'deploy' ).kids.forEach( deploy => {
addFilesRecursive(root.resolve(deploy.text().replace( /^\// , '' )))
} )

} )
}

return targets
}
Expand Down

0 comments on commit 0de3bee

Please sign in to comment.