Skip to content

Commit dd70844

Browse files
authored
Merge pull request #1022 from microsoft/benibenj/profound-gorilla
Throw error if provided readmePath or provided changelogPath could not be found
2 parents a97062f + ff9391d commit dd70844

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/package.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,12 +733,14 @@ export abstract class MarkdownProcessor extends BaseProcessor {
733733
private gitHubIssueLinking: boolean;
734734
private gitLabIssueLinking: boolean;
735735

736+
protected filesProcessed: number = 0;
737+
736738
constructor(
737739
manifest: Manifest,
738740
private name: string,
739741
filePath: string,
740742
private assetType: string,
741-
options: IPackageOptions = {}
743+
protected options: IPackageOptions = {}
742744
) {
743745
super(manifest);
744746

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

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

@@ -962,6 +965,13 @@ export class ReadmeProcessor extends MarkdownProcessor {
962965
options
963966
);
964967
}
968+
969+
override async onEnd(): Promise<void> {
970+
if (this.options.readmePath && this.filesProcessed === 0) {
971+
util.log.error(`The provided readme file (${this.options.readmePath}) could not be found.`);
972+
process.exit(1);
973+
}
974+
}
965975
}
966976

967977
export class ChangelogProcessor extends MarkdownProcessor {
@@ -974,6 +984,13 @@ export class ChangelogProcessor extends MarkdownProcessor {
974984
options
975985
);
976986
}
987+
988+
override async onEnd(): Promise<void> {
989+
if (this.options.changelogPath && this.filesProcessed === 0) {
990+
util.log.error(`The provided changelog file (${this.options.changelogPath}) could not be found.`);
991+
process.exit(1);
992+
}
993+
}
977994
}
978995

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

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

0 commit comments

Comments
 (0)