ls command

This commit is contained in:
Joao Moreno 2015-10-07 11:34:51 +02:00
parent 6b7fe7328a
commit b097d931db
2 changed files with 12 additions and 2 deletions

View file

@ -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 <publisher> Lists all extensions published by the given publisher
publisher add <publisher> Add a publisher
publisher rm <publisher> 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]);

View file

@ -66,7 +66,7 @@ function prepublish(cwd: string, manifest: Manifest): Promise<Manifest> {
}
const script = manifest.scripts['vscode:prepublish'];
console.log(`Executing prepublish script '${ script }'...`);
console.warn(`Executing prepublish script '${ script }'...`);
return nfcall<string>(exec, script, { cwd })
.catch(err => reject(err.message))
@ -151,4 +151,12 @@ export function pack(packagePath?: string, cwd = process.cwd()): Promise<IPackag
.then(manifest => collect(cwd, manifest)
.then(files => writeVsix(files, packagePath || defaultPackagePath(cwd, manifest))
.then(packagePath => ({ manifest, packagePath }))));
}
export function ls(cwd = process.cwd()): Promise<any> {
return readManifest(cwd)
.then(validateManifest)
.then(manifest => prepublish(cwd, manifest))
.then(manifest => collectFiles(cwd, manifest))
.then(files => files.forEach(f => console.log(`${f}`)));
}