diff --git a/src/main.ts b/src/main.ts index b26f853..9b6dc71 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,5 @@ import * as minimist from 'minimist'; -import { pack } from './package'; +import { pack, ls } from './package'; import { publish, list } from './publish'; import { fatal } from './util'; import { publisher } from './store'; @@ -10,6 +10,7 @@ function helpCommand(): void { Commands: publish Publishes an extension + ls Lists all the files that will be packaged list Lists all extensions published by the given publisher publisher add Add a publisher publisher rm Remove a publisher @@ -32,6 +33,7 @@ function command(args: minimist.ParsedArgs): boolean { const promise = (() => { switch (args._[0]) { case 'package': return pack(args._[1]).then(({ packagePath }) => console.log(`Package created: ${ packagePath }`)); + case 'ls': return ls(); case 'publish': return publish(args._[1]); case 'list': return list(args._[1]); case 'publisher': return publisher(args._[1], args._[2]); diff --git a/src/package.ts b/src/package.ts index c0c582c..d54031f 100644 --- a/src/package.ts +++ b/src/package.ts @@ -66,7 +66,7 @@ function prepublish(cwd: string, manifest: Manifest): Promise { } const script = manifest.scripts['vscode:prepublish']; - console.log(`Executing prepublish script '${ script }'...`); + console.warn(`Executing prepublish script '${ script }'...`); return nfcall(exec, script, { cwd }) .catch(err => reject(err.message)) @@ -151,4 +151,12 @@ export function pack(packagePath?: string, cwd = process.cwd()): Promise collect(cwd, manifest) .then(files => writeVsix(files, packagePath || defaultPackagePath(cwd, manifest)) .then(packagePath => ({ manifest, packagePath })))); +} + +export function ls(cwd = process.cwd()): Promise { + return readManifest(cwd) + .then(validateManifest) + .then(manifest => prepublish(cwd, manifest)) + .then(manifest => collectFiles(cwd, manifest)) + .then(files => files.forEach(f => console.log(`${f}`))); } \ No newline at end of file