Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ module.exports = function (argv: string[]): void {
// default must remain undefined for dependencies or we will fail to load defaults from package.json
.option('--dependencies', 'Enable dependency detection via npm or yarn', undefined)
.option('--no-dependencies', 'Disable dependency detection via npm or yarn', undefined)
.action(({ tree, yarn, packagedDependencies, ignoreFile, dependencies }) =>
main(ls({ tree, useYarn: yarn, packagedDependencies, ignoreFile, dependencies }))
.option('--readme-path <path>', 'Path to README file (defaults to README.md)')
.action(({ tree, yarn, packagedDependencies, ignoreFile, dependencies, readmePath }) =>
main(ls({ tree, useYarn: yarn, packagedDependencies, ignoreFile, dependencies, readmePath }))
);

program
Expand Down
14 changes: 9 additions & 5 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1610,8 +1610,6 @@ const defaultIgnore = [
'**/.vscode-test-web/**',
];

const notIgnored = ['!package.json', '!README.md'];

async function collectAllFiles(
cwd: string,
dependencies: 'npm' | 'yarn' | 'none' | undefined,
Expand Down Expand Up @@ -1647,8 +1645,12 @@ function collectFiles(
dependencies: 'npm' | 'yarn' | 'none' | undefined,
dependencyEntryPoints?: string[],
ignoreFile?: string,
manifestFileIncludes?: string[]
manifestFileIncludes?: string[],
readmePath?: string,
): Promise<string[]> {
readmePath = readmePath ?? 'README.md';
const notIgnored = ['!package.json', `!${readmePath}`];

return collectAllFiles(cwd, dependencies, dependencyEntryPoints).then(files => {
files = files.filter(f => !/\r$/m.test(f));

Expand Down Expand Up @@ -1756,7 +1758,7 @@ export function collect(manifest: Manifest, options: IPackageOptions = {}): Prom
const ignoreFile = options.ignoreFile || undefined;
const processors = createDefaultProcessors(manifest, options);

return collectFiles(cwd, getDependenciesOption(options), packagedDependencies, ignoreFile, manifest.files).then(fileNames => {
return collectFiles(cwd, getDependenciesOption(options), packagedDependencies, ignoreFile, manifest.files, options.readmePath).then(fileNames => {
const files = fileNames.map(f => ({ path: util.filePathToVsixPath(f), localPath: path.join(cwd, f) }));

return processFiles(processors, files);
Expand Down Expand Up @@ -1915,6 +1917,7 @@ export interface IListFilesOptions {
readonly ignoreFile?: string;
readonly dependencies?: boolean;
readonly prepublish?: boolean;
readonly readmePath?: string;
}

/**
Expand All @@ -1928,7 +1931,7 @@ export async function listFiles(options: IListFilesOptions = {}): Promise<string
await prepublish(cwd, manifest, options.useYarn);
}

return await collectFiles(cwd, getDependenciesOption(options), options.packagedDependencies, options.ignoreFile, manifest.files);
return await collectFiles(cwd, getDependenciesOption(options), options.packagedDependencies, options.ignoreFile, manifest.files, options.readmePath);
}

interface ILSOptions {
Expand All @@ -1937,6 +1940,7 @@ interface ILSOptions {
readonly packagedDependencies?: string[];
readonly ignoreFile?: string;
readonly dependencies?: boolean;
readonly readmePath?: string;
}

/**
Expand Down