Merge pull request #260 from kevcunnane/master

Support Yarn use in package command
This commit is contained in:
João Moreno 2018-05-03 09:02:34 +02:00 committed by GitHub
commit a70271eceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -67,7 +67,8 @@ module.exports = function (argv: string[]): void {
.option('-o, --out [path]', 'Location of the package') .option('-o, --out [path]', 'Location of the package')
.option('--baseContentUrl [url]', 'Prepend all relative links in README.md with this url.') .option('--baseContentUrl [url]', 'Prepend all relative links in README.md with this url.')
.option('--baseImagesUrl [url]', 'Prepend all relative image links in README.md with this url.') .option('--baseImagesUrl [url]', 'Prepend all relative image links in README.md with this url.')
.action(({ out, baseContentUrl, baseImagesUrl }) => main(packageCommand({ packagePath: out, baseContentUrl, baseImagesUrl }))); .option('--yarn', 'Use yarn instead of npm')
.action(({ out, baseContentUrl, baseImagesUrl, yarn }) => main(packageCommand({ packagePath: out, baseContentUrl, baseImagesUrl, useYarn: yarn })));
program program
.command('publish [<version>]') .command('publish [<version>]')

View file

@ -63,6 +63,7 @@ export interface IPackageOptions {
packagePath?: string; packagePath?: string;
baseContentUrl?: string; baseContentUrl?: string;
baseImagesUrl?: string; baseImagesUrl?: string;
useYarn?: boolean;
} }
export interface IProcessor { export interface IProcessor {
@ -705,9 +706,10 @@ export function createDefaultProcessors(manifest: Manifest, options: IPackageOpt
export function collect(manifest: Manifest, options: IPackageOptions = {}): Promise<IFile[]> { export function collect(manifest: Manifest, options: IPackageOptions = {}): Promise<IFile[]> {
const cwd = options.cwd || process.cwd(); const cwd = options.cwd || process.cwd();
const useYarn = options.useYarn || false;
const processors = createDefaultProcessors(manifest, options); const processors = createDefaultProcessors(manifest, options);
return collectFiles(cwd).then(fileNames => { return collectFiles(cwd, useYarn).then(fileNames => {
const files = fileNames.map(f => ({ path: `extension/${f}`, localPath: path.join(cwd, f) })); const files = fileNames.map(f => ({ path: `extension/${f}`, localPath: path.join(cwd, f) }));
return processFiles(processors, files, options); return processFiles(processors, files, options);