Skip to content
Merged
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
21 changes: 19 additions & 2 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,14 @@ export abstract class MarkdownProcessor extends BaseProcessor {
private gitHubIssueLinking: boolean;
private gitLabIssueLinking: boolean;

protected filesProcessed: number = 0;

constructor(
manifest: Manifest,
private name: string,
filePath: string,
private assetType: string,
options: IPackageOptions = {}
protected options: IPackageOptions = {}
) {
super(manifest);

Expand All @@ -761,6 +763,7 @@ export abstract class MarkdownProcessor extends BaseProcessor {
if (!this.regexp.test(filePath)) {
return Promise.resolve(file);
}
this.filesProcessed++;

this.assets.push({ type: this.assetType, path: filePath });

Expand Down Expand Up @@ -962,6 +965,13 @@ export class ReadmeProcessor extends MarkdownProcessor {
options
);
}

override async onEnd(): Promise<void> {
if (this.options.readmePath && this.filesProcessed === 0) {
util.log.error(`The provided readme file (${this.options.readmePath}) could not be found.`);
process.exit(1);
}
}
}

export class ChangelogProcessor extends MarkdownProcessor {
Expand All @@ -974,6 +984,13 @@ export class ChangelogProcessor extends MarkdownProcessor {
options
);
}

override async onEnd(): Promise<void> {
if (this.options.changelogPath && this.filesProcessed === 0) {
util.log.error(`The provided changelog file (${this.options.changelogPath}) could not be found.`);
process.exit(1);
}
}
}

export class LicenseProcessor extends BaseProcessor {
Expand Down Expand Up @@ -1943,7 +1960,7 @@ export async function ls(options: ILSOptions = {}): Promise<void> {
}

/**
* Prints the packaged files of an extension.
* Prints the packaged files of an extension. And ensures .vscodeignore and files property in package.json are used correctly.
*/
export async function printAndValidatePackagedFiles(files: IFile[], cwd: string, manifest: Manifest, options: IPackageOptions): Promise<void> {
// Warn if the extension contains a lot of files
Expand Down