diff --git a/src/main.ts b/src/main.ts index b92c9b14..db16380a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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 to README file (defaults to README.md)') + .action(({ tree, yarn, packagedDependencies, ignoreFile, dependencies, readmePath }) => + main(ls({ tree, useYarn: yarn, packagedDependencies, ignoreFile, dependencies, readmePath })) ); program diff --git a/src/package.ts b/src/package.ts index 3748df9a..95a5fa87 100644 --- a/src/package.ts +++ b/src/package.ts @@ -1613,8 +1613,6 @@ const defaultIgnore = [ '**/.vscode-test-web/**', ]; -const notIgnored = ['!package.json', '!README.md']; - async function collectAllFiles( cwd: string, dependencies: 'npm' | 'yarn' | 'none' | undefined, @@ -1650,8 +1648,12 @@ function collectFiles( dependencies: 'npm' | 'yarn' | 'none' | undefined, dependencyEntryPoints?: string[], ignoreFile?: string, - manifestFileIncludes?: string[] + manifestFileIncludes?: string[], + readmePath?: string, ): Promise { + readmePath = readmePath ?? 'README.md'; + const notIgnored = ['!package.json', `!${readmePath}`]; + return collectAllFiles(cwd, dependencies, dependencyEntryPoints).then(files => { files = files.filter(f => !/\r$/m.test(f)); @@ -1759,7 +1761,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); @@ -1918,6 +1920,7 @@ export interface IListFilesOptions { readonly ignoreFile?: string; readonly dependencies?: boolean; readonly prepublish?: boolean; + readonly readmePath?: string; } /** @@ -1931,7 +1934,7 @@ export async function listFiles(options: IListFilesOptions = {}): Promise