Created
February 17, 2020 20:18
-
-
Save BioPhoton/894a707d6498a21291a641788263c471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs-extra'; | |
import * as path from 'path'; | |
import { bindNodeCallback, concat, Observable, from } from 'rxjs'; | |
import { map } from 'rxjs/operators'; | |
export function globCopy( | |
patterns: string[], | |
dir: string | |
): Observable<{patterns: string[], num: number}> { | |
return bindNodeCallback(copy)(patterns, dir) | |
.pipe( | |
map((files) => ({ patterns, num: files.length }) | |
) | |
); | |
} | |
const wd = process.cwd(); | |
const filesToCopy = [ | |
path(wd,'builders.json'), | |
path(wd,'collection.json'), | |
]; | |
const copyAll = globCopy( | |
filesToCopy, | |
`${wd}/dist` | |
); | |
const rename = from(fs.rename(path(${wd},'package.build.json'))); | |
concat(copyAll, rename).subscribe(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment