Merge pull request #268 from ritwickdey/publish-yarn

useYarn parameter while publishing extension
This commit is contained in:
João Moreno 2018-06-25 16:26:49 +02:00 committed by GitHub
commit 5b85979fda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -77,7 +77,8 @@ module.exports = function (argv: string[]): void {
.option('--packagePath [path]', 'Publish the VSIX package located at the specified path.') .option('--packagePath [path]', 'Publish the VSIX package located at the specified path.')
.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((version, { pat, packagePath, baseContentUrl, baseImagesUrl }) => main(publish({ pat, version, packagePath, baseContentUrl, baseImagesUrl }))); .option('--yarn', 'Use yarn instead of npm while packing extension files')
.action((version, { pat, packagePath, baseContentUrl, baseImagesUrl, yarn }) => main(publish({ pat, version, packagePath, baseContentUrl, baseImagesUrl, useYarn: yarn })));
program program
.command('unpublish [<extensionid>]') .command('unpublish [<extensionid>]')

View file

@ -93,6 +93,7 @@ export interface IPublishOptions {
pat?: string; pat?: string;
baseContentUrl?: string; baseContentUrl?: string;
baseImagesUrl?: string; baseImagesUrl?: string;
useYarn?: boolean;
} }
function versionBump(cwd: string = process.cwd(), version?: string): Promise<void> { function versionBump(cwd: string = process.cwd(), version?: string): Promise<void> {
@ -139,10 +140,11 @@ export function publish(options: IPublishOptions = {}): Promise<any> {
const cwd = options.cwd; const cwd = options.cwd;
const baseContentUrl = options.baseContentUrl; const baseContentUrl = options.baseContentUrl;
const baseImagesUrl = options.baseImagesUrl; const baseImagesUrl = options.baseImagesUrl;
const useYarn = options.useYarn;
promise = versionBump(options.cwd, options.version) promise = versionBump(options.cwd, options.version)
.then(() => tmpName()) .then(() => tmpName())
.then(packagePath => pack({ packagePath, cwd, baseContentUrl, baseImagesUrl })); .then(packagePath => pack({ packagePath, cwd, baseContentUrl, baseImagesUrl, useYarn }));
} }
return promise.then(({ manifest, packagePath }) => { return promise.then(({ manifest, packagePath }) => {