Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Last active June 29, 2017 17:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janikvonrotz/7dc07c134f56d0e20be50826af67cb55 to your computer and use it in GitHub Desktop.
Save janikvonrotz/7dc07c134f56d0e20be50826af67cb55 to your computer and use it in GitHub Desktop.
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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment