janikvonrotz
10/19/2016 - 12:39 AM

Create index.js for node.js project #PowerShell #Node.js

Create index.js for node.js project #PowerShell #Node.js


$import = ""
$export = @()

Get-ChildItem | Where-Object{!@("store", "index").contains($_.BaseName)} | ForEach-Object{
    $import += "import $($_.baseName) from '$($_.baseName)';`n"
    $export += $_.BaseName
}

@"
$($import)

export { $($export -join(', ')) }
"@ | Out-File -Encoding utf8 'index.js'