Skip to content

Instantly share code, notes, and snippets.

@BioPhoton
Created February 17, 2020 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BioPhoton/894a707d6498a21291a641788263c471 to your computer and use it in GitHub Desktop.
Save BioPhoton/894a707d6498a21291a641788263c471 to your computer and use it in GitHub Desktop.
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